Copied to clipboard

Flag this post as spam?

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


  • stuart.crouch 17 posts 37 karma points
    Nov 01, 2010 @ 15:01
    stuart.crouch
    0

    XSLT search

    Hi

    I've scoured the forums and I cant find a topic that matches what I'm getting, so I hope someone can help.  I've implemented the XSLT search macro on a search.aspx page, and linked to it via a universal search box in the header of the master template.

    I think the macro itself is working because if I search for "FAQ" (there is a page named FAQ so I'd expect at least one hit) I get the following html returned.

     

    <p>sac</p>
    <div id="xsltsearch" xmlns:ps="urn:percipientstudios-com:xslt">
    <h2>Search Results</h2>
    <p id="xsltsearch_summary">
    No matches were found for <strong>FAQ</strong>
    </p>
    <div id="xsltsearch_results"> </div>
    <form action="?" method="post" class="xsltsearch_form">
    <input name="search" type="text" class="input" value="FAQ" />
    <input type="submit" value="Search" class="submit" /></form>
    </div>
    <p>end sac</p>

     

    The HTML has the name of the thing I searched for so I assume the macro has picked up the term, processed it and decided there are no matches. Why does the macro think there are no matches? Is there a configuration step I've missed that could cause this?

  • Rich Green 2246 posts 4008 karma points
    Nov 01, 2010 @ 15:28
    Rich Green
    0

    Is the macro on the same page as the form, are you sure you shouldn't be redirecting to the search form?

    <form action="/search.aspx" method="post">
    <input name="search" id="search" type="text" />
    <input type="submit" value="Search" class="submit" /> </form>

    If you are not getting any results, my guess would be that the XSLT file is not receiving the search parameter.

    Rich

  • stuart.crouch 17 posts 37 karma points
    Nov 01, 2010 @ 15:50
    stuart.crouch
    0

    Hi Rich

    The form is on every page of the site - Its at the top of the page written as follows.  I thought I'd written it to correctly point to the search form but Im happy to be corrected if the following looks wrong

     <form action="/search.aspx" method="post">
    <div id="searchBox">
    <input name="search" type="text" class="searchBox" />
    <input type="submit" name="button" id="button" value="go" />
    </div>
    </form>

    You can see the search result page here (Which also has a copy of the search form at the top).  I used the form on the homepage to search for "test".  You can see that the macro correctly found and displayed the word "test" in its output when stating that there were no matches. I dont understand how the XSLT template can disaply the name of the thing I've searched for if its not recieving it as a parameter?

    <div id="Header">
    <div id="headerLeft">
    <a href="/"><img src="/media/template/HealthCareRM-logo.gif" width="196" height="89" alt="Healthcare Risk Management" /></a><p><span class="txtHeaderTel">Tel: 0871 200 5060 </span></p>
    </div>
    <div id="headerRight">
    <form action="/search.aspx" method="post">
    <div id="searchBox">
    <input name="search" type="text" class="searchBox" />
    <input type="submit" name="button" id="button" value="go" />
    </div>
    </form>
    </div>
    </div>
    <div id="topNavBar">
    <ul><li class="n1076"><a href="/about-us">About Us</a></li><li class="n1074"><a href="/health-wellbeing">Health &amp; Wellbeing</a></li><li class="n1112"><a href="/case-claims-management">Case &amp; Claims Management</a></li><li class="n1082"><a href="/occupational-health">Occupational Health</a></li><li class="n1114"><a href="/consultancy">Consultancy</a></li><li class="n1146"><a href="/media-centre">Media Centre</a></li><li class="n1115"><a href="/contact-us">Contact Us</a></li><li class="n1240"><a href="/search" class="selected">Search</a></li></ul>
    </div>
    <div id="midCont">
    <form method="post" action="/search.aspx?" id="aspnetForm">
    <div>
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUENTM4MWRkmXzoZM2xcrc/XCYgr4f3249HCMk=" />
    </div>


    <p>sac</p>
    <div id="xsltsearch" xmlns:ps="urn:percipientstudios-com:xslt"><h2>Search Results</h2><p id="xsltsearch_summary">
    No matches were found for <strong>test</strong></p><div id="xsltsearch_results"> </div><form action="?" method="post" class="xsltsearch_form"><input name="search" type="text" class="input" value="test" /> <input type="submit" value="Search" class="submit" /></form></div>
    <p>end sac</p>




    </asp:ContentPlaceHolder>
    </form>

    I admit that Im clueless in this regard so if you see an issue with the above html please explain where I've gone wrong.

  • Rich Green 2246 posts 4008 karma points
    Nov 01, 2010 @ 15:53
    Rich Green
    0

    Well, it certainly looks like the macro is receiving the parameter ok.

    Can you post your Macro insert code in your search template?

    Rich

  • stuart.crouch 17 posts 37 karma points
    Nov 01, 2010 @ 15:57
    stuart.crouch
    0

    Here is the entire macro

    <%@ Master Language="C#" MasterPageFile="~/masterpages/HRMMaster.master" AutoEventWireup="true" %>


    <asp:content ContentPlaceHolderId="hrmmasterContentPlaceHolder" runat="server">
      <p>sac</p>
      <umbraco:Macro source="1070" search="" preview="" previewType="" searchBoxLocation="" resultsPerPage="" previewChars="" showPageRange="" showOrdinals="" showScores="" showStats="" Alias="XSLTsearch" runat="server"></umbraco:Macro>
      <p>end sac</p>
     
    </asp:content>
  • stuart.crouch 17 posts 37 karma points
    Nov 01, 2010 @ 15:58
    stuart.crouch
    0

    And this is the html in the search page itself

    <p>search goes here</p>
    <p> </p>
    <div umb_macroalias="XSLTsearch" umb_source="1070" ismacro="true" onresizestart="return false;" umbversionid="c5835245-19b7-43fb-8908-1b6ed3673f4f" umbpageid="1240" title="This is rendered content from macro" class="umbMacroHolder"><!-- startUmbMacro --><span style="color: green;">No macro content available for WYSIWYG editing</span><!-- endUmbMacro --></div>
    <p> </p>
  • Rich Green 2246 posts 4008 karma points
    Nov 01, 2010 @ 16:01
    Rich Green
    0

    Hi Stuart,

    You are not telling XSLT search where to look, you should fill in all your parameters.

    Look at the third image on this page and all should make sense :)

    http://our.umbraco.org/projects/website-utilities/xsltsearch

    This should return the result from the name of your node

     <umbraco:Macro source="1070" search="@nodeName" preview="" previewType="" searchBoxLocation="" resultsPerPage="" previewChars="" showPageRange="" showOrdinals="" showScores="" showStats="" Alias="XSLTsearch" runat="server"></umbraco:Macro>

    Rich 

  • stuart.crouch 17 posts 37 karma points
    Nov 01, 2010 @ 16:20
    stuart.crouch
    0

    Hi

    I filled out as much as I could from that third image, they differ as the page Im presented with does not have tick boxes.  Once I'd finished the html looked like this

    <p>search goes here</p>
    <p> </p>
    <div umb_macroalias="XSLTsearch" umb_previewchars="120" umb_preview="bodyText,pageTitle" umb_search="@nodeName,pageTitle,bodyText" umb_resultsperpage="10" umb_source="1070" umb_searchboxlocation="bodyText" ismacro="true" onresizestart="return false;" umbversionid="c5835245-19b7-43fb-8908-1b6ed3673f4f" umbpageid="1240" title="This is rendered content from macro" class="umbMacroHolder"><!-- startUmbMacro --><span style="color: green;">No macro content available for WYSIWYG editing</span><!-- endUmbMacro --></div>
    <p> </p>


    Searching still returned no matches.  Did I miss the relevant bit from that image?

  • stuart.crouch 17 posts 37 karma points
    Nov 01, 2010 @ 16:25
    stuart.crouch
    0

    Not knowing quite what Im doing, I did the template as well

     

    <%@ Master Language="C#" MasterPageFile="~/masterpages/HRMMaster.master" AutoEventWireup="true" %>


    <asp:content ContentPlaceHolderId="hrmmasterContentPlaceHolder" runat="server">
      <p>sac</p>
      <umbraco:Macro source="1070" search="@nodeName,pageTitle,bodyText" preview="pageTitle,bodyText" previewType="" searchBoxLocation="" resultsPerPage="10" previewChars="120" showPageRange="true" showOrdinals="true" showScores="true" showStats="true" Alias="XSLTsearch" runat="server"></umbraco:Macro>
      <p>end sac</p>
      
    </asp:content>

    Still no results but it gives me more information now

    <p>sac</p>
    <div id="xsltsearch" xmlns:ps="urn:percipientstudios-com:xslt"><h2>Search Results</h2><p id="xsltsearch_summary">
    No matches were found for <strong>FAQ</strong></p><div id="xsltsearch_results"> </div><form action="?" method="post" class="xsltsearch_form"><input name="search" type="text" class="input" value="FAQ" /> <input type="submit" value="Search" class="submit" /></form><p id="xsltsearch_stats">
    Searched 0 pages in 0.016 seconds
    </p></div>
    <p>end sac</p>

    I'm obviously still getting something wrong.  Thanks for your help by the way :)

  • Rich Green 2246 posts 4008 karma points
    Nov 01, 2010 @ 16:27
    Rich Green
    0

    Can you postan image of your content structure, which node is number 1070?

    Rich

  • stuart.crouch 17 posts 37 karma points
    Nov 01, 2010 @ 16:31
    stuart.crouch
    0

    I think this is what you are after. Node 1070 is the root node.

  • Rich Green 2246 posts 4008 karma points
    Nov 01, 2010 @ 16:34
    Rich Green
    0

    Which version of XSLT did you install? http://our.umbraco.org/projects/website-utilities/xsltsearch there are two versions.

    Which version of Umbraco, do you have running?

    Rich

     

  • stuart.crouch 17 posts 37 karma points
    Nov 01, 2010 @ 16:41
    stuart.crouch
    0

    To be honest I dont know.  Another member of our team configured the server and then told me it was ready to implement the macros

    The about tab says we are using

    umbraco v 4.5.0 (Assembly version: 1.0.3833.20194)

    The package information for XSLT search says

    Package name
    XSLTsearch (upgrade)
    Package version
    2.7
    Author
    Douglas Robar
    Looking at your link this could well be the problem.
  • stuart.crouch 17 posts 37 karma points
    Nov 01, 2010 @ 16:45
    stuart.crouch
    0

    Can I ask for some more help?

    How do I get the updated version on there.  Do I uninstall the old one and then download and install a local package, or is it available in the package repository?

  • Rich Green 2246 posts 4008 karma points
    Nov 01, 2010 @ 16:48
    Rich Green
    1

    You can just download it from the link above, it will just be a zip file.

    I'm not 100% but you can probably just unzip it and open the xsltsearch.xslt file and copy and paste the content over the xsltsearch file in your install.

    Rich

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 01, 2010 @ 16:53
    Jan Skovgaard
    0

    Just to confirm - I have done it the way Rich is describing in the last post to upgrade previously.

    Off course one should be aware not to overwrite any custom changes if any such has been made. Otherwise it should work.

    /Jan

  • stuart.crouch 17 posts 37 karma points
    Nov 01, 2010 @ 16:58
    stuart.crouch
    0

    Thanks guys. Search is now working like a charm :D

    I'd use that high five thing but aparently I dont have karma or something :) so I'll just pound instead

    #

Please Sign in or register to post replies

Write your reply to:

Draft