Copied to clipboard

Flag this post as spam?

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


  • John C Scott 473 posts 1183 karma points
    Jan 25, 2012 @ 10:55
    John C Scott
    0

    Examine Returns Results on only One Word

    Setting up my first examine search with Razor and there's a few things aren't quite working as I'd expect.

    EG if I search on "press" I get 4 results, "press release one", "press release two" etc. but if I search on "press release" I get no results at all. This remains true for every example where I search on one word and I get results, but I search on two words that are adjacent I always get nothing.

    I don't need anything particularly more complex than this.

    I've been following this example. http://farmcode.org/post/2011/03/15/Searching-Umbraco-using-Razor-and-Examine.aspx So the code I have looks like this:

      var searchTerm = Request.QueryString["s"];
      var searchProvider = ExamineManager.Instance.DefaultSearchProvider.Name;
      var pagesToList = ExamineManager.Instance.SearchProviderCollection[searchProvider].Search(searchTerm, true);
    
    Also I tried using the ucomponents quicksearch and got the same results.
    I'm wondering if the issue could be how the index is set up.
    Again following the example on farmcode I have added
    <IndexSet SetName="WebsiteIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/WebsiteIndexSet/">
    </IndexSet>
    to the <ExamineLuceneIndexSets> in ExamineIndex.config and everything else is "factory default"
    Could it be something I need to add here?

     

     

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Jan 25, 2012 @ 11:49
    Tim
    0

    I think you need to escape the search term? I'm not sure how you'd do it with the default search syntax that you're using. I normally use the Fluent API, which is just a case of putting .Escape() on the end of the search term.

    You can check the index by running Luke on it and seeing what's in the index. You can also run queries on the data in Luke to try and see what's going on.

  • John C Scott 473 posts 1183 karma points
    Jan 25, 2012 @ 11:50
    John C Scott
    0

    thanks Tim, I'll give that a go :)

  • John C Scott 473 posts 1183 karma points
    Jan 25, 2012 @ 11:55
    John C Scott
    0

    the code I put above was wrong by the way ... some of my messing about trying things got included in that :-$

    should have just been 

     var searchTerm = Request.QueryString["s"];
     var pagesToList = ExamineManager.Instance.Search(searchTerm, true);
Please Sign in or register to post replies

Write your reply to:

Draft