Could you show us some input data, both WITH a i_yearStopSort value and WITHOUT the the value?

I tried a quick test using the stock Solr 3.6.1 example schema and a dynamic integer field and the filter query did in fact filter out all documents that did not have a value in that field:

http://localhost:8983/solr/select?q=*:*&fq=%2bx_i:{*+TO+*}

Maybe you could come up with a simple sample solrxml document that can be added to the stock 3.6.1 example schema that shows the problem.

-- Jack Krupansky

-----Original Message----- From: Aaron Daubman
Sent: Tuesday, December 04, 2012 9:30 AM
To: solr-user@lucene.apache.org
Subject: Range Queries performing differently on SortableIntField vs TrieField of type integer

Greetings,

I'm finally updating an old instance and in testing, discovered that using
the recommended TrieField instead of SortableIntField for range queries
returns unexpected and seemingly incorrect results.

A query with:

q=*:*&fq=+i_yearStartSort:{* TO 1995}&fq=+i_yearStopSort:{* TO *}

Should, and does under 1.4.1 with SortableIntField, only return docs that
have some i_yearStopSort value and have an i_yearStartSort value less than
1995.

Unfortunately, under 3.6.1 with class="solr.TrieField" type="integer", this
query is returning docs that have neither an i_yearStopSort nor a
i_yearStartSort value.


Here are the two schemas:

Solr 1.4.1 Relevant Schema Parts - Working as desired:
---------------------------------------------------------------------------------
<fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true"
omitNorms="true"/>
...
<field name="i_yearStartSort" type="sint" indexed="true" stored="false"
required="false" multiValued="true"/>
<field name="i_yearStopSort" type="sint" indexed="true"  stored="false"
required="false" multiValued="true"/>


Solr 3.6.1 Relevant Schema Parts - Not working as expected:
-----------------------------------------------------------------------------------------
<fieldType name="tint" class="solr.TrieField" type="integer"
precisionStep="4" sortMissingLast="true" positionIncrementGap="0"
omitNorms="true"/>
...
<field name="i_yearStartSort" type="tint" indexed="true" stored="false"
required="false" multiValued="false"/>
<field name="i_yearStopSort" type="tint" indexed="true" stored="false"
required="false" multiValued="false"/>


1) What is the best way to return to the desired/expected behavior?
2) Can you explain to me why this happens?
3) I have a sneaking suspicion (but could be totally wrong) that this
relates to sortMissingLast="true" - if it does, can you explain the seeming
discrepancies in:
SOLR-2881 and SOLR-2134? If I am reading these correctly, SOLR-2134 says
this was fixed for Trie in 4.0, but not in 3.x... SOLR-2881 has a fix
version of 3.5 listed, but some of the comments also seem to indicate this
was not actually fixed in 3.5+

Thanks,
Aaron

Reply via email to