Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Max Mumford 266 posts 293 karma points
    Jul 11, 2011 @ 16:26
    Max Mumford
    0

    Show Property Name of context where search term was found

    Hi,

    I want to modify XSLTsearch to show the name of the property in which the search term was found. E.g. if the search term "umbraco" was found in the property with alias "bodyText" and name "Content", I want the results output to be:

    • In "Content": blah blah blah umbraco blah blah blah...
    instead of
    • Context: blah blah blah umbraco blah blah blah...
    What is the name of the variable that would contain this information so I can edit the xslt file's output?
    Thanks,
    Max

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Jul 11, 2011 @ 17:16
    Douglas Robar
    0

    Hi, Max,

    It isn't simply a one or two line change. Basically, I would look at and re-factor the displayFieldText template in the /app_code/xsltsearch.cs file to become two steps. First is return the field the search term is found in (so you can save it as a variable and display it in your output). Then pass that field into another template to return the same thing as now is returned in the displayField variable (which you'll find around line 350)

                    <xsl:variable name="displayField">
                      <xsl:call-template name="displayFieldText">
                        <xsl:with-param name="item" select="."/>
                        <xsl:with-param name="fieldList" select="$previewFields"/>
                      </xsl:call-template>
                    </xsl:variable>

    Have fun and good luck.

     

    cheers,
    doug. 

     

  • Max Mumford 266 posts 293 karma points
    Jul 13, 2011 @ 13:44
    Max Mumford
    0

    Thanks Doug, I will come back to this problem and update this thread sometime in the future.

    Max

Please Sign in or register to post replies

Write your reply to:

Draft