/** Set the default weighting model to be used for terms that do NOT have an explicit WeightingModel set. */ public void setDefaultTermWeightingModel(WeightingModel weightingModel) { defaultWeightingModel = weightingModel; for(Map.Entry<Operator, QueryTermProperties> e : this) { if (e.getValue().termModels.size() == 0) e.getValue().termModels.add(weightingModel.clone()); } }
/** Set the default weighting model to be used for terms that do NOT have an explicit WeightingModel set. */ public void setDefaultTermWeightingModel(WeightingModel weightingModel) { defaultWeightingModel = weightingModel; for(Map.Entry<Operator, QueryTermProperties> e : this) { if (e.getValue().termModels.size() == 0) e.getValue().termModels.add(weightingModel.clone()); } }
@Override public QueryTermProperties clone() { QueryTermProperties newO = new QueryTermProperties(index, weight, stats); for (WeightingModel model : termModels) newO.termModels.add((WeightingModel)(model.clone())); newO.tags = new HashSet<>(tags); newO.required = required; return newO; }
@Override public QueryTermProperties clone() { QueryTermProperties newO = new QueryTermProperties(index, weight, stats); for (WeightingModel model : termModels) newO.termModels.add((WeightingModel)(model.clone())); newO.tags = new HashSet<>(tags); newO.required = required; return newO; }
@Override public PerFieldNormWeightingModel clone() { PerFieldNormWeightingModel rtr = (PerFieldNormWeightingModel) super.clone(); rtr.basicModel = (BasicModel) this.basicModel.clone(); rtr.params = Arrays.copyOf(this.params, this.params.length); if (fieldGlobalFrequencies != null) rtr.fieldGlobalFrequencies = Arrays.copyOf(fieldGlobalFrequencies, this.fieldCount); if (fieldWeights != null) rtr.fieldWeights = Arrays.copyOf(fieldWeights, this.fieldCount); if (fieldNormalisations != null) rtr.fieldNormalisations = new Normalisation[this.fieldCount]; for(int fi=0;fi<fieldCount;fi++) rtr.fieldNormalisations[fi] = fieldNormalisations[fi].clone(); return rtr; }
@Override public PerFieldNormWeightingModel clone() { PerFieldNormWeightingModel rtr = (PerFieldNormWeightingModel) super.clone(); rtr.basicModel = (BasicModel) this.basicModel.clone(); rtr.params = Arrays.copyOf(this.params, this.params.length); if (fieldGlobalFrequencies != null) rtr.fieldGlobalFrequencies = Arrays.copyOf(fieldGlobalFrequencies, this.fieldCount); if (fieldWeights != null) rtr.fieldWeights = Arrays.copyOf(fieldWeights, this.fieldCount); if (fieldNormalisations != null) rtr.fieldNormalisations = new Normalisation[this.fieldCount]; for(int fi=0;fi<fieldCount;fi++) rtr.fieldNormalisations[fi] = fieldNormalisations[fi].clone(); return rtr; }
@Override public DFRWeightingModel clone() { DFRWeightingModel rtr = (DFRWeightingModel) super.clone(); rtr.basicModel = (BasicModel) this.basicModel.clone(); rtr.afterEffect = (AfterEffect) this.afterEffect.clone(); rtr.normalisation = (Normalisation) this.normalisation.clone(); return rtr; }
@Override public DFRWeightingModel clone() { DFRWeightingModel rtr = (DFRWeightingModel) super.clone(); rtr.basicModel = (BasicModel) this.basicModel.clone(); rtr.afterEffect = (AfterEffect) this.afterEffect.clone(); rtr.normalisation = (Normalisation) this.normalisation.clone(); return rtr; }
/** Performs a deep clone of this object, and all objects it contains. This allows a MQT to be copied, * and changed without affecting the original object. */ public MatchingQueryTerms clone() { MatchingQueryTerms newMQT = new MatchingQueryTerms(this.queryId); //copy queryID, Strings are immutable //clone query term properties for (Map.Entry<Operator, QueryTermProperties> e : this) { newMQT.add(new MatchingTerm(e.getKey().clone(), e.getValue().clone())); } for (DocumentScoreModifier dsm : docScoreModifiers) { newMQT.docScoreModifiers.add( (DocumentScoreModifier)(dsm.clone())); } //clone query if (this.query != null) newMQT.query = (Query)this.query.clone(); if (this.defaultWeightingModel != null) newMQT.defaultWeightingModel = this.defaultWeightingModel.clone(); //newMQT.matchOnTags = new HashSet<>(this.matchOnTags); newMQT.queryId = this.queryId; return newMQT; }
/** Performs a deep clone of this object, and all objects it contains. This allows a MQT to be copied, * and changed without affecting the original object. */ public MatchingQueryTerms clone() { MatchingQueryTerms newMQT = new MatchingQueryTerms(this.queryId); //copy queryID, Strings are immutable //clone query term properties for (Map.Entry<Operator, QueryTermProperties> e : this) { newMQT.add(new MatchingTerm(e.getKey().clone(), e.getValue().clone())); } for (DocumentScoreModifier dsm : docScoreModifiers) { newMQT.docScoreModifiers.add( (DocumentScoreModifier)(dsm.clone())); } //clone query if (this.query != null) newMQT.query = (Query)this.query.clone(); if (this.defaultWeightingModel != null) newMQT.defaultWeightingModel = this.defaultWeightingModel.clone(); //newMQT.matchOnTags = new HashSet<>(this.matchOnTags); newMQT.queryId = this.queryId; return newMQT; }