Skip to content

Commit

Permalink
Ignoring _version_ field for glob patterns on export since we typical…
Browse files Browse the repository at this point in the history
…ly do not want that returned unless specifically added as an fl param (#98)

* Ignoring _version_ field for glob patterns on export since we typically do not want that returned unless specifically added as an fl param

* Using CommonParams property and adding test

* Tidying code

* Fixing message for test
  • Loading branch information
Justin Sweeney committed May 5, 2023
1 parent 37b8b2e commit dd11bb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,10 @@ private void getGlobFields(
Set<String> fieldsProcessed,
List<SchemaField> expandedFields) {
for (FieldInfo fi : searcher.getFieldInfos()) {
if (CommonParams.VERSION_FIELD.equals(fi.getName())) {
// Ignore _version_ unless specified
continue;
}
if (FilenameUtils.wildcardMatch(fi.getName(), fieldPattern)) {
SchemaField schemaField = searcher.getSchema().getField(fi.getName());
if (fieldsProcessed.add(fi.getName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,8 @@ public void testGlobFields() throws Exception {
assertFalse(
"Fields without docvalues and useDocValuesAsStored should not be returned",
jq.contains("\"sortabledv\""));
assertFalse(
"_version_ should not be returned as part all fields", jq.contains("\"_version_\""));
}

@SuppressWarnings("rawtypes")
Expand Down

0 comments on commit dd11bb5

Please sign in to comment.