Fix typos and minor refactoring to FacetConfig (#982)

This commit is contained in:
Shai Erera 2022-06-27 07:34:21 +03:00 committed by GitHub
parent ef486ea11a
commit 9338909373
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 20 deletions

View File

@ -66,7 +66,7 @@ public abstract class Scorable {
}
/**
* A child Scorer and its relationship to its parent. the meaning of the relationship depends upon
* A child Scorer and its relationship to its parent. The meaning of the relationship depends upon
* the parent query.
*
* @lucene.experimental
@ -80,7 +80,7 @@ public abstract class Scorable {
/**
* Creates a new ChildScorer node with the specified relationship.
*
* <p>The relationship can be any be any string that makes sense to the parent Scorer.
* <p>The relationship can be any string that makes sense to the parent Scorer.
*/
public ChildScorable(Scorable child, String relationship) {
this.child = child;

View File

@ -91,7 +91,7 @@ public abstract class TopFieldCollector extends TopDocsCollector<Entry> {
boolean thresholdCheck(int doc) throws IOException {
if (collectedAllCompetitiveHits || reverseMul * comparator.compareBottom(doc) <= 0) {
// since docs are visited in doc Id order, if compare is 0, it means
// this document is largest than anything else in the queue, and
// this document is larger than anything else in the queue, and
// therefore not competitive.
if (searchSortPartOfIndexSort) {
if (hitsThresholdChecker.isThresholdReached()) {

View File

@ -276,11 +276,7 @@ public class FacetsConfig {
checkSeen(seenDims, facetField.dim);
}
String indexFieldName = dimConfig.indexFieldName;
List<FacetField> fields = byField.get(indexFieldName);
if (fields == null) {
fields = new ArrayList<>();
byField.put(indexFieldName, fields);
}
List<FacetField> fields = byField.computeIfAbsent(indexFieldName, k -> new ArrayList<>());
fields.add(facetField);
}
@ -291,11 +287,8 @@ public class FacetsConfig {
checkSeen(seenDims, facetField.dim);
}
String indexFieldName = dimConfig.indexFieldName;
List<SortedSetDocValuesFacetField> fields = dvByField.get(indexFieldName);
if (fields == null) {
fields = new ArrayList<>();
dvByField.put(indexFieldName, fields);
}
List<SortedSetDocValuesFacetField> fields =
dvByField.computeIfAbsent(indexFieldName, k -> new ArrayList<>());
fields.add(facetField);
}
@ -315,11 +308,8 @@ public class FacetsConfig {
}
String indexFieldName = dimConfig.indexFieldName;
List<AssociationFacetField> fields = assocByField.get(indexFieldName);
if (fields == null) {
fields = new ArrayList<>();
assocByField.put(indexFieldName, fields);
}
List<AssociationFacetField> fields =
assocByField.computeIfAbsent(indexFieldName, k -> new ArrayList<>());
fields.add(facetField);
// Best effort: detect mis-matched types in same
@ -338,7 +328,7 @@ public class FacetsConfig {
assocDimTypes.put(indexFieldName, type);
} else if (!curType.equals(type)) {
throw new IllegalArgumentException(
"mixing incompatible types of AssocationFacetField ("
"mixing incompatible types of AssociationFacetField ("
+ curType
+ " and "
+ type
@ -632,6 +622,6 @@ public class FacetsConfig {
}
parts.add(new String(buffer, 0, upto));
assert !lastEscape;
return parts.toArray(new String[parts.size()]);
return parts.toArray(new String[0]);
}
}