From 1780ea348807e0f93423ac79bb897265f451cf42 Mon Sep 17 00:00:00 2001 From: Areek Zillur Date: Tue, 7 Apr 2015 18:36:35 +0000 Subject: [PATCH] LUCENE-6339: fix test (take into account inadmissible filtered search for multiple segments) git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1671914 13f79535-47bb-0310-9956-ffa450edef68 --- .../lucene/search/suggest/document/SuggestFieldTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/SuggestFieldTest.java b/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/SuggestFieldTest.java index 23e8e24eac9..0fda8b4829d 100644 --- a/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/SuggestFieldTest.java +++ b/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/SuggestFieldTest.java @@ -325,9 +325,11 @@ public class SuggestFieldTest extends LuceneTestCase { QueryWrapperFilter filterWrapper = new QueryWrapperFilter(NumericRangeQuery.newIntRange("filter_int_fld", 0, topScore, true, true)); Filter filter = randomAccessFilter(filterWrapper); // if at most half of the top scoring documents have been filtered out - // the search should be admissible - TopSuggestDocs suggest = indexSearcher.suggest("suggest_field", "abc_", 1, filter); - assertSuggestions(suggest, new Entry("abc_" + topScore, topScore)); + // the search should be admissible for a single segment + TopSuggestDocs suggest = indexSearcher.suggest("suggest_field", "abc_", num, filter); + assertTrue(suggest.totalHits >= 1); + assertThat(suggest.scoreLookupDocs()[0].key.toString(), equalTo("abc_" + topScore)); + assertThat(suggest.scoreLookupDocs()[0].score, equalTo((float) topScore)); filterWrapper = new QueryWrapperFilter(NumericRangeQuery.newIntRange("filter_int_fld", 0, 0, true, true)); filter = randomAccessFilter(filterWrapper);