Wednesday, March 25, 2009

How to completely disable Lucene index


Why? As Alexey was blogging some time ago, for the dev machines and even production content delivery environments, it may make a lot of sense to disable the out-of-the-box search engine that Sitecore ships with. This may improve performance and reduce number of folders in Sitecore installation as you will be able to simply remove the whole "indexes" folder.


Directions for Sitecore 6.0.x:
1. Remove <indexes> section for each <database> definition.
In default Sitecore configuration, the indexes are defined for “core” and “master” databases.
   1: <indexes hint="list:AddIndex">
   2:    <index path="indexes/index[@id='system']" />
   3: </indexes>
2. Remove the <indexes> section which contains the index definitions:
   1: <indexes>
   2:       <index id="system" singleInstance="true" type="Sitecore.Data.Indexing.Index, Sitecore.Kernel">
   3:         <param desc="name">$(id)</param>
   4:         <fields hint="raw:AddField">
   5:           <field target="created">__created</field>
   6:           <field target="updated">__updated</field>
   7:           <field target="author">__updated by</field>
   8:           <field target="published">__published</field>
   9:           <field target="name">@name</field>
  10:           <field storage="unstored">@name</field>
  11:           <field target="template" storage="keyword">@tid</field>
  12:           <field target="id" storage="unstored">@id</field>
  13:           <type storage="unstored">memo</type>
  14:           <type storage="unstored">text</type>
  15:           <type storage="unstored" stripTags="true">html</type>
  16:           <type storage="unstored" stripTags="true">rich text</type>
  17:         </fields>
  18:       </index>
  19:     </indexes>
3. Replace the whole "<search>" section with the following only:
   1: <search>
   2:    <configuration type="Sitecore.Search.SearchConfiguration, Sitecore.Kernel" singleInstance="true" />
   3: </search>
4. Now you can physically remove the /indexes/ folder under the root of your Sitecore installation.
Note: The only problem I've noticed with this on the CMS side is the "Set Initial Workflow" dialog comes up blank after the change. Apparently it is retrieving information from the search index.
Directions for Sitecore 5.3.x:
1. Remove <indexes> section for each <database> definition.
In default Sitecore configuration, the indexes are defined for “core”, “master”, “archive” and “recyclebin” databases.
   1: <indexes hint="list:AddIndex">
   2:    <index path="indexes/index[@id='system']" />
   3: </indexes>
2. Remove the <indexes> section which contains the index definitions:
   1: <indexes>
   2:       <index id="system" singleInstance="true" type="Sitecore.Data.Indexing.Index, Sitecore.Kernel">
   3:         <param desc="name">$(id)</param>
   4:         <fields hint="raw:AddField">
   5:           <field target="created">__created</field>
   6:           <field target="updated">__updated</field>
   7:           <field target="author">__updated by</field>
   8:           <field target="published">__published</field>
   9:           <field target="name">@name</field>
  10:           <field storage="unstored">@name</field>
  11:           <field target="template">@tid</field>
  12:           <field target="id" storage="unstored">@id</field>
  13:           <type storage="unstored">memo</type>
  14:           <type storage="unstored">text</type>
  15:           <type storage="unstored" stripTags="true">html</type>
  16:           <type storage="unstored" stripTags="true">rich text</type>
  17:         </fields>
  18:       </index>
  19:       <!-- Index used by Archive database -->
  20:       <index id="archive" singleInstance="true" type="Sitecore.Data.Indexing.Index, Sitecore.Kernel">
  21:         <param desc="name">$(id)</param>
  22:         <templates hint="list:AddTemplate">
  23:           <!-- Archived item template -->
  24:           <template>{BF2B8DA2-3CBA-485D-8F85-3788B8AFBDBF}</template>
  25:         </templates>
  26:         <fields hint="raw:AddField">
  27:           <field target="name">@name</field>
  28:           <field target="completed">{A42AD672-680A-47C0-899D-04238C8F15BC}</field>
  29:           <field target="itemID">{2F093D15-FD21-47A0-ACC0-E153B9BA508C}</field>
  30:           <field target="dbName">{1897F98D-6DCD-4083-B1D3-BC9C4B11DD27}</field>
  31:         </fields>
  32:       </index>
  33:       <!-- Index used by RecycleBin database -->
  34:       <index id="recyclebin" singleInstance="true" type="Sitecore.Data.Indexing.Index, Sitecore.Kernel">
  35:         <param desc="name">$(id)</param>
  36:         <templates hint="list:AddTemplate">
  37:           <!-- Archived item template -->
  38:           <template>{BF2B8DA2-3CBA-485D-8F85-3788B8AFBDBF}</template>
  39:         </templates>
  40:         <fields hint="raw:AddField">
  41:           <field target="name">@name</field>
  42:           <field target="completed">{A42AD672-680A-47C0-899D-04238C8F15BC}</field>
  43:           <field target="itemID">{2F093D15-FD21-47A0-ACC0-E153B9BA508C}</field>
  44:           <field target="dbName">{1897F98D-6DCD-4083-B1D3-BC9C4B11DD27}</field>
  45:         </fields>
  46:       </index>
  47: </indexes>
3. Now you can physically remove the /indexes/ folder under the root of your Sitecore installation.

1 comments:

Mark Cassidy said...

In case you're needing to disable these indexes programatically, a follow up post was created here. http://intothecore.cassidy.dk/2010/09/disabling-lucene-indexes.html