0
votes

We're implementing solr with ecommerce application. The main objective is faster search and better faceted catalog navigation.

The problem however is, we're unable to figure out how to map dynamic facets into Solr. When I say dynamic facet, I mean this...

Samsung Galaxy S3

  • Category: Smartphone
  • Brand: Samsung
  • OS: Android
  • RAM: 1 GB
  • Processor: 1 Ghz
  • Camera: 8MP
  • Display: 4.7 inch
  • and like..

Filtering criteria, like OS, RAM, Processor, camera, etc. are dynamic to each product, some has it and some has altogether different set of filter criteria for facets. So when someone click on Android, a result will be filtered with all android phones in selected category.

We're facing an issue where we are unable to decide what the solr schema.xml will look like for supporting this kind of data dictionary for faceted search.

2
Adding an example of how you would address this kind of question, will be a much valued answer.Krunal

2 Answers

4
votes

Dynamic fields are what you need.

You could even do this:

product_name : samsung nexus
android_version_t : 4.0
partner_store_price_i : 19800

The _t and _i suffixes will be understood as text and integer types if you set your schema that way.

<dynamicField name="*_i"  type="int"    indexed="true"  stored="true"/>
<dynamicField name="*_s"  type="string"  indexed="true"  stored="true"/>
<dynamicField name="*_l"  type="long"   indexed="true"  stored="true"/>
<dynamicField name="*_t"  type="text"    indexed="true"  stored="true"/>

http://www.tnrglobal.com/blog/2010/07/dynamic-fields-in-apache-solr/

http://wiki.apache.org/solr/SchemaXml#Dynamic_fields

2
votes

Expanding on the answer above.

You can have fields such as isSpecial, a boolean, specialCategoryType. In the above case, they are set to true and android.

When this item is selected (isSpecial) you can refine the query and add to the predicate specialCategoryType:android.

Edit:

Lets say there are two products, an android phone and an android laptop. phone 1- os:android; type:phone; camera:8MP; specCatFacet:os,type,camera ; specCatRefine:os, type laptop- os:android; type:laptop; screensize:13; specCatFacet:os,type,screen; specCatRefine:os, type phone 2 - os:android; type:phone; camera:4MP; specCatFacet:os, type, camera; specCatRefine:os, type

When people, search for android, all three will show up. Facets displayed could be a union of both sets of facets.

When a phone1 or 2 is clicked on, you'd look at specCatRefine field, and refine the search criteria with os, type and use specCatFacet to subsequently facet them.

When the laptop is clicked on, the search is refined on os, type and facetted on os, type, screen.

Essentially, second search term refine and facetting is based on a field in each document. Your search term refining will have lot of this logic on how to create the criteria.

Hope this helps...