Saturday, November 10, 2012

Setting up SOLR Search Index for your Store

Make sure SOLR feature is enabled by navigating to following URL http://localhost/solr/Default/select?q=*%3A*, If you don't see any output you need to ensure that the store-enhancements feature is enabled.

This feature can be enabled by running following command
c:\ibm\WCDE_ENT70\bin>enableFeature.bat -DfeatureName=store-enhancements

Step 1: Setup Search index for your sites mastercatalog


c:\ibm\WCDE_ENT70\components\foundation\subcomponents\search\bin>setupSearchIndex.bat -masterCatalogId 10001

With this command I'm setting up index for mastercatalog Id 10001 which is mapped to my store.

You can use following query to retrieve your stores master catalog id.


select * from storecat where storeent_id in
(
select relatedstore_id from storerel where store_id in (select storeent_id from storeent where IDENTIFIER='AuroraESite')
and streltyp_id=-4 and relatedstore_id not in (select storeent_id from storeent where IDENTIFIER='AuroraESite')
)
and mastercatalog='1'

Validate the log file at following location
C:\ibm\WCDE_ENT70\components\foundation\subcomponents\search\log\wc-search-index-setup.log

NOTE: If you are configured with Apache Derby make sure toolkit test server is not running 

Step 2: Pre-Process index


based on the database you may have to change this comlmand, since my toolkit is configured to Oracle I'm pointing to Oracle pre-process config, since I'm using toolkit I'm generating index only for english language

c:\ibm\WCDE_ENT70\bin>di-preprocess.bat C:\ibm\WCDE_ENT70\search\pre-processConfig\MC_10001\Oracle -localename en_US

Review following log C:\ibm\WCDE_ENT70\logs\wc-dataimport-preprocess.log for further validation

NOTE: If you are configured with Apache Derby make sure toolkit test server is not running 

Step 3: Build Index

Before running this command ensure toolkit and WC server is running.

c:\ibm\WCDE_ENT70\bin>di-buildindex.bat -masterCatalogId 10001 -localename en_US

At this step If you see following messages in the WC server output logs make sure you have all permissions on C:\ibm\WCDE_ENT70\search\solr folder.

000003cf SolrWriter    E org.apache.solr.handler.dataimport.SolrWriter commit Exception while solr commit.
                                 org.apache.lucene.store.NoSuchDirectoryException: directory 'C:\ibm\WCDE_ENT70\search\solr\home\MC_10001\en_US\CatalogEntry\unstructured\data\index' does not exist

Once the index is built successfully you should be able to validate SOLR output for your index by navigating to following URL


6 comments:

  1. Hi Bro..

    I am ​Getting following error in WCS 7,Fix pack 6 and FEP5 while running di-preprocess.sh


    WSVR0615W: The user.install.root system property is not set. Some product classes might not be found.
    java.lang.ClassNotFoundException: com.ibm.commerce.foundation.dataimport.preprocess.DataImportPreProcessorMain
    at java.net.URLClassLoader.findClass(URLClassLoader.java:419)
    at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:191)
    at java.lang.ClassLoader.loadClass(ClassLoader. java:643)
    at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:111)
    at java.lang.ClassLoader.loadClass(ClassLoader. java:609)
    at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:244)

    Thanks..

    ReplyDelete
    Replies
    1. is it fixed? Can you tell me the fix. I am getting same error.

      Delete
  2. Thanks for sharing this Information, Got to learn new things from your Blog on SAP SF.SAP SF

    ReplyDelete
  3. thanks for sharing so great information on this E Commerce Blog. i usually use your blog to get an idea if i ever stuck in some point of development.

    ReplyDelete
  4. Can you please share the basic working and terminology of Solr Server in wcs?

    ReplyDelete