Hi All,

This might be a simple question. I tried to find a solution, but not exactly
finding what I want. I have the following fields f1, f2 and f3. I want to do
an AND query in these fields. 

If I want to search for single word in these 3 fields, then I am facing no
problem. I can simply construct query like, q=f1:word1 AND f2:word2 AND
f3:word3 . But if I want to search for more than one word, then I am
required to enclose it in double quotes. eg) q=f1:"word1 word2" AND f2:word3
AND f3:word4 But the problem I am facing with this approach is, word1 and
word2 has to appear in the same order in field f1.But for my use case, I
don't require it. It can be present anywhere in that field and I want same
scoring irrespective of where it is present. In simpler words, I just want
basic term matching of those words in that field.

Hence I tried the following solutions,

1. Using a slop query:

I constructed query like q=f1:"word1 word2"~1000 AND f2:word3 AND f3:word4
I read that it puts more load on CPU as it finds the position difference
between those words and creates the score. I just want a plain term matching
and I don't require score to vary based on distance.

2. Using Filter query:

I constructed query like, q=word1 word2&df=f1&fq=f2:word3&f3:word4 The score
is way less as it is not using filter query terms for scoring. Also since I
enabled filter cache, I don't want these filter queries to be cached. Hence
I don't want to use filter queries for these fields.

3. Using AND operator and df:

I constructed query like, q=word1 word2 AND f2:word3 AND f3:word4&df=f1.
This works perfectly fine as word1 and word2 are searched in f1 and other
AND queries are also working fine. But now, If I want to search for 2 words
in f2 as well, then I am not sure how to construct query.

eg) q=word1 word2 AND f2:word3 word4 AND f3:word5 word6&df=f1 .Here, word4
and word6 will be searched against field f1. But I want them to searched on
f2 and f3 respectively. Hence please help me with this.

Thanks,
Sriram



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-And-query-tp4166685.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to