Skip to content

Commit

Permalink
Update tests and checkstyle
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Carbonetto <andrewc@bitquilltech.com>
  • Loading branch information
acarbonetto committed Apr 6, 2023
1 parent ccdc290 commit 05c42f7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,31 +128,22 @@ public Iterator<ExprValue> iterator() {
ImmutableMap.Builder<String, ExprValue> builder = new ImmutableMap.Builder<>();
builder.putAll(docData.tupleValue());
metaDataFieldSet.forEach(metaDataField -> {
switch (metaDataField) {
case METADATA_FIELD_INDEX:
builder.put(METADATA_FIELD_INDEX, new ExprStringValue(hit.getIndex()));
break;
case METADATA_FIELD_ID:
builder.put(METADATA_FIELD_ID, new ExprStringValue(hit.getId()));
break;
case METADATA_FIELD_SCORE:
if (!Float.isNaN(hit.getScore())) {
builder.put(METADATA_FIELD_SCORE, new ExprFloatValue(hit.getScore()));
}
break;
case METADATA_FIELD_MAXSCORE:
if (maxScore != null) {
builder.put(METADATA_FIELD_MAXSCORE, maxScore);
}
break;
case METADATA_FIELD_SORT:
builder.put(METADATA_FIELD_SORT, new ExprLongValue(hit.getSeqNo()));
break;
default:
// no-op
}
if (metaDataField.equals(METADATA_FIELD_INDEX)) {
builder.put(METADATA_FIELD_INDEX, new ExprStringValue(hit.getIndex()));
} else if (metaDataField.equals(METADATA_FIELD_ID)) {
builder.put(METADATA_FIELD_ID, new ExprStringValue(hit.getId()));
} else if (metaDataField.equals(METADATA_FIELD_SCORE)) {
if (!Float.isNaN(hit.getScore())) {
builder.put(METADATA_FIELD_SCORE, new ExprFloatValue(hit.getScore()));
}
);
} else if (metaDataField.equals(METADATA_FIELD_MAXSCORE)) {
if (maxScore != null) {
builder.put(METADATA_FIELD_MAXSCORE, maxScore);
}
} else { // if (metaDataField.equals(METADATA_FIELD_SORT)) {
builder.put(METADATA_FIELD_SORT, new ExprLongValue(hit.getSeqNo()));
}
});

if (!hit.getHighlightFields().isEmpty()) {
var hlBuilder = ImmutableMap.<String, ExprValue>builder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ void iterator_metafields() {
"id1", new ExprIntegerValue(1),
"_index", new ExprStringValue("testIndex"),
"_id", new ExprStringValue("testId"),
"_sort", new ExprLongValue(123456L),
"_score", new ExprFloatValue(3.75F),
"_maxscore", new ExprFloatValue(3.75F),
"_sort", new ExprLongValue(123456L)
"_maxscore", new ExprFloatValue(3.75F)
));
List includes = List.of("id1", "_index", "_id", "_sort", "_score", "_maxscore");
int i = 0;
Expand Down

0 comments on commit 05c42f7

Please sign in to comment.