Skip to content

Commit

Permalink
add warning for field-based model with only 1 field
Browse files Browse the repository at this point in the history
  • Loading branch information
cmacdonald committed Oct 17, 2023
1 parent 67315fa commit 193a425
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
public class PerFieldNormWeightingModel extends WeightingModel {

private static final long serialVersionUID = 1L;
protected static final Logger logger = LoggerFactory.getLogger(PerFieldNormWeightingModel.class);

protected String[] params;
protected BasicModel basicModel;
Expand Down Expand Up @@ -149,7 +150,10 @@ public void setCollectionStatistics(CollectionStatistics _cs)
super.setCollectionStatistics(_cs);
fieldCount = _cs.getNumberOfFields();
WeightingModelLibrary.checkForFields(_cs);

if (fieldCount == 1) {
logger.warn("Weighting model " + this.getClass().getSimpleName() + " is invoked on an index with only 1 field - this is probably incorrect.");
}

basicModel.setNumberOfDocuments(_cs.getNumberOfDocuments());
basicModel.setNumberOfTokens(_cs.getNumberOfTokens());

Expand Down

0 comments on commit 193a425

Please sign in to comment.