mirror of https://github.com/apache/lucene.git
LUCENE-2580: fix AIOOBE in MultiPhraseQuery
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@980909 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
53f74289d5
commit
bea5529ed4
|
@ -457,6 +457,9 @@ Bug fixes
|
|||
* LUCENE-2537: FSDirectory.copy() implementation was unsafe and could result in
|
||||
OOM if a large file was copied. (Shai Erera)
|
||||
|
||||
* LUCENE-2580: MultiPhraseQuery throws AIOOBE if number of positions
|
||||
exceeds number of terms at one position (Jayendra Patil via Mike McCandless)
|
||||
|
||||
New features
|
||||
|
||||
* LUCENE-2128: Parallelized fetching document frequencies during weight
|
||||
|
|
|
@ -132,7 +132,25 @@ public class TestMultiPhraseQuery extends LuceneTestCase {
|
|||
searcher.close();
|
||||
reader.close();
|
||||
indexStore.close();
|
||||
|
||||
}
|
||||
|
||||
// LUCENE-2580
|
||||
public void testTall() throws IOException {
|
||||
MockRAMDirectory indexStore = new MockRAMDirectory();
|
||||
RandomIndexWriter writer = new RandomIndexWriter(newRandom(), indexStore);
|
||||
add("blueberry chocolate pie", writer);
|
||||
add("blueberry chocolate tart", writer);
|
||||
IndexReader r = writer.getReader();
|
||||
writer.close();
|
||||
|
||||
IndexSearcher searcher = new IndexSearcher(r);
|
||||
MultiPhraseQuery q = new MultiPhraseQuery();
|
||||
q.add(new Term("body", "blueberry"));
|
||||
q.add(new Term("body", "chocolate"));
|
||||
q.add(new Term[] {new Term("body", "pie"), new Term("body", "tart")});
|
||||
assertEquals(2, searcher.search(q, 1).totalHits);
|
||||
r.close();
|
||||
indexStore.close();
|
||||
}
|
||||
|
||||
private void add(String s, RandomIndexWriter writer) throws IOException {
|
||||
|
|
Loading…
Reference in New Issue