Thursday, June 6, 2013

Sales Catalog ---SOLR

I received a question regarding SOLR setup for sales catalog. This blog provides a quick write up on the question and the tools provided out of the box. SOLR is totally based on master catalog and locale (en_US, fr_CA..etc) and it does not need any configuration for different sales catalogs for a single store or multiple stores.
Solr document is created during indexing and it's configured in wc-data-config.xml, there's a bunch of sqls in there and schema.xml defines all the fields in the 'document'. All the store relationships are updated as a part of those out of the box SQL's to the document.

There are a few utilities provided out of the box. setupSearchIndex takes master catalogId and languageId
that sets up the WCDE_ENT70/search/pre-processConfig  and WCDE_ENT70/search/solr/
when running on the server, you'll probably want to use the "-remote true" option.

Once the index is setup, the next step is to  run preprocess, use di-preprocess and to re-index, use di-buildindex

PreProcessing step is to flatten data and buildIndex is used to building the search index.

Explanation of document from InfoCenter:
Solr maintains one or more indexes, which are searchable collections of items called documents. When using Solr to support catalog search, the documents in the index represent catalog entries.
Adding a document to an index is often referred to as indexing the document.
Each document is composed of a set of attributes called fields. For example, a catalog entry document can have fields such as Partnumber, Name, and Description.
When a document is added to an index, each field in the document can be indexed or stored, or indexed and stored. An indexed field is one that can be used for searching, sorting, and faceting. If the field is indexed, document IDs can be determined from field values. A stored field is one where its value can be retrieved by a search. Alternatively, if the field is stored, field values can be determined from document IDs.

Reference: definition of document:
http://pic.dhe.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.developer.doc/concepts/csdsearchindex.htm