SitecoreSearchContrib - How to merge & sort from multiple indexes

情到浓时终转凉″ 提交于 2019-12-24 21:33:14

问题


I'm currently setting up a search for a Sitecore 6.6 web site using SitecoreSearchContrib.

I've got two indexes. One index looking at my web site content:

/sitecore/content/home 

and another index looking in a documents folder in the media library (which contains PDF etc).

/sitecore/media library/documents

The search on my web site can return web pages or Word/PDF documents.

Is there a way (beside using one super-index for content & media library) that I can combine the results from both indexes and still order them by their relevance / hit count?


回答1:


Ended up solving this by getting rid of the second index and instead, simply included an additional <locations>...</locations> block in the scSearchContrib.Crawler.config to point to the folder in the media library where my documents live.

E.g.

Inside of App_Config/Include/scSearchContrib.Crawler.config

......
<index id="web" type="Sitecore.Search.Index, Sitecore.Kernel">
    <param desc="name">$(id)</param>
    <param desc="folder">web</param>
    <Analyzer ref="search/analyzer" />
    <locations hint="list:AddCrawler">
        <my-site-content type="scSearchContrib.Crawler.Crawlers.AdvancedDatabaseCrawler,scSearchContrib.Crawler">
        <Database>web</Database>
        <Root>/sitecore/content/MySite/Home</Root>
        <tags>Web Content</tags>
        <IndexAllFields>true</IndexAllFields>

        <!-- Include/Exclude templates, crawlers etc here -->

    </locations>
    <locations hint="list:AddCrawler">
        <my-site-media-library type="scSearchContrib.Crawler.Crawlers.AdvancedDatabaseCrawler,scSearchContrib.Crawler">
        <Database>web</Database>
        <Root>/sitecore/media library/SomeFolder/Documents</Root>
        <tags>Documents</tags>
        <IndexAllFields>true</IndexAllFields>   

        <!-- Include/Exclude templates, crawlers etc here -->

    </locations>
</index>
......


来源:https://stackoverflow.com/questions/17626997/sitecoresearchcontrib-how-to-merge-sort-from-multiple-indexes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!