Episerver Find setup to Index multiple sites

Vote:
 

Hey Guys,

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. 

regards

#183775
Oct 23, 2017 10:28
Vote:
 

Hi Vishal,

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"))
  .GetContentResult();
#183786
Oct 23, 2017 14:30
Vote:
 

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. 

#183788
Oct 23, 2017 15:01
Vote:
 

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

SearchClient.Instance.Search<IContent>()
.Filter(x => x.Ancestors().Match(contentReference.ToString());



#183791
Oct 23, 2017 15:46
Vote:
 

thanks mate!!

#183793
Oct 23, 2017 16:03
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.