Enabling SOLR search engine for Madisons Store

Posted by Unknown on



+ WCS V7


I have been working on this article for some time and had to face multiple issues, here are some steps if you want to get going and explore WCS Search (Apache SOLR) which was introduced in FEP1, I have tested this with Feature Pack 4 installation.

You may follow these steps to enable SOLR for Madisons sample store which has been published as a standalone B2C store, you can do the same with Madisons extended sites store as well.

Step 1


Enable Search feature by following instruction from this link
I happened to enable features while upgrading my toolkit to Feature pack 3 and hence did not follow these steps.


You can Enable Store enhacements by using following command
c:\IBM\WCDE_ENT70\bin>enableFeature.bat -DfeatureName=store-enhancements
Ensure you are able to view following output from the URL, this is an indication of successful enablement of SOLR search engine, SOLR engine will initialize the very first time you hit this url, this can be noticed in application server log.





Step 2

Publish the started store included in feature pack to test advanced functionality, for instance Madisons ConsumerDirect Store can be used for testing new features.

2. 1 Publish Madisons Store Archive

Depending on your feature pack version you need to publish the Madisons store in following sequence


For Feature Pack 1 name for the store is Madisons.sar
For Feature Pack 2 and above the store is Madisons-FEP.sar

Publish as shows in the screenshot below


























2. 2 Publish MadisonsEnhancements Store Archive

In this sample I have published Madisons-FEP.sar as a normal store (not an extended sites store), hence while publishing MadisonsEnhancements SAR file I have selected 
Marketing Store Identifier, catalog and customer facing store identifier as "Madisons-FEP" as shown in the screen shot below.






















Login to CMC to validate search functionality is visible for the new Store.
























Now validate search functionality for the new store.





















Optional Steps

I have noticed that the store publish process in previous step will accomplish Step 3, 4 and 5, hence skip these steps is SOLR index was setup in previous step. 

You should notice something similar in store publish logs in Step 2

[5/13/12 20:13:21:447 CDT] 000001dd task          I com.ibm.commerce.search.indexsetup.execution.task.ConfigWCforSolrCatalogEntrySayHelloTask performExecute

**************************************************************
Started configuring WebSphere Commerce for Solr cores
**************************************************************
Master Catalog Id: 10351
Index Type: CatalogEntry
Languages: [en_US]

Step 3


3. 1 Retrieve Master catalog ID

-- For normal store (not an extended sites store)
select * from catalog where IDENTIFIER='MadisonsFEP';

-- For extended sites store
select * from storeent where IDENTIFIER='MadisonsFEP';
--Use the storeent_id as the store_id in the following SQL to find the Catalog Asset store ID of this Extended Site store
select * from storerel where store_id=11001 and streltyp_id=-4 and relatedstore_id not in (11001);
-Get the master catalog ID
select * from storecat where storeent_id=YYYYYY and mastercatalog='1'




3. 2 Stop the test server if it is running



Step 4

Setting up the WebSphere Commerce search index structure for a specific master catalog locally

C:\IBM\WCDE_ENT70\components\foundation\subcomponents\search\bin\setupSearchIndex.bat -masterCatalogId 10001


C:\IBM\WCDE_ENT70\components\foundation\subcomponents\search\log\wc-search-index-setup.log
Should create pre-process XML in C:\IBM\WCDE_ENT70\search\pre-processConfig\MC_10001\Cloudscape


Step 5

Preprocessing the WebSphere Commerce search index data

c:\IBM\WCDE_ENT70\bin>di-preprocess.bat C:\IBM\WCDE_ENT70\search\pre-processConfig\MC_10001\Cloudscape

review C:\IBM\WCDE_ENT70\logs\wc-dataimport-preprocess.log
you should see following message towards the end of log file


Program exiting with exit code: 0.
Data import pre-processing completed successfully with no errors.


Step 6

Build Search Index

Restart the WebSphere Commerce search server after preprocessing is complete
and hit following URL from browser


Ensure you can visit SOLR over http by checking following URL in your browser

Start the test server, this time around you would notice lot of logging related to SOLR search engine in your start up log

[12/16/11 11:41:27:935 CST] 00000011 SolrResourceL I org.apache.solr.core.SolrResourceLoader locateSolrHome No /solr/home in JNDI
[12/16/11 11:41:27:937 CST] 00000011 SolrResourceL I org.apache.solr.core.SolrResourceLoader locateSolrHome using system property solr.solr.home: C:/IBM/WCDE_E~1/search/solr/home
[12/16/11 11:41:27:938 CST] 00000011 SolrResourceL I org.apache.solr.core.SolrResourceLoader <init> Solr home set to 'C:\IBM\WCDE_E~1/search/solr/home\'
[12/16/11 11:41:28:045 CST] 00000011 CoreContainer I org.apache.solr.core.CoreContainer load loading shared library: C:\IBM\WCDE_E~1\search\solr\home\lib
[12/16/11 11:41:28:078 CST] 00000011 SolrResourceL I org.apache.solr.core.SolrResourceLoader <init> Solr home set to 'C:\IBM\WCDE_E~1\search\solr\home\default\'
[12/16/11 11:41:28:119 CST] 00000011 SolrConfig    I org.apache.solr.core.SolrConfig initLibs Adding specified lib dirs to ClassLoader
[12/16/11 11:41:28:622 CST] 00000011 Config        I org.apache.solr.core.SolrConfig <init> Loaded SolrConfig: solrconfig.xml
[12/16/11 11:41:28:631 CST] 00000011 IndexSchema   I org.apache.solr.schema.IndexSchema readSchema Reading Solr Schema
[12/16/11 11:41:28:651 CST] 00000011 IndexSchema   I org.apache.solr.schema.IndexSchema readSchema Schema name=example

[12/16/11 11:41:32:055 CST] 00000011 SolrResourceL I org.apache.solr.core.SolrResourceLoader <init> Solr home set to 'C:\IBM\WCDE_E~1\search\solr\home\MC_10051\en_US\CatalogEntry\'
[12/16/11 11:41:32:199 CST] 00000011 SolrConfig    I org.apache.solr.core.SolrConfig initLibs Adding specified lib dirs to ClassLoader

di-buildindex.bat -masterCatalogId masterCatalogId

c:\IBM\WCDE_ENT70\bin>di-buildindex.bat -masterCatalogId 10001

You should notice something similar at the end of this command execution..

May 11, 2012 8:33:43 PM com.ibm.commerce.foundation.dataimport.process.DataImpor
tProcessorMain logExitCode
INFO:

-----------------------------------------------

May 11, 2012 8:33:43 PM com.ibm.commerce.foundation.dataimport.process.DataImpor
tProcessorMain logExitCode(int)
INFO:
Program exiting with exit code: 0.
Data import process completed successfully with no errors.

May 11, 2012 8:33:43 PM com.ibm.commerce.foundation.dataimport.process.DataImpor
tProcessorMain logExitCode
INFO:
-----------------------------------------------


May 11, 2012 8:33:43 PM com.ibm.commerce.foundation.dataimport.process.DataImpor
tProcessorMain logEndDateAndTime
INFO: Data import process ended:Fri May 11 20:33:43 CDT 2012
May 11, 2012 8:33:43 PM com.ibm.commerce.foundation.dataimport.process.DataImpor
tProcessorMain logEndDateAndTime
INFO: Data import process completed in 81.565 seconds.


Reference Links
Setting up WebSphere Commerce search

WebSphere commerce search in starter stores




17 comments:

  1. Hi Hari,

    How do I disable solr

    ReplyDelete
  2. Hi,

    One thing worth changing before you do things woth SOLR is increasing the JVM size in your development environment. WIth the latest FEP 5 fixpack I created a brand new environment and then found when I published the Aurora starter store that I was getting out of memory errors in the appserver from the SOLR process. I had to go in and hand edit the server.xml as every time it then tried to start the SOLR environment and was running out of memory.

    The default for the maxheapsize was only 512mb on the server created so not surprising it had OOM. I changed this to 1500 and the server then started OK, not sure why the default is being set so low because Commerce might just run but a published store with all its data and SOLR will never be happy.

    Thanks Bleddyn

    ReplyDelete
  3. Hello Hari,
    I have a question.
    First question:
    in step 2 you mentioned
    "2 Publish MadisonsEnhancements Store Archive"
    This :
    "In this sample I have published Madisons-FEP.sar as a normal store (not an extended sites store)".

    What is the difference between publishing a extended sites store vs just a Madisons store?. Why we need extended sites store if just publishing a Madisons serves the purpose?.


    Second question:
    If I need to publish it as a extended sites, I need to publish these:
    1-Publish Extended Sites Catalog Asset Store
    2-Publish MadisonsStorefrontAssetStore-FEP.sar 3-Publish MadisonsEnhancements.sar
    4-create online store in CMC

    But when I was trying to publish MadisonsEnhancements.sar it needs "Customer facing Store identifier" which is not yet created. How to do that?

    Thanks again for your detailed blog. If you can thow some information on my question that will be great !!! I appreciate your work.

    ReplyDelete
  4. Hi Hari,

    I published MadisonsEnhanacements.sar and now when I access the store(http://localhost/webapp/wcs/stores/servlet/TopCategories_11001_10351_-1) I get following error:

    [10/7/13 14:33:09:490 IST] 0000010c servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [WC] [/webapp/wcs/stores] [/GenericJSPPageError.jsp]: Initialization successful.
    [10/7/13 14:33:09:588 IST] 0000010c logging E /GenericJSPPageError.jsp -
    java.lang.NullPointerException
    at com.ibm.commerce.seo.url.internal.SEOURLPatternProcessor.getSEOURLTokenList(SEOURLPatternProcessor.java:163)
    at com.ibm.commerce.seo.url.configuration.SEOURLPatternTypeImpl.processPattern(SEOURLPatternTypeImpl.java:142)
    at com.ibm.commerce.seo.url.configuration.SEOURLPatternTypeImpl.initialize(SEOURLPatternTypeImpl.java:225)
    at com.ibm.commerce.seo.url.configuration.SEOURLPatternConfiguration.parseXMLFile(SEOURLPatternConfiguration.java:748)
    at com.ibm.commerce.seo.url.configuration.SEOURLPatternConfiguration.parseXMLFiles(SEOURLPatternConfiguration.java:530)
    at com.ibm.commerce.seo.url.configuration.SEOURLPatternConfiguration.initialize(SEOURLPatternConfiguration.java:389)
    at com.ibm.commerce.seo.url.configuration.SEOURLPatternConfiguration.(SEOURLPatternConfiguration.java:245)
    at com.ibm.commerce.seo.registry.SEOURLPatternConfigurationRegistry.loadSeoUrlPatternConfiguration(SEOURLPatternConfigurationRegistry.java:291)
    at com.ibm.commerce.seo.registry.SEOURLPatternConfigurationRegistry.getSeoUrlPatternConfiguration(SEOURLPatternConfigurationRegistry.java:343)
    at com.ibm.commerce.seo.registry.SEOURLPatternConfigurationRegistry.isSEOURLPatternFeatureEnabled(SEOURLPatternConfigurationRegistry.java:547)
    at com.ibm.commerce.seo.url.helpers.SEOURLMapperImpl.isSEOURLPatternFeatureEnabled(SEOURLMapperImpl.java:1307)
    at com.ibm.commerce.foundation.internal.client.taglib.UrlTag.doEndTag(UrlTag.java:222)
    at com.ibm._jsp._TopCategoriesDisplay._jspx_meth_wcf_url_0(_TopCategoriesDisplay.java:6590)
    at com.ibm._jsp._TopCategoriesDisplay._jspx_meth_c_if_11(_TopCategoriesDisplay.java:6644)
    at com.ibm._jsp._TopCategoriesDisplay._jspService(_TopCategoriesDisplay.java:1173)

    ReplyDelete
  5. Shriba I have the same promlem you had. What was the fix for this?

    ReplyDelete
  6. The article you have shared here very awesome. I really like and appreciated your work. I read deeply your article, the points you have mentioned in this article are useful
    baixar facebook
    baixar whatsapp
    unblocked games

    ReplyDelete
  7. How to enable SOLR search in Feature pack 8

    ReplyDelete
  8. E-commerce blog is used to know the lot of things about this article.It is a new topic for me.I read this article and is awesome.

    java training in chennai

    ReplyDelete
  9. Awesome..You have clearly explained …Its very useful for me to know about new things..Keep on blogging.. seo institute in chennai

    ReplyDelete
  10. Nice blog interesting to read , keep more blog magetno 2 training

    ReplyDelete
  11. Excellent Wok, Thanks for sharing with us this valuable blog. I get the solution to my problem. Visit for
    electronic music production courses in delhi

    ReplyDelete
  12. Hi dear, This is an nice and valuable post thanks for this information!
    Digital Marketing Course in Kolkata

    ReplyDelete
  13. Fascinating topic to explore further. Would be curious to hear other viewpoints as well to get a more well-rounded view. Food for thought for sure. While I may not agree on everything, I appreciate you highlighting this issue to create more discussion. tarpaulins

    ReplyDelete