Facets grouping for a solr novice

18 views
Skip to first unread message

Wesley Leonard

unread,
Apr 28, 2015, 11:22:56 AM4/28/15
to sol...@googlegroups.com
Hello.

I have recently started using solr for a project at work and I'm stuck trying to get facets to work correctly in our case.

We have a database locations and inventory. Our solr indexes flatten the inventory and location tables together.

Example:


location data:
 - location_id
 - name
 - address
 - phone
 - has_elevator
 - takes_credit_cards

inventory data:
 - inventory_id
 - location_id
 - name
 - description
 - in_stock
 - color


Indexed in solr like this:
 - location_id
 - inventory_id
 - location_name
 - address
 - phone
 - inventory_name
 - inventory_description
 - location_has_elevator_attribute
 - location_takes_credit_cards_attribute
 - inventory_in_stock_attribute
 - inventory_color_attribute


When a user searches, they can filter on any of the "attributes". We want solr to count only the locations (not the items in inventory) so the user is shown how many locations have either the attributes selected OR have items in inventory with selected attributes.

I hope that all makes sense...  now to the problem. It's working as expected for location-level attributes, but inventory-level attributes are not.

We're using these params:
facet: true
group: true
group.field: location_id
facet.field: [
  location_has_elevator_attribute
  location_takes_credit_cards_attribute
  inventory_in_stock_attribute
  inventory_color_attribute
]

Plus others related to address search and whatnot. I've tried to obfuscate the data as much as possible but I hope it all comes through.

I am a total newbie so I appreciate any advice.

Thanks!


Mauricio Scheffer

unread,
Apr 29, 2015, 7:14:32 AM4/29/15
to sol...@googlegroups.com
Please use the Solr mailing list for questions that are not specific to SolrNet, there are lots more people there, you'll get better and faster answers.

Cheers,
Mauricio
Reply all
Reply to author
Forward
0 new messages