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
Asked
Active
Viewed 1,701 times
-1

geryjuhasz
- 184
- 1
- 15
-
1With Solr, you're going to have to provide much more information. Include your schema design (the fields in schema.xml) as well as the definition of your request handler (the "/select" reference) from solrconfig.xml. – jro Jan 07 '14 at 18:08
-
I need docs with propids 1 and 2, it is a multiValued field, values separated by ",". These will be properties for some products like capacity and power or whatever property. Each product has a capacity property a power property, etc. When I`m building my filters I have to build my query so if a type of capacity is selected it should return all prods with that property, than if another prop is selected it should return prods having the first AND the second property. Hope it is clear now :) – geryjuhasz Jan 11 '14 at 17:49
-
"I need docs with propids 1 and 2, it is a multiValued field, values separated by "," -- can you show your schema field definition and a sample document you have indexed? – jro Jan 11 '14 at 20:46
-
Field: `
` Doc ex: [doc](http://en.textsave.org/U8N) – geryjuhasz Jan 11 '14 at 21:04 -
Thanks, but the doc link shows a query result, not a document used to populate your search index. – jro Jan 12 '14 at 03:56
-
It is populated with data-importer from mysql. How would you like to see it? – geryjuhasz Jan 12 '14 at 08:22
-
So when you query just one propids, you get what you want, but when you use 'and', things go wrong. Show us the and-query. – Harald Jan 18 '14 at 07:42
3 Answers
1
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

Rowanto
- 2,819
- 3
- 18
- 26
-
It seems ok, unfortunately I can not test it anymore because I have already modified logic. I think this is the right answer. Thanks. – geryjuhasz Jan 18 '14 at 22:37
0
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

buddy86
- 1,434
- 12
- 20
0
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.

Sapumal Jayaratne
- 169
- 6