How to search for a word in facet query in solr (or in other words how to use wildcard in search by facet)
for example
if i have facet filed MyField and it has the following values:
- ValX ValY
- ValX
- ValZ ValW
- ValX ValV
- ValA ValX
- ValA ValB
now if i search for fq=MyField:ValX, i will get the second record only. how can i search for ValX and get the 1st, 2nd, 4th and 5th records?
you know fq=MyField:*ValX* is not allowed and fq=MyField:ValX* will not return the 5th record.
any idea is highly appreciated.
How is MyField defined in schema.xml? Looks to me as if it isn't tokenized, like for instance with
type="string"
With
type="text"
the field value is tokenized so that
fq=MyField:valx
should match 1, 2, 4 and 5.
Wildcard card on Facet Query should work.
As wildcard queries does not undergo any analysis, you can try fq=MyField:valx*
What you are trying is not filtering but rather searching.
Use a white space tokenizer with lower case filters and search q=MyField:valx and it would match the results. You can use prefix and wildcard queries with it as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With