I have episerver CMS experience, but still a rookie setting up Episerver Find in projects.
So we have a website with 2 websites in it. (with 2 different startpages, using their own domain).
My question is about setting up episerver find.
I did the basics of installing the nuget packages, i created a free demo index, and setup the web.config.
Now the indexing starts but it indexes everything in the same (demo)index. So both sites.
What is the best practice/approach to search only pages which are in 1 site. Is that in the logic of the code or can we setup the index differently accomadate searching in specific content of 1 of the sites.
I hope to hear about your thoughts.
This is the intended design for Find. You can filter content for particular site for any IContent types like so.
var content = SearchClient.Instance.Search<IContent>()
.Filter(x => x.SiteId().Match("MySiteId"))
Cool thanks Janaka... i will try that...
Also we have like a block type which contains a search box. And the idea is that it can only find items/pages that are hierarchically a descendant page of the page the blocks is on..
How can you search for that using Find's api.
To do that use the Ancestors property to filter based on the content reference of the section of the site you want to filter against. Something like
.Filter(x => x.Ancestors().Match(contentReference.ToString());