[TEST] consistently omit norms in test otherwise scoring will be dependent on merges etc.

This commit is contained in:
Simon Willnauer 2014-06-16 10:50:17 +02:00
parent 06192686a2
commit 76fab9d42a
1 changed files with 3 additions and 2 deletions

View File

@ -108,14 +108,15 @@ public class BlendedTermQueryTest extends ElasticsearchLuceneTestCase {
String[] song = new String[]{ String[] song = new String[]{
"generator", "foo fighers - generator", "foo fighters generator" "generator", "foo fighers - generator", "foo fighters generator"
}; };
final boolean omitNorms = random().nextBoolean();
FieldType ft = new FieldType(TextField.TYPE_NOT_STORED); FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
ft.setIndexOptions(random().nextBoolean() ? FieldInfo.IndexOptions.DOCS_ONLY : FieldInfo.IndexOptions.DOCS_AND_FREQS); ft.setIndexOptions(random().nextBoolean() ? FieldInfo.IndexOptions.DOCS_ONLY : FieldInfo.IndexOptions.DOCS_AND_FREQS);
ft.setOmitNorms(random().nextBoolean()); ft.setOmitNorms(omitNorms);
ft.freeze(); ft.freeze();
FieldType ft1 = new FieldType(TextField.TYPE_NOT_STORED); FieldType ft1 = new FieldType(TextField.TYPE_NOT_STORED);
ft1.setIndexOptions(random().nextBoolean() ? FieldInfo.IndexOptions.DOCS_ONLY : FieldInfo.IndexOptions.DOCS_AND_FREQS); ft1.setIndexOptions(random().nextBoolean() ? FieldInfo.IndexOptions.DOCS_ONLY : FieldInfo.IndexOptions.DOCS_AND_FREQS);
ft1.setOmitNorms(random().nextBoolean()); ft1.setOmitNorms(omitNorms);
ft1.freeze(); ft1.freeze();
for (int i = 0; i < username.length; i++) { for (int i = 0; i < username.length; i++) {
Document d = new Document(); Document d = new Document();