Reputation: 3
I'm trying to retrieve data from solr using facet
http://localhost:8983/solr/prices/select?indent=true&q.op=OR&q=storeCode%3AST01%20AND%20type%3AGWP&facet=on&facet.field=invoice
my initial result without facet would look like this
PRM://T-A10-1001
PRM://T-A10-1002
PRM://T-A20-1003
PRM://T-A20-1003
but with facet it would return something like this
"facet_fields":{
"invoice":[
"prm",4,
"t",4,
"a10",2,
"a20",2,
"1001",1,
"1002",1,
"1003",2]}
what i'm aiming is something like this
PRM://T-A10-1001,1
PRM://T-A10-1002,1
PRM://T-A20-1003,2
what kind of solution can i use in order to get the result like above, I'm using solr 8.11.1, any help would be appreciated, thank in advance.
Upvotes: 0
Views: 328
Reputation: 52802
The field you're faceting on is analyzed and have an analyzer attached (i.e. it's probably a text
field or something similar).
Use a pure string
field for faceting, so that the values aren't being split into separate tokens.
You can change this in your schema, either through the API or by changing the schema file manually. You'll need to clean out the index and then reindex your content to get the proper tokens stored for the field.
Upvotes: 1