Skip to content

Commit

Permalink
update code comments with examples
Browse files Browse the repository at this point in the history
  • Loading branch information
apmoriarty committed Jul 1, 2024
1 parent de71600 commit 82776c4
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,16 @@ public Set<String>[] fieldsAndTerms(Set<String> termFrequencyFields, Set<String>

if (arg instanceof ASTNumberLiteral || arg instanceof ASTUnaryMinusNode) {
// if the first argument is a number, then no field exists
// for example, content:scoredPhrase(-1.5, termOffsetMap, 'value')
termOffsetMap = args.next();
} else {
if (arg instanceof ASTIdentifier) {
// single field case
// for example, content:scoredPhrase(FIELD, -1.5, termOffsetMap, 'value')
fields = Collections.singleton(String.valueOf(JexlASTHelper.getIdentifier(arg)));
} else {
// multi field case
// for example, content:scoredPhrase((FIELD_A || FIELD_B), -1.5, termOffsetMap, 'value')
Set<String> identifiers = JexlASTHelper.getIdentifierNames(arg);
if (!identifiers.isEmpty()) {
fields = identifiers;
Expand All @@ -321,7 +324,7 @@ public Set<String>[] fieldsAndTerms(Set<String> termFrequencyFields, Set<String>
}
}

// skip score
// skip score because it is not needed when gathering just the fields and values from a function
args.next();

termOffsetMap = args.next();
Expand Down

0 comments on commit 82776c4

Please sign in to comment.