user2400682
user2400682

Reputation: 13

Lucene search in sitecore with 2 websites

I integrated lucene search in my sitecore website which has one more website under content item in the content tree. I added a new searchindex.config file in app_congif/include folder. I've also changed the lucenesearch source to get siteroot as

SiteRoot = database.GetItem("/sitecore/content");

But the search isn't working. It shows:

unable to find results item

which means it isn't getting anything in the /Standard_Items/Search_Results. This is my searchindex.config:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
 <sitecore>
   <database>
    <database id="master">
     <Engines.HistoryEngine.Storage>
      <obj type="Sitecore.Data.$(database).$(database)HistoryStorage,Sitecore.Kernel">
        <param connectionStringName="$(id)"/>
        <EntryLifeTime>30.00:00:00</EntryLifeTime>
      </obj>
    </Engines.HistoryEngine.Storage>     <Engines.HistoryEngine.SaveDotNetCallStack>false</Engines.HistoryEngine.SaveDotNetCallStack>
  </database>
</database>
<search>
  <configuration>
    <indexes>
      <index id="SearchIndex" type="Sitecore.Search.Index, Sitecore.Kernel">
        <param desc="name">$(id)</param>
        <param desc="folder">search_index</param>
        <Analyzer ref="search/analyzer"/>
        <locations hint="list:AddCrawler">
          <resources type="Sitecore.Search.Crawlers.DatabaseCrawler, Sitecore.Kernel">
            <Database>master</Database>

            <Root>/sitecore/content</Root>
            <include hint="list:IncludeTemplate">
               <template>{2A609D52-7B9F-49F3-83BE-047FD16397A7} </template>
              <template>{F98712D8-27DB-4324-82E6-65242F0977F9} </template>
              <template>{849CA304-3F51-4FCB-B9B3-2AC7E950B476} </template>
            <template>{A87A00B1-E6DB-45AB-8B54-636FEC3B5523} </template>
            <template>{52BDB3C4-0585-437C-89AD-6AAC81950633} </template>

            </include>
            <IndexAllFields>true</IndexAllFields>
            <Boost>2.0</Boost>
          </resources>
        </locations>
      </index>
    </indexes>
  </configuration>
  </search>
 </sitecore>
</configuration>

here is my content tree. I want to search in sitecore/content/DruBlue.

enter image description here

Can anyone please help me ?

Upvotes: 1

Views: 655

Answers (1)

Marek Musielak
Marek Musielak

Reputation: 27142

You have an error in your configuration:

<include hint="list:IncludeTemplate">
    <template>{2A609D52-7B9F-49F3-83BE-047FD16397A7} </template>
    <template>{F98712D8-27DB-4324-82E6-65242F0977F9} </template>
    <template>{849CA304-3F51-4FCB-B9B3-2AC7E950B476} </template>
    <template>{A87A00B1-E6DB-45AB-8B54-636FEC3B5523} </template>
    <template>{52BDB3C4-0585-437C-89AD-6AAC81950633} </template>
</include>

This part will only include the {52BDB3C4-0585-437C-89AD-6AAC81950633} template as all they have the same tag name. You need to use different tags for each of them (doesn't matter if you use template1, template2 ... or news, article, event, e.g.:

<include hint="list:IncludeTemplate">
    <template1>{2A609D52-7B9F-49F3-83BE-047FD16397A7}</template1>
    <template2>{F98712D8-27DB-4324-82E6-65242F0977F9}</template2>
    <article>{849CA304-3F51-4FCB-B9B3-2AC7E950B476}</article>
    <news>{A87A00B1-E6DB-45AB-8B54-636FEC3B5523}</news>
    <event>{52BDB3C4-0585-437C-89AD-6AAC81950633}</event>
</include>

See Sitecore search and indexing pdf for more details.

Then you should rebuild the index (you can do this from Sitecore Desktop > Control Panel > Database > Rebuild the Search index. When reindexing is done try to confirm that there are any items in the index. You can use Sitecore index viewer module or standalone Luke - Lucene Index Toolbox.

Here you can find more information about solving Sitecore and Lucene problems.

Upvotes: 6

Related Questions