Thursday, June 27, 2013

How to install EPiServer Search for EPiServer CMS 7

Linda Mohacsi wrote a very good blog post about EPiServer Search functionality a week ago ( Ref. http://world.episerver.com/Blogs/Linda-Mohacsi/Dates/2013/6/The-built-in-EPiServer-search-functionality-described-in-a-non-technical-way ) and Paul Smith have also written a blog post about FTS for EPiServer CMS 6 a few years back. I have lately been working on upgrading a large enterprise solution to EPiServer CMS 7, where I also had to upgrade the search to use EPiServer Search (lucene).

After running into a few problems, I thought it would be a good idea to blogg about this, since the information about EPiServer Search is very limited and fragmented on the web.

Installing EPIServer Seach



After you have installed EPiServer Search from Deployment Center, some elements have been added to your web.config, .dll files into bin folder and a new folder called IndexingService containing a file called IndexingService.svc. The .svc file should be include to your project before you recompiling.

Web.config

Elements that will be added during the install to your web.config :

<configuration>
  <configSections>
    <section name="episerver.search" type="EPiServer.Search.Configuration.SearchSection, EPiServer.ApplicationModules" />
    <section name="episerver.packaging" type="EPiServer.Packaging.Configuration.EPiServerPackagingSection, EPiServer.Packaging" />
    <section name="episerver.search.indexingservice" type="EPiServer.Search.IndexingService.Configuration.IndexingServiceSection, EPiServer.Search.IndexingService" />

If you need to setup with more then one binding per site, ex. mycompany.com and mycompany.no, you’ll need to add <serviceHostingEnviroment multipleSiteBindingEnable= ”true”>, as shown below.  This is not included in the default installation, so you would need to add this one yourself.

  <system.serviceModel>
   <bindings>    
     <webHttpBinding>
        <binding name="IndexingServiceCustomBinding" maxBufferPoolSize="1073741824" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
          <readerQuotas maxStringContentLength="10000000" />
        </binding>
      </webHttpBinding>
    </bindings>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 

Default from installation, the baseUri would be setup with localhost. You would have to replace this with a correct dns name.

  <episerver.search active="true">
    <namedIndexingServices defaultService="serviceName">
      <services>
        <!--<add name="{serviceName}" baseUri="{indexingServiceBaseUri}" accessKey="{accessKey}"/>-->
        <add name="serviceName" baseUri="http://www.xxxx.com/IndexingService/IndexingService.svc" accessKey="local" />
      </services>
    </namedIndexingServices>
    <searchResultFilter defaultInclude="true">
      <providers />
    </searchResultFilter>
  </episerver.search>
 

The [appDataPath] is defined in EpiServerFrameWork.config. I would recomind to have the index as a subfolder in vpp. During installation of search you would have choose a place to put it.

  <episerver.packaging protectedVirtualPath="~/CMS/" />
  <episerver.search.indexingservice>
    <clients>
      <!--add name="example" description="example" ipAddress="127.0.0.1/8,192.168.0.0/24" ip6Address="" allowLocal="true|false" readonly="true|false" /-->
      <add name="local" description="local" allowLocal="true" readonly="false" />
      <!--add name="example" description="example" ipAddress="127.0.0.1/8,192.168.0.0/24" ip6Address="" allowLocal="true|false" readonly="true|false" /-->
    </clients>
    <namedIndexes defaultIndex="default">
      <indexes>
        <add name="default" directoryPath="[appDataPath]\Index" readonly="false" />
      </indexes>
    </namedIndexes>
  </episerver.search.indexingservice>
  <location path="IndexingService/IndexingService.svc">
    <system.web>
      <httpRuntime maxQueryStringLength="65536" />
    </system.web>
    <system.webServer>
      <security>
        <requestFiltering>
          <requestLimits maxQueryString="65536" />
        </requestFiltering>
      </security>
    </system.webServer>
  </location>
 

Testing of the service

After you have installed the search and verified the web.config you can test if the service is running by type this url into a browser : http://www.xxxx.com/IndexingService/IndexingService.svc. Don’t worry about that the endpoint isn’t found, if it work it should look like this. If you don’t get this up read last chapter about other problems you could run into or your web.config isn’t correct modifed.












Indexing the site(s)

To my big surprise EPiServer got a hidden feature! You can index the site, by typing this url into a browser: http://www.xxxx.no/EPiServer/CMS/Admin/IndexContent.aspx.











(Tips from Fredrik Haglund )

If you open a file browser and navigate [appDataPath]\Index\main you will see that the files is started to be generated. So now you know its running. Depending of the size of the site, it could take some time to index it. For me it took about 20 min to index 6000 pages.





















Other problems you could run into

If you got problems with that IIS isn’t recognize the svc file. You should check if WCF for .net framework 3.5 is installed.

If you have upgraded an old EPiServer site which runs under .net framework 2.0, would be to check that you have added “svc-Integrated-4.0" under and removed the old one.


<add name="svc-Integrated-4.0" path="*.svc" verb="*" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv4.0" />


A special feature you must check, if you are going to run on window 2012 server is to check if «HTTP Activation» under the feature .net framework 3.5 is enabled. Last tips are that you could also download the tool LUKE (http://luke.codeplex.com/) to be able to analyze and maintain the lucene index.

6 comments:

  1. Thank you! These steps helped a lot. I did miss the HTTP Activation feature in Windows 8 and the *.svc handler was missing as well after upgrading a episerver 5 site to episerver 7.

    ReplyDelete
  2. Thanks a lot. Easy to follow instructions

    ReplyDelete
  3. Enabling HTTP Activation for .NET 3.5.1 seems to be required for Windows 7 also. Once I enabled this everything worked as expected

    ReplyDelete
  4. Thank you really much! All my settings were right ones. Re-indexing my site solved problems.

    One extra tip, if http://www.xxxx.com/IndexingService/IndexingService.svc does not give proper answer:
    Go to IIS settings. Open your site. Double click IndexingService folder and double click Authentication icon. Choose Anonymous Authentication as enabled. You might have to re-index your site as Svein described earlier.

    ReplyDelete
  5. Thanks Svein for your post, it has been helpful!

    ReplyDelete
  6. For windows 10: Turn Windows features on/off -> .NET Framework 4.7 adv. -> WCF Services -> HTTP Activation - needs to be enabled as well.

    ReplyDelete

Note: Only a member of this blog may post a comment.