Questions tagged [solr-query-syntax]
175 questions
37
votes
4 answers
Solr - How do I construct a query that requires a NOT NULL Location field
I have a Solr index with a set of coordinates stored as a Location type; I would like to query for documents where this field has a non-null value.
What is the query syntax to perform the NOT NULL check on a Location field?

STW
- 44,917
- 17
- 105
- 161
15
votes
3 answers
Solr query syntax for array field
How do I search within an array field?
I am using solr 4.2 with default settings.
I indexed a few html and pdf documents using SolrNet. Here is a sample result for such a document when I search using the admin search *:*
enter code here

chadisbad
- 385
- 2
- 4
- 16
12
votes
4 answers
How to exclude fields in a SOLR query
I have a SOLR query which should fetch all the fields I store, except one field.
Say I have 20 fields, do I need to hard code the 19 fields I want to fetch in the
&fl=[f],[f],[f],....[f]'
Or is there a way to do something similar to
&fl=*,![f]'
[f]…

Itay Moav -Malimovka
- 52,579
- 61
- 190
- 278
8
votes
2 answers
Is there a SolrJ query builder?
Using solr 5.2.0 was wondering is there a query builder API/Jar/Ckient similar to Elasticsearch query builder API or do we have to bassically do String Kungfu to build queries in Solr?

user432024
- 4,392
- 8
- 49
- 85
6
votes
1 answer
Can you use solr_query in Cassandra to find map field containing some particular value?
I would like to use solr_query to find results which field of map type contains given key-value pair.
I'm trying to create a query similar to this:
SELECT * FROM my_table WHERE pathId= 5 AND solr_query='validity: [1970-01-01T00:01:00 TO *] ’ AND…

Marcin Zareba
- 430
- 7
- 18
6
votes
2 answers
Sort by multiple fields in specific order in Solr
So I want to sort my Solr response by the following fields:
published_year (desc)
series_number (asc)
status_color
Problem is that status_color must be sorted by the following values (e.i. not alphabetically):
"Green"
"Yellow"
"Red"
This field…

Fredrik
- 1,741
- 4
- 24
- 40
6
votes
4 answers
What's wrong with this Solr range filter query?
The following filter query returns zero results (using *:* as query):
-startDate:[* TO *] OR startDate:[* TO NOW/DAY+1DAY]
But if I filter only by:
-startDate:[* TO *]
I get 3 results.
If I filter only by:
startDate:[* TO NOW/DAY+1DAY]
I get 161…

jmend
- 1,210
- 4
- 16
- 30
5
votes
1 answer
Negative operator(NOT,- , !) in solr query string doesn't work with parentheses
I'm using solr 6.6.0 ,and here are the documents in the collection.
{"id":1,"content":test1"}
{"id":2,"content":test2"}
{"id":3,"content":test3"}
Say I wanto to include the documents not containing "test1" and "test2",It seems legal to write the…

chao_chang
- 778
- 8
- 14
5
votes
1 answer
how to extract stats component with solrj 4.9.0
I have a solr query like this
q=categories:cat1 OR categories:cat2&stats=true&stats.field=count&stats.facet=block_num
Basically, I want to get the sum(count) group by block num.
This query works on a browser. But with solrj, I could not access…

E.A.
- 321
- 1
- 4
- 13
4
votes
0 answers
Query on multivalued fields size
I need a help. I need a query that the results are based on a multivalued field size. For example: I want all documents with 5 skus. I have a multivalued field named skulist. Can i search for multivalued fields size? Thanks.

paulo freitas
- 51
- 1
- 3
4
votes
1 answer
Avoiding Duplicates while Searching Solr Index
My Solr Index has two types of Users( Type-A and Type-B ), which can be identified with a field called as 'type'.
But there is possibility for an user to have entries under both Types(A and B).
For example,
Jacob is a user who comes under both…

Mavellin
- 665
- 7
- 17
4
votes
1 answer
How to escape quotes in solr nested query syntax?
I.e. I want to search for phrase with nested queries syntax
so
_query_:"{!dismax qf=myfield}"how now""
How to solve this for first level?
How to solve this for any level? _query_:"_query_:"{!dismax qf=myfield}"how now"""

yura
- 14,489
- 21
- 77
- 126
3
votes
0 answers
Please explain the syntax in solr query fq = {!frange l=1 u=1}strdist(PR_EMP_ID_s, POSTN_PR_EMP_ROW_ID_s,edit)
In the below syntax:
fq = {!frange l=1 u=1}strdist(PR_EMP_ID_s, POSTN_PR_EMP_ROW_ID_s,edit)
how to interpret this expression?
I know the basic fq working.
I have one query where I found this expression, but I am not able to interpret this syntax.

Rahul557
- 31
- 2
3
votes
2 answers
Solr Query to search child and parent documents by join
I need help constructing a Solr query that will not only search child documents and return the parent, but also search on the parent. Please see my example schema below:
Manufacturer
Id
Name
Comments
Products …

Nathan Hall
- 409
- 2
- 8
- 17
3
votes
2 answers
How can I use Solr subquery similar to rdbms subqueries?
I need to run a query in Solr that contains another query as terms of the main query!
Something like this in the RDBMS SQL:
select name from movie
where movie.writer in (
select director from movie where producer = 'XXX'
)
Is there any way…

Nazanin
- 53
- 1
- 6