You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2010/06/04 20:26:29 UTC
svn commit: r951518 -
/lucene/dev/trunk/solr/src/java/org/apache/solr/search/SolrIndexSearcher.java
Author: mikemccand
Date: Fri Jun 4 18:26:29 2010
New Revision: 951518
URL: http://svn.apache.org/viewvc?rev=951518&view=rev
Log:
SOLR-1900: fix MultiFields/DocsEnum usage
Modified:
lucene/dev/trunk/solr/src/java/org/apache/solr/search/SolrIndexSearcher.java
Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/search/SolrIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/search/SolrIndexSearcher.java?rev=951518&r1=951517&r2=951518&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/search/SolrIndexSearcher.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/search/SolrIndexSearcher.java Fri Jun 4 18:26:29 2010
@@ -24,7 +24,6 @@ import org.apache.lucene.store.Directory
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.util.UnicodeUtil;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.core.SolrConfig;
@@ -478,13 +477,13 @@ public class SolrIndexSearcher extends I
*/
public int getFirstMatch(Term t) throws IOException {
Fields fields = MultiFields.getFields(reader);
+ if (fields == null) return -1;
Terms terms = fields.terms(t.field());
if (terms == null) return -1;
- BytesRef termBytes = new BytesRef();
- UnicodeUtil.UTF16toUTF8(t.text(), 0, t.text().length(), termBytes);
- DocsEnum docs = terms.docs(reader.getDeletedDocs(), termBytes, null);
+ BytesRef termBytes = new BytesRef(t.text());
+ DocsEnum docs = terms.docs(MultiFields.getDeletedDocs(reader), termBytes, null);
if (docs == null) return -1;
- int id = docs.docID();
+ int id = docs.nextDoc();
return id == DocIdSetIterator.NO_MORE_DOCS ? -1 : id;
}