Copied to clipboard

Flag this post as spam?

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


  • Martin 44 posts 66 karma points
    Feb 08, 2011 @ 11:56
    Martin
    0

    Examine search configuration

    I have the following configuration:

    <add name="SiteSearchIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
    runAsync="true"
    supportUnpublished="true"
    supportProtected="true"
    interval="10"
    indexSet="SiteSearchIndexSet"
    analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>

        <IndexSet SetName="SiteSearchIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/SiteSearch/">
            <IndexAttributeFields>
                <add Name="id" />
                <add Name="nodeName" />
                <add Name="updateDate" />
            </IndexAttributeFields>
            <IndexUserFields>
                <add Name="content" />
                <add Name="metadescription" />
                <add Name="metakeywords" />
                <add Name="officeText" />
                <add Name="intro" />
            </IndexUserFields>
            <IncludeNodeTypes/>
            <ExcludeNodeTypes />
        </IndexSet>

    Here is the code I use for searching:

    var provider = (LuceneSearcher)ExamineManager.Instance.SearchProviderCollection["SiteSearchSearcher"];
    var results = provider.Search(query, true, "");

     

    If I search for ONE word, it works fine. If I search for two words, it never finds anything. What's wrong with my configuration?

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Feb 08, 2011 @ 13:47
    Ismail Mayat
    0

    The issue is the analyser setting "Lucene.Net.Analysis.WhitespaceAnalyzer needs to be StandardAnalyzer after setting it you will need to recreate the index http://our.umbraco.org/projects/backoffice-extensions/examine-index-admin

  • Martin 44 posts 66 karma points
    Feb 09, 2011 @ 00:29
    Martin
    0

    Thank you, but it did not work. I deleted the index and used the tool you suggested.

    The index was rebuild, but if I search for: 'who', i find what I'm looking for. However if I search for 'who are', I get not results. I have a page called: 'Who are we'.

    <add name="SiteSearchIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
                 runAsync="true"
                 supportUnpublished="true"
                 supportProtected="true"
                 interval="10"
                 indexSet="SiteSearchIndexSet"
                 analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"/>

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Feb 09, 2011 @ 09:50
  • Martin 44 posts 66 karma points
    Feb 09, 2011 @ 12:53
    Martin
    0

    It did not help. Here is the new code:

    var provider = (LuceneSearcher)ExamineManager.Instance.SearchProviderCollection["SiteSearchSearcher"];
    //var results = provider.Search(query, true, "");
    var criteria = provider.CreateSearchCriteria().NodeName(query.Fuzzy());
    var results = provider.Search(criteria.Compile());

    I also tried:

    var provider = (LuceneSearcher)ExamineManager.Instance.SearchProviderCollection["SiteSearchSearcher"];
    //var results = provider.Search(query, true, "");
    var criteria = provider.CreateSearchCriteria().NodeName(query.MultipleCharacterWildcard());
    var results = provider.Search(criteria.Compile());

     

    None of them finds the page named "Who are we", when I search for "who are". I still find the page, when I search for "Who".

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Feb 09, 2011 @ 14:36
    Ismail Mayat
    0

    what happens when you do wildcard query using luke on that specific index?

    Regards

    Ismail

  • Tom Maton 387 posts 660 karma points
    Feb 09, 2011 @ 15:58
    Tom Maton
    0

    Hi Martin,

    what does your <ExamineSearchProviders> providers look like?

    Also try changing your type for your indexer to "UmbracoExamine.LuceneExamineIndexer, UmbracoExamine" and then re-index also you downloaded like to see if there is anything in the index - http://www.getopt.org/luke/

    Tom


  • Martin 44 posts 66 karma points
    Feb 10, 2011 @ 11:39
    Martin
    0

    Hi again

    Luke finds the results.

    My search query (in luke): who is

    The analyzer (in luke): org.apache.lucene.analysis.SimpleAnalyzer

     

    My code does not give any results:

    ExamineSettings.config

            <add name="SiteSearchIndexer" type="UmbracoExamine.LuceneExamineIndexer, UmbracoExamine"
                 runAsync="true"
                 supportUnpublished="true"
                 supportProtected="true"
                 interval="10"
             indexSet="SiteSearchIndexSet"
                 analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"/>

    ExamineIndex.config

        <IndexSet SetName="SiteSearchIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/SiteSearch/">
            <IndexAttributeFields>
                <add Name="id" />
                <add Name="nodeName" />
                <add Name="updateDate" />
            </IndexAttributeFields>
            <IndexUserFields>
                <add Name="content" />
                <add Name="metadescription" />
                <add Name="metakeywords" />
                <add Name="officeText" />
                <add Name="intro" />
            </IndexUserFields>
            <IncludeNodeTypes/>
            <ExcludeNodeTypes />
        </IndexSet>

    .NET c#

    var provider = (LuceneSearcher)ExamineManager.Instance.SearchProviderCollection["SiteSearchSearcher"];
    var results = provider.Search(query, true, "");

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Feb 10, 2011 @ 11:58
    Ismail Mayat
    0

    martin,

    Can you write out the actual query that examine is generating you can do this by executing criteria.ToString() after criteria.Compile() that may give indication as to whats going wrong.

    Regards

    Ismail

  • Martin 44 posts 66 karma points
    Feb 10, 2011 @ 14:42
    Martin
    0

    Yes, what code do you want me to run?

    This:

    var provider = (LuceneSearcher)ExamineManager.Instance.SearchProviderCollection["SiteSearchSearcher"];
    var criteria = provider.CreateSearchCriteria().NodeName(query.Fuzzy());
    var results = provider.Search(criteria.Compile());

    Or this:

    var provider = (LuceneSearcher)ExamineManager.Instance.SearchProviderCollection["SiteSearchSearcher"];
    var criteria = provider.CreateSearchCriteria().NodeName(query.MultipleCharacterWildcard());
    var results = provider.Search(criteria.Compile());

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Feb 10, 2011 @ 14:46
    Ismail Mayat
    0

    write out somewhere on your page or in the trace criteria.ToString() make sure its after Compile eg

     

    var results = provider.Search(criteria.Compile());

    Trace.Write(criteria.ToString() )

    then update the post here to show the generated lucene query.

    Regards

     

    Ismail

  • Tom Maton 387 posts 660 karma points
    Feb 10, 2011 @ 15:08
    Tom Maton
    0

    Hi Martin,

    You have specified the ExamineSearchProvider to be to "SiteSearchSearcher" as this is what you are searching.

    This set in the ExamineSearchProviders as above you only have shown the Indexer in the ExamineSettings.config.

    Thanks

    Tom

  • Martin 44 posts 66 karma points
    Feb 10, 2011 @ 22:29
    Martin
    0

    Here is the result of the Response.Write:

    Examine.LuceneEngine.SearchCriteria.LuceneBooleanOperation

    Here is the code I used:

                var provider = (LuceneSearcher)ExamineManager.Instance.SearchProviderCollection["SiteSearchSearcher"];
                var criteria = provider.CreateSearchCriteria().NodeName(query.MultipleCharacterWildcard());
                var results = provider.Search(criteria.Compile());
                Response.Write(criteria.ToString());

     

    Tom, here is the config you wanted to see:

      <ExamineSearchProviders defaultProvider="InternalSearcher">
        <providers>
            <add name="InternalSearcher" type="UmbracoExamine.LuceneExamineSearcher, UmbracoExamine"
                 analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>

            <add name="SiteSearchSearcher" type="UmbracoExamine.LuceneExamineSearcher, UmbracoExamine"
                 analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"/>
           
          <add name="InternalMemberSearcher" type="UmbracoExamine.LuceneExamineSearcher, UmbracoExamine"
               analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" enableLeadingWildcards="true"/>          
        </providers>
      </ExamineSearchProviders>

  • Martin 44 posts 66 karma points
    Feb 15, 2011 @ 14:03
    Martin
    0

    Do you guys have any more suggestions?

    Thank you.

  • kows 81 posts 151 karma points c-trib
    Feb 15, 2011 @ 14:30
    kows
    0

     

    What i got is the following (notice the differences on the types):

    ExamineSettings.config: 

         <add name="SiteSearchSearcher" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"

    runAsync="true" supportUnpublished="false" supportProtected="true" interval="10"

            analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" indexSet="SiteSearchIndexSet"

           />

     <add name="SiteSearchIndexer" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"

      analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" indexSet="SiteSearchIndexSet"/>

    &

    ExamineIndex.config:

       Same as yours (with appropriate names)

    My codebehind is special cause i form the string of the query myself and then i execute

    ExamineManager.Instance.SearchProviderCollection[searchProvider].Search(criteria.RawQuery(sQuery)))).ToList();

    Maybe this can be of some help for you.

    *edit* code tags fucking up..

     

Please Sign in or register to post replies

Write your reply to:

Draft