Page 1 of 1

Solr

Posted: Wed Jul 29, 2015 10:34 am
by Shanky
Hi,

I am trying to understand the workflow of solr in broadleaf. At the moment I want to add new product attributes as solr facet and make the field searchable. What I understood was that I need to make entries into SQL table in order to make it work. BLC_FIELD, BLC_SEARCH_FACET, BLC_CAT_SEARCH_FACET_XREF and BLC_FIELD_SEARCH_TYPES are the tables that I believe are required for this purpose. Please explain me how entries in tables are to be made that would make a new facet to be displayed on broadleaf. Also I couldn't find a trigger from where I could start re-indexing. Please help me with that too.

Re: Solr

Posted: Wed Jul 29, 2015 2:50 pm
by phillipuniverse
Yes you are correct. When building a document in Solr, Broadleaf loops through all of the entries in BLC_FIELD and and adds those to the document. If it is facetable (BLC_SEARCH_FACET) then it will also add a facet field as well.

To kick off an index inject the SolrIndexService bean somewhere (like in a controller) and invoke rebuildIndex().

Re: Solr

Posted: Thu Jul 30, 2015 2:53 am
by Shanky
phillipuniverse wrote:Yes you are correct. When building a document in Solr, Broadleaf loops through all of the entries in BLC_FIELD and and adds those to the document. If it is facetable (BLC_SEARCH_FACET) then it will also add a facet field as well.

To kick off an index inject the SolrIndexService bean somewhere (like in a controller) and invoke rebuildIndex().



Thanks for reply. I have further queries. Please explain me these entries :
INSERT INTO BLC_FIELD_SEARCH_TYPES (FIELD_ID, SEARCHABLE_FIELD_TYPE) VALUES (1, 't');
-- Note that we are don't search on heat range
-- Note that we are don't search on price
INSERT INTO BLC_FIELD_SEARCH_TYPES (FIELD_ID, SEARCHABLE_FIELD_TYPE) VALUES (4, 't');
INSERT INTO BLC_FIELD_SEARCH_TYPES (FIELD_ID, SEARCHABLE_FIELD_TYPE) VALUES (5, 't');
INSERT INTO BLC_FIELD_SEARCH_TYPES (FIELD_ID, SEARCHABLE_FIELD_TYPE) VALUES (6, 't');
INSERT INTO BLC_FIELD_SEARCH_TYPES (FIELD_ID, SEARCHABLE_FIELD_TYPE) VALUES (7, 't');
INSERT INTO BLC_FIELD_SEARCH_TYPES (FIELD_ID, SEARCHABLE_FIELD_TYPE) VALUES (8, 'ss');

What are available field types and what are their uses? Also I want to know the url of embedded solr so that I could check the data.

Re: Solr

Posted: Fri Jul 31, 2015 11:36 am
by phillipuniverse
Also I want to know the url of embedded solr so that I could check the data.


There isn't one, as far as I know you can't do what you're describing. You have to use standalone Solr that you download from their website and then change solr.source.primary, solr.source.reindex, solr.source.admin. Then in a browser you can go to localhost:8983/solr and see the documents.

the BLC_FIELD_SEARCH_TYPES relates to the fields that says what should be enabled for fulltext searching. Those are stored in Solr with the given field types.

You can see how the t, ss etc is mapped in schema.xml. There is also a description on how it's stored at http://www.broadleafcommerce.com/docs/c ... and-search.