Ignacio del Valle Alles created LUCENE-4814:
-----------------------------------------------
Summary: PagingFieldCollector fails when sorting by String null
fields
Key: LUCENE-4814
URL: https://issues.apache.org/jira/browse/LUCENE-4814
Project: Lucene - Core
Issue Type: Bug
Components: core/search
Affects Versions: 4.1
Reporter: Ignacio del Valle Alles
Priority: Minor
When performing a paginated search sorted by a STRING field, and documents
without this field are present in the resultset, PagingFieldCollector stops
collecting documents (or collects all documents, depending on sorting order)
when one of the these documents are used as "after" element for the pagination.
The reason i have observed is that:
org.apache.lucene.search.FieldComparator.TermOrdValComparator.compareDocToValue(int
doc, BytesRef value) (line 1160) allways returns 1 in that case because value
is null ("after" document sorting field value) whereas docValue (returned by
termsIndex.getTerm) is a 0-length BytesRef for documents without that field.
A simple patch can be performed changing only this method with no (apparently)
side-effects:
Current:
if (docValue == null) {
if (value == null) {
Patched:
if (docValue == null || docValue.length==0) {
if (value == null || value.length==0) {
Please excuse my lack of rigour, I'll try to attach the path.
Regards
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]