Copied to clipboard

Flag this post as spam?

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


  • Sam 23 posts 115 karma points
    Oct 22, 2018 @ 12:16
    Sam
    0

    Search box

    Hi All,

    I have added a search field to my site. When i press search, it only returns a page type of the site outside of the root called Site Settings? Any help gladly accepted as to why my site isnt finding anything else.

    I have added the code for the search box:

           <form action="/search/" method="GET">
              <input type="text" placeholder="Search..." name="query">
              <button>Search</button>
           </form>
    
    var searchQuery = Request.QueryString["query"];
    
         if (!string.IsNullOrEmpty(searchQuery))    
         {
             <div class="searchresults">
                 <p>Your search results for <strong>@searchQuery</strong></p>
                 <ul>
                     @foreach (var result in Umbraco.Search(searchQuery))
                     {
                         <li>
                             <a href="@result.Url">@result.Name</a>
                         </li>
                     }
                 </ul>
             </div>
         }
    

    Following this, i added some index criteria to Examine Index .config and ExamineSettings.config.

    When i use the search tool in developer area, i get data returned but in here i do not :'(

    Many thanks in advance!

  • Mila Pandurska 75 posts 354 karma points
    Oct 22, 2018 @ 19:35
    Mila Pandurska
    0

    Hi, Sam, Do you have a page in your Content tree with link "/search"?

    Mila

  • Sam 23 posts 115 karma points
    Oct 22, 2018 @ 20:03
    Sam
    0

    Hi Mila thank you for replying!

    I do have a search page yes. The page produces a list of pages but the only one found is the site settings page.

    Sam

  • Mila Pandurska 75 posts 354 karma points
    Oct 24, 2018 @ 19:55
    Mila Pandurska
    0

    Hi, Sam, Umbraco.Search() uses the default "ExternalIndexSet". You mentioned that you made some changes in ExamineIndex and ExamineSettings. Can you share the settings?

    Regards Mila

Please Sign in or register to post replies

Write your reply to:

Draft