I'm using Examine to search in website content, But whenever an article is updated, it is shown more than once in the result, with same count as the number of modifications !!
<IndexSet SetName ="ArabicIndexerIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Arabic/">
<IndexUserFields>
<add Name="id" EnableSorting="true" Type="Number" />
<add Name="content" EnableSorting="true" />
<add Name="author" EnableSorting="true" />
<add Name="title" EnableSorting="true" />
<add Name="description" EnableSorting="true" />
<add Name ="umbracoNaviHide"/>
</IndexUserFields>
</IndexSet>
<ExamineSearchProviders defaultProvider="ArabicSearcher">
<providers>
<add name="ArabicSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
indexSet="ArabicIndexerIndexSet"
supportUnpublished="false"
supportProtected="false"
analyzer="Lucene.Net.Analysis.AR.ArabicAnalyzer, Lucene.Net.Contrib.Analyzers"/>
</providers>
</ExamineSearchProviders>
and this is my query:
+((title:Test Phrase content:Test Phrase)) +(umbracoNaviHide:0)
How to solve this?
EDIT: Rebuilding the index solves the problem temporarily, and once you modify the article again, the problem appears again.
EDIT2:
I used Luke to investigate the problem, the only difference is the update date between the duplicated results.
See the image:
EDIT3: I found a solution that worked, but I'm not convinced with it here: Index is not updated automatically
which suggests to use the follwing code:
public class UmbracoEvents: ApplicationBase
{
/// <summary>Constructor</summary>
public UmbracoEvents()
{
umbraco.content.AfterUpdateDocumentCache += new umbraco.content.DocumentCacheEventHandler(content_AfterUpdateDocumentCache);
}
privatevoid content_AfterUpdateDocumentCache(Document sender, umbraco.cms.businesslogic.DocumentCacheEventArgs e)
{
// Rebuild SiteSearchIndexer (Search results will be updated after a few minutes)
ExamineManager.Instance.IndexProviderCollection["SiteSearchIndexer"].RebuildIndex();
}
}
The problem with this solution is that it takes a long time to rebuild the index with large amount of content! (10000 documents in my case) and during the index rebuild process, the user will get 0 result searching anything, which confuses the user.
It looks like your search query is incorrectly structured. If you are searching for the phrase "Test Phrase" in the title and content property, your query should be: