Bevan
Bevan

Reputation: 281

Sitecore Multisite Lucene Search Relevance

I currently have a multisite setup of Sitecore 6.4. I had installed the LuceneSearch module on the sites but have been requested to display results for the search across all sites. I have altered the 'Root' in the index definition on the web.config to point to the root containing all sites and this successfully returns results across all sites.

However, these results need to be weighted to display the current context site's results above the others.

Is there any easy way to achieve this?

I have been toying with the idea of creating a separate index for each site and then looping through all the sites returning the results from the current site's index first but I suspect there must be a better idea.

Upvotes: 1

Views: 878

Answers (2)

user963463
user963463

Reputation:

you can index the path of each item and add it as lucene field, then make a prefix query with the start path of each site.

NOTE: when you index the path, replace ("/" or space ) with something else, like '#', and do the same when you build the query.

for advance use of lucene search, look to : http://sitecoreblog.alexshyba.com/2010/11/sitecore-searcher-and-advanced-database.html

Upvotes: 0

Christian Hagelid
Christian Hagelid

Reputation: 8355

As far as I know the boost values are set when you create or re-build an index so you won't be able to set a boost value based on a context site.

Just a thought but using the AdvancedDatabaseCrawler SharedSource module you could add a new dynamic field called 'site' and store the site id or site name for each item you are indexing. You could then search the index twice. Once to get all the results for the current context site and then a second search where you get all the results where the site field does not equal the context site.

Upvotes: 0

Related Questions