Ben
Ben

Reputation: 93

Solr Faceting Restriction Over Two Fields

Im trying to achieve the following in SOLR via faceting.

I want to return all the MODEL fields where the MAKE field = 'FORD'

http://wa12-d17251.print.tradermedia.co.uk:8080/solr/select/?q=make:FORD&fq={!geofilt}&sfield=location&pt=51.5375,-0.1934&d=5&facet=true&facet.field=model&facet.query=make:FORD&rows=0

Ignore the geoLocation stuff.

What i get back is all of the other MODELS which i understand why as they are not joined in any way.

How would i configure solr to just return Models where the Make is 'X'

Any help appreciated.

Thanks Ben

Upvotes: 0

Views: 187

Answers (2)

mjalajel
mjalajel

Reputation: 2201

If you're using Solr 4+, you can use pivoted faceting (Group facets by make) then select the elements under 'Ford'.

&facet=true&facet.pivot=MAKE,MODEL

Upvotes: 0

Mauricio Scheffer
Mauricio Scheffer

Reputation: 99730

I want to return all the MODEL fields where the MAKE field = 'FORD'

I assume you meant "model values" instead of "model fields"

q=*:*&fq=make:FORD&facet=true&facet.field=model

Upvotes: 1

Related Questions