mirror of https://github.com/apache/lucene.git
LUCENE-6766: finish 6.x backport
This commit is contained in:
parent
a3270ac6e6
commit
ea26dd5855
|
@ -15,6 +15,11 @@ Improvements
|
|||
sub-files' checkums and segment IDs, to catch hardware issues or
|
||||
filesytem bugs earlier (Robert Muir, Mike McCandless)
|
||||
|
||||
* LUCENE-6766: Index time sorting has graduated from the misc module
|
||||
to core, is much simpler to use, via
|
||||
IndexWriter.setIndexSort, and now works with dimensional points.
|
||||
(Adrien Grand, Mike McCandless)
|
||||
|
||||
Other
|
||||
|
||||
* LUCENE-4787: Fixed some highlighting javadocs. (Michael Dodsworth via Adrien
|
||||
|
|
|
@ -94,10 +94,8 @@ public class Lucene50RWSegmentInfoFormat extends Lucene50SegmentInfoFormat {
|
|||
@Override
|
||||
public void write(Directory dir, SegmentInfo si, IOContext ioContext) throws IOException {
|
||||
final String fileName = IndexFileNames.segmentFileName(si.name, "", Lucene50SegmentInfoFormat.SI_EXTENSION);
|
||||
// nocommit indexSort
|
||||
if (si.getIndexSort() != null) {
|
||||
throw new IllegalArgumentException("teach me to write indexSort");
|
||||
}
|
||||
|
||||
assert si.getIndexSort() == null;
|
||||
|
||||
try (IndexOutput output = dir.createOutput(fileName, ioContext)) {
|
||||
// Only add the file once we've successfully created it, else IFD assert can trip:
|
||||
|
|
|
@ -98,7 +98,7 @@ public class BuildMaxPositionIndex {
|
|||
assertEquals(expectedCorruption.getMessage(), new CorruptIndexException(expectedCorruption.getOriginalMessage(), expectedCorruption.getResourceDescription()).getMessage());
|
||||
// SerialMergeScheduler
|
||||
assertTrue("got message " + expectedCorruption.getMessage(),
|
||||
expectedCorruption.getMessage().contains("position=2147483647 is too large (> IndexWriter.MAX_POSITION=2147483519), field=\"foo\" doc=0 (resource=PerFieldPostings(segment=_0 formats=1)"));
|
||||
expectedCorruption.getMessage().contains("position=2147483647 is too large (> IndexWriter.MAX_POSITION=2147483519), field=\"foo\" doc=0"));
|
||||
|
||||
w.close();
|
||||
dir.close();
|
||||
|
|
|
@ -51,8 +51,6 @@ public final class MultiFields extends Fields {
|
|||
private final ReaderSlice[] subSlices;
|
||||
private final Map<String,Terms> terms = new ConcurrentHashMap<>();
|
||||
|
||||
// nocommit should we somehow throw exc if you try to pass in "sorted" Fields?
|
||||
|
||||
/** Returns a single {@link Fields} instance for this
|
||||
* reader, merging fields/terms/docs/positions on the
|
||||
* fly. This method will return null if the reader
|
||||
|
|
|
@ -72,25 +72,15 @@ public class TestSegmentInfos extends LuceneTestCase {
|
|||
Codec codec = Codec.getDefault();
|
||||
|
||||
SegmentInfos sis = new SegmentInfos();
|
||||
<<<<<<< HEAD
|
||||
SegmentInfo info = new SegmentInfo(dir, Version.LUCENE_5_0_0, "_0", 1, false, Codec.getDefault(),
|
||||
Collections.<String,String>emptyMap(), id, Collections.<String,String>emptyMap());
|
||||
=======
|
||||
SegmentInfo info = new SegmentInfo(dir, Version.LUCENE_6_0_0, "_0", 1, false, Codec.getDefault(),
|
||||
Collections.<String,String>emptyMap(), id, Collections.<String,String>emptyMap(), null);
|
||||
>>>>>>> 54fa7df... LUCENE-6766: initial patch
|
||||
info.setFiles(Collections.<String>emptySet());
|
||||
codec.segmentInfoFormat().write(dir, info, IOContext.DEFAULT);
|
||||
SegmentCommitInfo commitInfo = new SegmentCommitInfo(info, 0, -1, -1, -1);
|
||||
sis.add(commitInfo);
|
||||
|
||||
<<<<<<< HEAD
|
||||
info = new SegmentInfo(dir, Version.LUCENE_5_1_0, "_1", 1, false, Codec.getDefault(),
|
||||
Collections.<String,String>emptyMap(), id, Collections.<String,String>emptyMap());
|
||||
=======
|
||||
info = new SegmentInfo(dir, Version.LUCENE_6_0_0, "_1", 1, false, Codec.getDefault(),
|
||||
Collections.<String,String>emptyMap(), id, Collections.<String,String>emptyMap(), null);
|
||||
>>>>>>> 54fa7df... LUCENE-6766: initial patch
|
||||
info.setFiles(Collections.<String>emptySet());
|
||||
codec.segmentInfoFormat().write(dir, info, IOContext.DEFAULT);
|
||||
commitInfo = new SegmentCommitInfo(info, 0, -1, -1, -1);
|
||||
|
|
|
@ -586,8 +586,8 @@ public class AnalyzingInfixSuggester extends Lookup implements Closeable {
|
|||
// We sorted postings by weight during indexing, so we
|
||||
// only retrieve the first num hits now:
|
||||
Collector c2 = new EarlyTerminatingSortingCollector(c, SORT, num);
|
||||
IndexSearcher searcher = searcherMgr.acquire();
|
||||
List<LookupResult> results = null;
|
||||
IndexSearcher searcher = searcherMgr.acquire();
|
||||
try {
|
||||
//System.out.println("got searcher=" + searcher);
|
||||
searcher.search(finalQuery, c2);
|
||||
|
|
|
@ -66,7 +66,7 @@ public class AnalyzingInfixSuggesterTest extends LuceneTestCase {
|
|||
assertEquals("a penny saved is a penny earned", results.get(0).key);
|
||||
assertEquals("a penny saved is a penny <b>ear</b>ned", results.get(0).highlightKey);
|
||||
assertEquals(10, results.get(0).value);
|
||||
assertEquals(new BytesRef("foobaz"), results.get(0).payload);
|
||||
assertEquals("foobaz", results.get(0).payload.utf8ToString());
|
||||
|
||||
assertEquals("lend me your ear", results.get(1).key);
|
||||
assertEquals("lend me your <b>ear</b>", results.get(1).highlightKey);
|
||||
|
|
|
@ -293,4 +293,9 @@ public final class SlowCompositeReaderWrapper extends LeafReader {
|
|||
ctx.reader().checkIntegrity();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sort getIndexSort() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue