[
https://jira.jboss.org/jira/browse/DNA-630?page=com.atlassian.jira.plugin...
]
Randall Hauch commented on DNA-630:
-----------------------------------
This was found while trying to fix DNA-613.
I logged this because this was so tricky. LuceneSearchEngine works by building up a
(complex) Lucene Query object and executing that, then collecting the tuples from the
Lucene documents that are returned in the results.
In this case, the AQM query included a constraint (among others) that LuceneSearchEngine
converted into a custom HasValueQuery class (which extends Query). HasValueQuery creates
a custom ExistsScorer class (which subclasses org.apache.lucene.search.Scorer), and the
problem was that the 'nextDoc()' method was implemented incorrectly. It uses an
internal counter to walk through the documents (handed to it in the constructor), and was
not (correctly) checking whether the docId was less than the maxDoc, which is obtained
from the IndexReader.maxDoc().
Essentially, the ExistsScorer was iterating through more documents than in the reader, and
thus the "read past EOF". (The IndexReader uses a random-access mechanism to
seek to the desired document, but if the document ID is too big, the seek goes beyond the
EOF.)
I checked the other Query subclasses in org.jboss.dna.search.lucene.query, and found a few
other classes that were also implemented incorrectly. These were fixed as well, and all
tests pass.
Executing a query resulted in a "read past EOF" error
-----------------------------------------------------
Key: DNA-630
URL:
https://jira.jboss.org/jira/browse/DNA-630
Project: DNA
Issue Type: Bug
Components: Query, Search
Affects Versions: 0.7
Reporter: Randall Hauch
Assignee: Randall Hauch
Priority: Blocker
Fix For: 0.7
When executing a query against the LuceneSearchEngine, the query came back with an error
(in the problems), which stated "read past EOF".
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira