mirror of https://github.com/apache/lucene.git
LUCENE-6395: MemoryIndex's TermsEnum.seekExact(long ord) was failing to set the term bytes
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1671540 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2e5bc486e2
commit
19c70cab54
|
@ -139,6 +139,9 @@ Bug Fixes
|
||||||
that up to 3X (X = current index size) spare disk space may be needed
|
that up to 3X (X = current index size) spare disk space may be needed
|
||||||
to complete forceMerge(1). (Robert Muir, Shai Erera, Mike McCandless)
|
to complete forceMerge(1). (Robert Muir, Shai Erera, Mike McCandless)
|
||||||
|
|
||||||
|
* LUCENE-6395: Seeking by term ordinal was failing to set the term's
|
||||||
|
bytes in MemoryIndex (Mike McCandless)
|
||||||
|
|
||||||
Optimizations
|
Optimizations
|
||||||
|
|
||||||
* LUCENE-6183, LUCENE-5647: Avoid recompressing stored fields
|
* LUCENE-6183, LUCENE-5647: Avoid recompressing stored fields
|
||||||
|
|
|
@ -949,6 +949,7 @@ public class MemoryIndex {
|
||||||
public void seekExact(long ord) {
|
public void seekExact(long ord) {
|
||||||
assert ord < info.terms.size();
|
assert ord < info.terms.size();
|
||||||
termUpto = (int) ord;
|
termUpto = (int) ord;
|
||||||
|
info.terms.get(info.sortedTerms[termUpto], br);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,10 +17,13 @@ package org.apache.lucene.index.memory;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.lucene.analysis.MockAnalyzer;
|
import org.apache.lucene.analysis.MockAnalyzer;
|
||||||
import org.apache.lucene.index.LeafReader;
|
|
||||||
import org.apache.lucene.index.FieldInvertState;
|
import org.apache.lucene.index.FieldInvertState;
|
||||||
|
import org.apache.lucene.index.LeafReader;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
|
import org.apache.lucene.index.TermsEnum;
|
||||||
import org.apache.lucene.search.IndexSearcher;
|
import org.apache.lucene.search.IndexSearcher;
|
||||||
import org.apache.lucene.search.MatchAllDocsQuery;
|
import org.apache.lucene.search.MatchAllDocsQuery;
|
||||||
import org.apache.lucene.search.TermQuery;
|
import org.apache.lucene.search.TermQuery;
|
||||||
|
@ -30,8 +33,6 @@ import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.is;
|
import static org.hamcrest.CoreMatchers.is;
|
||||||
import static org.hamcrest.CoreMatchers.not;
|
import static org.hamcrest.CoreMatchers.not;
|
||||||
import static org.junit.internal.matchers.StringContains.containsString;
|
import static org.junit.internal.matchers.StringContains.containsString;
|
||||||
|
@ -90,6 +91,16 @@ public class TestMemoryIndex extends LuceneTestCase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testSeekByTermOrd() throws IOException {
|
||||||
|
MemoryIndex mi = new MemoryIndex();
|
||||||
|
mi.addField("field", "some terms be here", analyzer);
|
||||||
|
IndexSearcher searcher = mi.createSearcher();
|
||||||
|
LeafReader reader = (LeafReader) searcher.getIndexReader();
|
||||||
|
TermsEnum terms = reader.fields().terms("field").iterator(null);
|
||||||
|
terms.seekExact(0);
|
||||||
|
assertEquals("be", terms.term().utf8ToString());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimilarities() throws IOException {
|
public void testSimilarities() throws IOException {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue