I am trying to make a url request to an API that uses SOLR for queries.
I have a lot of data with a lot of fields that contains different values and often some of those fields will contain a null value.
I want to make a query where I retrieve all the data where specific fields are not null, but contain some actual value.
For example each entry contains a field called tags which is an array of tags. a tag could for example be the word test.
I have tried doing -tags:[* TO *] and that results in all the data sets where tags is null to be returned.
I have also tried tags:[* TO *] that returns all data, both where tags are null and where tags are actually set.
I have been trying all sorts of things to get to the last case, where only tags with values are returned and I hope you can help me?
and
is not the same asAND
- which is the separator you have to use in your query.Your query probably just search for (documents with
and
somewhere in them in the default field) or (deleted:false
) or (tags:[* TO *]
).Use the proper separator with spaces around it to group multiple conditions. I'd also suggest using a filter query (
fq
) for any of these that are static (such asdeleted:false
) as that allows for that query to be cached separately from your actual query.