AI OnAI Off
Hi,
Are you using EPiServer Find or standard EPiServer search based on Lucene.NET?
Hi Dejan,
I'm using standard EPiServer search based on Lucene.NET.
Regards
Hi,
Ted Nyberg wrote a blog post on how to add custom fields to the search index: http://tedgustaf.com/blog/2013/4/add-custom-fields-to-the-episerver-search-index-with-episerver-7/
You should index custom fields for region, state, etc.
And then you can get ShopBlocks like this:
var searchHandler = ServiceLocator.Current.GetInstance<SearchHandler>(); var query = new GroupQuery(LuceneOperator.AND); query.QueryExpressions.Add(new ContentQuery<ShopBlock>()); // todo: filter by region, state, etc. // return first 10 hits var result = searchHandler.GetSearchResults(query, 1, 10);
I'm working in a search functionality, with the following elements:
1) I've a ShopPage, with a ShopContentArea that can contain only ShopBlocks (with name, address, region, state, etc)
2) I've a ShopResultsPage, where I need to get the ShopBlocks from ShopPages, filtering them with the value of some properties (search parameters: region/state), and display this ShopBlocks in a ShopContentArea in the ShopResultsPage.
I don't know how to develop such functionality in EpiServer 8 MVC. Basically the problem is that I'm not sure about:
- How get blocks from a content area of various ShopPages.
- How filter theses blocks.
- How to add the filtered blocks to a content area in the ShopResultspage.
Any of you have suggestions on how to make it working???
Best Regards