Copied to clipboard

Flag this post as spam?

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


  • Joseph 12 posts 32 karma points
    Feb 01, 2011 @ 01:44
    Joseph
    0

    examine search does not work for some search terms

    I am doing site search using examine. I followed umbraco tv to configure my two files and copy the code to my page_load event handler in my user control used to list search results.

      SearchTerm = Request.QueryString["search"];

          if (string.IsNullOrEmpty(SearchTerm)) return;

          var criteria = ExamineManager.Instance

            .SearchProviderCollection["someSearcher"]

            .CreateSearchCriteria();

          var filter = criteria

            .GroupedOr(new string[] { "nodeName", "textBody" }, SearchTerm)

            .Not().Field("umbracoNaviHide", "1")

            .Compile();

          var a = ExamineManager.Instance.SearchProviderCollection["someSearcher"];

          SearchResults = a.Search(filter);

    I does not work for some search terms and i will get a null reference exception when executing SearchResults = a.Search(filter);

    When I comment out .search statement and print out the filter on the screen using response.write instead, i will see { SearchIndexType: , LuceneQuery: +(nodeName:My Search Term textBody:My Search Term) -umbracoNaviHide:1 } when working properly.

    but in the cases where exceptions are thrown, response.write(filter) shows:

    { SearchIndexType: , LuceneQuery: +(null null) -umbracoNaviHide:1 } 

     

    Does anybody know why?

     

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Feb 01, 2011 @ 10:29
    Ismail Mayat
    0

    what are the search terms that are causing the error? Also take a look at your index with luke and try some searches http://www.getopt.org/luke/

  • Joseph 12 posts 32 karma points
    Feb 01, 2011 @ 23:56
    Joseph
    0

    Search terms like "a" causes the error, but if I try "b", "libero" that will work even if there are no matching results returned.

  • Joseph 12 posts 32 karma points
    Feb 02, 2011 @ 00:46
    Joseph
    0

     

    Thanks for that. 

      I changed the    analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer,

           to    analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net" in my .config file, and it works.

    I do not know what analyser means though.

     

Please Sign in or register to post replies

Write your reply to:

Draft