What I'll try
I've got a lot of persons inside the content tree and I'll create a new index for that. This is for improve the performance of the web application when searching for a specific person.
Create the index
I've made a new index in the examine manager from Umbraco 7.7 named PersonIndexer
to index all the persons. This includes only the node types of a person.
For this I've made this code:
ExamineSettings.config
Inside the file ExamineSettings.config
inside the Examine
→ ExamineIndexProviders
→ providers
tag:
<add name="PersonsIndexer"
type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
supportUnpublished="false"
supportProtected="true"
indexSet="Persons"
analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>
And inside the same file I've also added this but inside the Examine
→ ExamineSearchProviders
→ providers
tag:
<add name="PersonsSearcher"
type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
supportUnpublished="false"
supportProtected="true"
indexSet="Persons"
analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>
ExamineIndex.config
Inside the file ExamineIndex.config
inside the ExamineLuceneIndexSets
tag:
<IndexSet SetName="Persons" IndexPath="~/App_Data/TEMP/ExamineIndexes/Persons/" >
<IndexAttributeFields>
<add Name="knowledge" />
<add Name="photo" />
<add Name="name"/>
<add Name="firstName"/>
<add Name="lastName"/>
</IndexAttributeFields>
<IncludeNodeTypes>
<add Name="person" />
</IncludeNodeTypes>
</IndexSet>
Get the documents
When I build this index, it got 7 documents inside the index.
How can I get all this documents inside my view. I've tried this code:
var indexer = ExamineManager.Instance.IndexProviderCollection["PersonsIndexer"];
This gives me all properties of that index.
The question
This isn't what I need. So my question is: How could I get the typed documents from that index?
Edit
After @Marks answer I've tried his code but when I watch searchResults
I've got this:
When I do a Lucene search of *
, I've got 7 results.
When I do a text search xor I text xor lucene search on an empty string, I've got nothing.