Solr query not returning expected results

1.7k views Asked by At

I have a solr query like: host:8983/solr/collection/select?q=propids%3A1&wt=json&indent=true where i filter about propids: 1. The problem is when filter propids:1 and 2, i only have documents indexed with propids: 1, buuut I get all the indexed results when using with and, even if I don't have any propids having 2. Any help is appreciated. Thanks

3

There are 3 answers

1
Rowanto On BEST ANSWER

All results which contain propids = 1

host:8983/solr/collection/select?q=*:*&wt=json&indent=true&fq=propids:1

All results which contain propids = 2

host:8983/solr/collection/select?q=*:*&wt=json&indent=true&fq=propids:2

All results which contains either propids = 1 or propids = 2

host:8983/solr/collection/select?q=*:*&wt=json&indent=true&fq=propids:(1 OR 2)

All results which contains both propids = 1 and propids = 2

host:8983/solr/collection/select?q=*:*&wt=json&indent=true&fq=propids:1&fq=propids:2
1
Sapumal Jayaratne On

If you need to get documents with propids=1 plus documents with propids=2, do this.

q=propids:1 2

This will match both words (1 and 2) with the contents of the field and get both types of documents.

0
buddy86 On

I guess your query part is

q=propids:1 and 2

This doesn't mean it'll search propids=1 and 2.

Please check your solrconfig.xml for the default search field. Because if your query is like I mentioed, then it means

q=propids:1 and default_searchable_field:2