i'm having documents with a multivalued field "sharedTo" which contains the groups that the document is shared to. Now I want to find all documents that are shared to at least one of a list of given groups. E.g. I want to find all documents that are shared to the group "foo" or the group "bar" or both. Currently I'm building a query like this:
sharedTo:"foo" OR sharedTo:"bar"
For each group I just add a new OR query part. This works, however I wonder if there is a more efficient way of doing this like a
sharedTo IN ('foo', 'bar')
You can search for "solr" by loading the Admin UI Query tab, enter "solr" in the q param (replacing *:* , which matches all documents), and "Execute Query". See the Searching section below for more information. To index your own data, re-run the directory indexing command pointed to your own directory of documents.
The fl parameter limits the information included in a query response to a specified list of fields. The fields need to either be stored="true" or docValues="true"` . ` The field list can be specified as a space-separated or comma-separated list of field names.
The df stands for default field , while the qf stands for query fields . The field defined by the df parameter is used when no fields are mentioned in the query. For example if you are running a query like q=solr and you have df=title the query itself will actually be title:solr .
Standard solr queries use the "q" parameter in a request. Filter queries use the "fq" parameter. The primary difference is that filtered queries do not affect relevance scores; the query functions purely as a filter (docset intersection, essentially).
if your default operator is OR, then you can just give the query as
sharedTo:('foo' 'bar')
If your default operator is AND, then you'll have to do it like this: sharedTo:(foo OR bar)
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