Copied to clipboard

Flag this post as spam?

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


  • Gus Deadman 45 posts 65 karma points
    May 09, 2012 @ 11:55
    Gus Deadman
    0

    Installation procedure

    I've downloaded the zip file and installed it through the Developer/Install local package route and Simple Search is now listed in the list of installed packages but nowhere else. What else do I need to do to get the search box on the page and get it searching?

    Thanks

    Andrew

  • Thomas Höhler 1237 posts 1709 karma points MVP
    May 09, 2012 @ 12:29
    Thomas Höhler
    0

    In principle it installes only the necessary things like the dll and an example config. You have to edit the config file and then set up an xslt or usercontrol which does the search. Please take a look into the documentation (see the project page under the documentation tab or direct: http://our.umbraco.org/FileDownload?id=138)

    Think this will explain your questions, if not come back here and post your question details.

    hth, Thomas

  • Gus Deadman 45 posts 65 karma points
    May 09, 2012 @ 13:51
    Gus Deadman
    0

    Thomas,

    Thanks for coming back so swiftly. I followed the example in the document and all the files seemed to be in the right places but when I created the XSLT with the example code no macro was created even though the "create macro" box was ticked, so I am currently stuck at that point.

    I'm also not sure by what you mean in the example documentation when you say "Add a Search site to your content and add the macro which you created with the xslt..." Add a Search site, I've been looking for a macro to include on a page. What does "site" mean in this context?

    Any help would be gratefully received.

    Cheers

    Andrew

  • Thomas Höhler 1237 posts 1709 karma points MVP
    May 09, 2012 @ 14:12
    Thomas Höhler
    0

    Hi Andrew,

    if you got no macro just create a new one:

    • go to the developer section,
    • right click on macros and select new
    • type in a name for the macro
    • click the "new" button
    • Under "Use XSLT file" select the xslt file you have created
    With search site I mean that you should add a textpage to your site where you can add the macro.
    To call the search just add a textbox with an http get like this:
    <form action="{LINKTOSEARCHPAGE}" method="GET" id="search">
    <input type="text" id="Query" name="Query" />
    <input type="submit" value="search" />
    </form>
    In your xslt you can grab the value of the textbox via 
        <xsl:param name="phrase" select="umbraco.library:RequestQueryString('Query')"/>
    hth, Thomas
  • Gus Deadman 45 posts 65 karma points
    Sep 18, 2012 @ 11:13
    Gus Deadman
    0

    In the end I plumped for XSLT Search

    Gus

  • siriosus 3 posts 23 karma points
    Oct 08, 2012 @ 14:20
    siriosus
    0

    Hi! And what about if I want to implement this search module with simple text pages. I try to follow you example with Blog Search as you describe in documentation. And get an error.  

    I have this markup: 

    <form id="header-search" method="get" action="/1280.aspx">
                                                <ul>
                                                    <li>
                                                        <label for="main-search" class="viewport-bounce">:</label>
                                                        <input type="text" name="main-search" id="main-search" placeholder="" />
                                                    </li>
                                                    <li>
                                                        <input type="submit" id="main-search-submit" value="" />
                                                    </li>
                                                    <li><a href="#" id="close-main-search">
                                                        <img src="/images/search-close.png" alt="Close" /></a>
                                                    </li>
                                                </ul>
                                                <div class="suggestionsBoxHeader" id="suggestionsHeader">
                                                    <div class="suggestionListHeader" id="autoSuggestionsListHeader">
                                                    </div>
                                                </div>
                                            </form>

    And this xslt:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
    xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon"
    xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes"
    xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath"
    xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions"
    xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
    xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
    xmlns:ss4u.library="urn:ss4u.library"
    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon
    Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions
    Exslt.ExsltStrings Exslt.ExsltSets ss4u.library ">
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>
    <xsl:template match="/">
    <xsl:variable name="phrase" select="umbraco.library:RequestQueryString('main-search')"/>
    <xsl:if test="$phrase != ''">
    <xsl:variable name="results" select="ss4u.library:SearchToXml($phrase, 0, 'TextSearch')" />
    <h2>Results</h2>
    <p>Your search for <strong>'<xsl:value-of select="$phrase" />'</strong>returned <strong><xsl:value-of select="count($results/SearchResult)" /></strong>items</p>
    <ul>
    <xsl:for-each select="$results/SearchResult">
    <xsl:sort select="@createDate" order="descending"/>
    <li><a href="{@linkUrl}"><xsl:value-of select="@text" /></a></li>
    </xsl:for-each>
    </ul>
    </xsl:if>
    </xsl:template>
    </xsl:stylesheet>

    And this line in SearchPage template:

    <umbraco:Macro Alias="SimpleSearch" runat="server"></umbraco:Macro>

    This config:

    <?xml version="1.0"?>

    <SimpleSearch4Umbraco

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xmlns:xsd="http://www.w3.org/2001/XMLSchema">

      <SearchDefinition

      name="TextSearch"

      iterationType="IterateAll"

      isDefault="true">

        <DocumentType

        alias="TextPage"

        category="TextPage"

        includeChildNodes="false"

        testNodeName="true">

          <Property

          alias="tP_Content"

          comparisonType="String"

          comparison="Contains" />

          <Property

          alias="tP_Title"

          comparisonType="String"

          comparison="Contains" />

        </DocumentType>

      </SearchDefinition>

    </SimpleSearch4Umbraco>

    And get this error on the search page:
    Error parsing XSLT file: \xslt\SimpleSearch.xslt
    What I am doing wrong? Thanks!
                                                                                           
  • fermat 4 posts 24 karma points
    Jan 04, 2013 @ 00:03
    fermat
    0

    Hi Thomas,

    as mention above i have used 

    <formaction="{LINKTOSEARCHPAGE}"method="GET"id="search">
     
    <inputtype="text"id="Query"name="Query"/>
     
    <inputtype="submit"value="search"/>
    </form>

    But the i think i am confused about linktosearchpage format. i tried many different formats but it always gives me "the page could not be found". should it be sth like /tcbase/teacommerce/SubmitForm.aspx or sth like {umbraco.library:NiceUrl($category/@id)}

    thks -

    Frmt

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Jan 04, 2013 @ 00:44
    Thomas Höhler
    0

    The LINKTOSEARCHPAGE should be the url of the page with the search macro in it. So if you have a page "search" under your root it woud be "/search/". How this url is generated is your decision. I.e if you have a defined search page you can use

     {umbraco.library:NiceUrl(1234)}

    where 1234 is the id of your search page or you can link via hardcoded url like "htttp://www.yourdomain.com/search/"

    hth, Thomas

Please Sign in or register to post replies

Write your reply to:

Draft