Content is indexed with it's ancestors in the data so I've usually just added a query to check that a content guid is in that collection. I've used this for example to said searching a news section or even the right site in a multisite instance
Hi Scott
thanks for that info, I think that could work in some instances, however its not always just pages below a parent in the tree. its often much more complex.
like:
mysite.com/area1 <- do a search
return items from
mysite.com/area1
mysite.com/area2
mysite.com/area3
mysite.com/area5/subdirectory
and also
mysite.com/area2 <- do a search
return items from
mysite.com/area1
mysite.com/area2
mysite.com/area3
mysite.com/area5/subdirectory
there are loads of these rules
and would ideally need to return document for these pages too, but not sure if those are indexed basedon where they are used or what really?
It can be as complex as you want.
You just need to pass in each of your sections you want to search to your search & navigation query with an OR for each and as long as the content is in either it's fine. If you want to make this flexible I'd just add these rule on to your page content types such as an IList of PageReferences.
If by document you mean an asset. The assets are indexed but are stored under an asset area independant of the pages/blocks or content they are related to. If you wanted to bring assets through that were related to content I'd personally create an extension method on the content and index the related content properties you want to pull through so you can retrieve them in the s&n query.
Hi Scott
Thanks for that, I have managed to get the pages working fine, being limited by the 'collections' I have set up. I basically added some curatable config on the root page allowing a collection name/key and a number of parent pages for each collection, and then added a filter ORing on each of those content refereneces usign the Ancestors property in the search.
However..
For the documents/assets... Editors often simply drop these into TinyMCE areas, so we dont have any specific document property on pages, and of course they can also drop these into blocks which are used on 1 or more pages too, and blocks within blocks etc. the Block text content is working as I am searching the SearchText() property of content primarily.
If I ignore the location of the document I am able to return PDF results using IncludeType, highlighting the text in the results etc. although this doesn't work when I am using the collections, as like you say, the Ancestors property for assets is not in the standard site page tree.
So I am not really sure what the extension method would look like, and imagine this could potentially mean republishing a load of content?
are there any other pointers you can give?
the only other thing I can think of would be to catch the publish event on pages/blocks and try and work out if the is a document there, and update a new property on the document itself, which would specify where it had been used, but this seems a bit sledgehammer to crack a nut, and again would require a whole lot of re-publishing.
Is there any way to limit the results of searches to particular parts of the site?
We had been using funnelback which has the concept of search collections, generally determined by limiting to certain parts of the site via url(s)
Allowing you to just search (return results from) within a collection, if you included the searchcollection key.