Is it possible to search (with apache Solr) for items which are in one of few categories using filter query, e.g. items in category 'computers' OR 'phones'
When I want to search for items in category computers AND phones I type:
select/?q=...&fq=cat:computers&fq=cat:phones
but it is possible to use OR
instead of AND
?
The fq filter query parameter in a query to Solr search is used to filter out some documents from the search result without influencing the score of the returned documents. Queries with fq parameters are cached.
Trying a basic queryThe main query for a solr search is specified via the q parameter. Standard Solr query syntax is the default (registered as the “lucene” query parser). If this is new to you, please check out the Solr Tutorial. Adding debug=query to your request will allow you to see how Solr is parsing your query.
Solr has more advantages when it comes to the static data, because of its caches and the ability to use an uninverted reader for faceting and sorting – for example, e-commerce. On the other hand, Elasticsearch is better suited – and much more frequently used – for timeseries data use cases, like log analysis use cases.
You can use
fq=cat:(computers OR phones)
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