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'.
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/
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.
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());
var provider = (LuceneSearcher)ExamineManager.Instance.SearchProviderCollection["SiteSearchSearcher"]; var criteria = provider.CreateSearchCriteria().NodeName(query.MultipleCharacterWildcard()); var results = provider.Search(criteria.Compile()); Response.Write(criteria.ToString());
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?
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
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"/>
Martin,
You need to do a wildcard search please see http://our.umbraco.org/forum/developers/extending-umbraco/14451-Examine-Search-NOT-EXACT-Word
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".
what happens when you do wildcard query using luke on that specific index?
Regards
Ismail
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
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, "");
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
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());
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
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
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>
Do you guys have any more suggestions?
Thank you.
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..
is working on a reply...