Umbraco Multisearcher Examine exampleUsing Multisearcher Examine provider to searching across multiple indexes
Posted on Wednesday, April 12, 2017
I have blogged about using Examine to search your content in umbraco before , Search Umbraco using Examine and Razor; and there is good articles on setting up Examine available on the web - Rasmus Fjord 24days article is a good start, along with blog on Umbraco.com : Examining Examine and the documentation on Our Umbraco is good reference.
A common question appearing on twitter and the umbraco forums is how to search two or more indexes.
It is fairly straight forward - using the provider in the Examine namespace (source code on Github )
I have created a project available over at bit bucket which demonstrates (in a simple example) searching both content items in the umbraco project and pdf media items (including text within the pdf using UmbracoExamine.PDF)
<add name="MultiSearcher" type="Examine.LuceneEngine.Providers.MultiIndexSearcher, Examine" analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" enableLeadingWildcard="true" indexSets="ExternalIndexSet,PDFIndexSet" />
Code of search razor code shown below.
Please note, a gotcha is that in Umbraco backoffice, within Examine Management, using the multisearcher 'Search Tools' no results will be displayed.