I'm attempting to use Sitecore Search with a custom index to filter and search items.
The items are product reviews and are all stored in a single folder with a ProductReview
template.
+ Reviews
- Sample Review 1
- Sample Review 2
- Sample Review 3
The users will be able to filter items by category, subcategory and search by product name. So the form will look similar to this:
Category: [ Drop Down ]
Sub Category: [ Drop Down ]
Product name: [ Single line of Text ]
[ Search Button ]
I'm finding the documentation for defining indexes very thin. I'm trying to setup the index with the following properties.
- The index web database
- It should include only those three fields as they're all I'll need
- Only items based on the review template will be indexed
- The two category fields don't need to be tokenised
- You can filter on the category fields
I'm not sure if I need a custom Analyzer or DatabaseCrawler and I haven't looked into making one at all.
This is what I have so far, however I haven't produced a working index yet:
<index id="reviews" type="Sitecore.Search.Index, Sitecore.Kernel">
<param desc="name">$(id)</param>
<param desc="folder">reviews</param>
<Analyzer ref="search/analyzer" />
<include hint="list:IncludeField">
<!-- Category -->
<fieldId>Category</fieldId>
<!-- Sub Category -->
<fieldId>Sub Category</fieldId>
<!-- Product Name -->
<fieldId>Product Name</fieldId>
</include>
<locations hint="list:AddCrawler">
<web type="Sitecore.Search.Crawlers.DatabaseCrawler, Sitecore.Kernel">
<Database>web</Database>
<!-- {GUID} -->
<Root>{GUID}</Root>
<Tags>web reviews</Tags>
<IndexAllFields>false</IndexAllFields>
<templates hint="list:AddTemplate">
< !-- Product Review -- >
<reviews>Product Review</reviews>
</templates>
</web>
</locations>
</index>
Any pointers would be greatly appreciated.
Edit
The two main things I'm looking for is:
- How to index the category field without tokenizing it.
- How to filter using that with the Lucine.net API.