Layke
Layke

Reputation: 53196

Solr Schema Advice for Dynamic Facetable Fields

I haven't used Solr for about three years, and I see that it has now jumped up to 3.5.

The "Documents" that I am trying to add to my Index are properties.

The majority of all properties will have about ten of the same types of fields. Such as

However, I also want to add in attributes about the property which should be facetable.

Property receive features, which are grouped into ten of so categories. Such as... (Entertainment, Attractions, General, Kitchen, Spa etc). And then the user when adding their property would select items from a pre defined list.

So that for example, if they are adding General features, they might check:

✓ Heating, ✓ Balcony, ✓ Garage, ✓ Washing Machine etc.

Then on my presentation layer, These options might be displayed under the heading General with all of the available facets that fall within the General category.

So, this is my problem... if I make a facet field called "general" I would actually want to add a lot of values to this field. But then can you facet over a multi valued field?

And then I would want to do exactly the same for "spa" where the user might check that the property has a Swimming Pool, Sauna and a load of other features etc.

Any advice as to how I should construct my schema would be appreciated.

Upvotes: 1

Views: 947

Answers (1)

Fuxi
Fuxi

Reputation: 5508

Yes, you can facet over multivalued field. Watch this presentation by Solr's developer about facets: The Many Facets of Apache Solr by Yonik Seeley

I hope that this will have all answers you need. Only thing you need to do in schema is to set the field as multivalued (and maybe also make some processing if this is text not ids, but this is showed nicely in presentation and slides

Upvotes: 2

Related Questions