|
@@ -35,19 +35,12 @@ public class LongScriptFieldDistanceFeatureQueryTests extends AbstractScriptFiel
|
|
|
protected LongScriptFieldDistanceFeatureQuery createTestInstance() {
|
|
|
long origin = randomLong();
|
|
|
long pivot = randomValueOtherThan(origin, ESTestCase::randomLong);
|
|
|
- return new LongScriptFieldDistanceFeatureQuery(randomScript(), leafFactory, randomAlphaOfLength(5), origin, pivot, randomFloat());
|
|
|
+ return new LongScriptFieldDistanceFeatureQuery(randomScript(), leafFactory, randomAlphaOfLength(5), origin, pivot);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
protected LongScriptFieldDistanceFeatureQuery copy(LongScriptFieldDistanceFeatureQuery orig) {
|
|
|
- return new LongScriptFieldDistanceFeatureQuery(
|
|
|
- orig.script(),
|
|
|
- leafFactory,
|
|
|
- orig.fieldName(),
|
|
|
- orig.origin(),
|
|
|
- orig.pivot(),
|
|
|
- orig.boost()
|
|
|
- );
|
|
|
+ return new LongScriptFieldDistanceFeatureQuery(orig.script(), leafFactory, orig.fieldName(), orig.origin(), orig.pivot());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -56,8 +49,7 @@ public class LongScriptFieldDistanceFeatureQueryTests extends AbstractScriptFiel
|
|
|
String fieldName = orig.fieldName();
|
|
|
long origin = orig.origin();
|
|
|
long pivot = orig.pivot();
|
|
|
- float boost = orig.boost();
|
|
|
- switch (randomInt(4)) {
|
|
|
+ switch (randomInt(3)) {
|
|
|
case 0:
|
|
|
script = randomValueOtherThan(script, this::randomScript);
|
|
|
break;
|
|
@@ -70,13 +62,10 @@ public class LongScriptFieldDistanceFeatureQueryTests extends AbstractScriptFiel
|
|
|
case 3:
|
|
|
pivot = randomValueOtherThan(origin, () -> randomValueOtherThan(orig.pivot(), ESTestCase::randomLong));
|
|
|
break;
|
|
|
- case 4:
|
|
|
- boost = randomValueOtherThan(boost, ESTestCase::randomFloat);
|
|
|
- break;
|
|
|
default:
|
|
|
fail();
|
|
|
}
|
|
|
- return new LongScriptFieldDistanceFeatureQuery(script, leafFactory, fieldName, origin, pivot, boost);
|
|
|
+ return new LongScriptFieldDistanceFeatureQuery(script, leafFactory, fieldName, origin, pivot);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -105,12 +94,13 @@ public class LongScriptFieldDistanceFeatureQueryTests extends AbstractScriptFiel
|
|
|
leafFactory,
|
|
|
"test",
|
|
|
1595432181351L,
|
|
|
- 6L,
|
|
|
- between(1, 100)
|
|
|
+ 3L
|
|
|
);
|
|
|
- TopDocs td = searcher.search(query, 1);
|
|
|
- assertThat(td.scoreDocs[0].score, equalTo(query.boost()));
|
|
|
+ TopDocs td = searcher.search(query, 2);
|
|
|
+ assertThat(td.scoreDocs[0].score, equalTo(1.0f));
|
|
|
assertThat(td.scoreDocs[0].doc, equalTo(1));
|
|
|
+ assertThat(td.scoreDocs[1].score, equalTo(.5f));
|
|
|
+ assertThat(td.scoreDocs[1].doc, equalTo(0));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -124,7 +114,7 @@ public class LongScriptFieldDistanceFeatureQueryTests extends AbstractScriptFiel
|
|
|
float boost = randomFloat();
|
|
|
assertThat(
|
|
|
query.createWeight(searcher, ScoreMode.COMPLETE, boost).scorer(reader.leaves().get(0)).getMaxScore(randomInt()),
|
|
|
- equalTo(query.boost() * boost)
|
|
|
+ equalTo(boost)
|
|
|
);
|
|
|
}
|
|
|
}
|
|
@@ -134,9 +124,7 @@ public class LongScriptFieldDistanceFeatureQueryTests extends AbstractScriptFiel
|
|
|
protected void assertToString(LongScriptFieldDistanceFeatureQuery query) {
|
|
|
assertThat(
|
|
|
query.toString(query.fieldName()),
|
|
|
- equalTo(
|
|
|
- "LongScriptFieldDistanceFeatureQuery(origin=" + query.origin() + ",pivot=" + query.pivot() + ",boost=" + query.boost() + ")"
|
|
|
- )
|
|
|
+ equalTo("LongScriptFieldDistanceFeatureQuery(origin=" + query.origin() + ",pivot=" + query.pivot() + ")")
|
|
|
);
|
|
|
}
|
|
|
|