Question

I use Solr version 3.6.2

I have indexed a field named "type", something like type1 type2 type3.

When I do a search without conditions in the query, I get a result with a certain relevance. In this case all of the search results happen to be of type type1 type2 type3.

For example:

Result 1
Result 2
Result 3

But when I add a condition to the same query and explicity state that it should be of type1, type2 or type3 for example: (query) AND (type:type1 OR type:type2 OR type:type3)

For example:

Result 1
Result 3
Result 2

I get a different relevance as result, and I get different count of the results.

So I get different relevance if I add a condition that is already true.

Why this behaviour?

Was it helpful?

Solution

Well it should look something like this instead:

text:(+query) and +type:(1 2 3)^0

^0 means that the second condition should be fulfilled but have no relavance!

OTHER TIPS

Try following operator with your query.

Start with plus sign(+) = Must have in search result

Start with power sign(^) = Relevance in search result (0 means no effect of search result)

Compare to SQL Query

Select * from Table1 Where text = 'xxx' And type in (1,2,3)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top