Skip to content

Commit

Permalink
Merge pull request #29726 from vespa-engine/balder/minor-cleanup-afte…
Browse files Browse the repository at this point in the history
…r-reading-code

Balder/minor cleanup after reading code
  • Loading branch information
Harald Musum authored Dec 21, 2023
2 parents 5672549 + 2a09174 commit d73a4b8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public interface ModelContext {
* - Remove all flag data files from hosted-feature-flag repository
*/
interface FeatureFlags {
@ModelFeatureFlag(owners = {"baldersheim"}, comment = "Revisit in May or June 2023") default double defaultTermwiseLimit() { throw new UnsupportedOperationException("TODO specify default value"); }
@ModelFeatureFlag(owners = {"baldersheim"}, comment = "Revisit in May or June 2024") default double defaultTermwiseLimit() { throw new UnsupportedOperationException("TODO specify default value"); }
@ModelFeatureFlag(owners = {"baldersheim"}, comment = "Select sequencer type use while feeding") default String feedSequencerType() { return "THROUGHPUT"; }
@ModelFeatureFlag(owners = {"baldersheim"}) default String responseSequencerType() { throw new UnsupportedOperationException("TODO specify default value"); }
@ModelFeatureFlag(owners = {"baldersheim"}) default String queryDispatchPolicy() { return "adaptive"; }
Expand Down Expand Up @@ -116,9 +116,9 @@ interface FeatureFlags {
@ModelFeatureFlag(owners = {"vekterli"}) default long mergingMaxMemoryUsagePerNode() { return -1; }
@ModelFeatureFlag(owners = {"vekterli"}) default boolean usePerDocumentThrottledDeleteBucket() { return false; }
@ModelFeatureFlag(owners = {"baldersheim"}) default boolean alwaysMarkPhraseExpensive() { return false; }
@ModelFeatureFlag(owners = {"baldersheim"}) default boolean createPostinglistWhenNonStrict() { return true; }
@ModelFeatureFlag(owners = {"baldersheim"}) default boolean useEstimateForFetchPostings() { return false; }
@ModelFeatureFlag(owners = {"baldersheim"}) default boolean useThreadBundleForFetchPostings() { return false; }
@ModelFeatureFlag(owners = {"baldersheim"}, removeAfter = "8.278") default boolean createPostinglistWhenNonStrict() { return true; }
@ModelFeatureFlag(owners = {"baldersheim"}, removeAfter = "8.278") default boolean useEstimateForFetchPostings() { return true; }
@ModelFeatureFlag(owners = {"baldersheim"}, removeAfter = "8.278") default boolean useThreadBundleForFetchPostings() { return true; }
@ModelFeatureFlag(owners = {"hmusum"}) default boolean restartOnDeployWhenOnnxModelChanges() { return false; }
@ModelFeatureFlag(owners = {"baldersheim"}) default boolean sortBlueprintsByCost() { return false; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,6 @@ private static class Deriver {
private final double rankScoreDropLimit;
private final boolean sortBlueprintsByCost;
private final boolean alwaysMarkPhraseExpensive;
private final boolean createPostinglistWhenNonStrict;
private final boolean useEstimateForFetchPostings;
private final boolean useThreadBundleForFetchPostings;

/**
* The rank type definitions used to derive settings for the native rank features
Expand Down Expand Up @@ -218,9 +215,6 @@ private static class Deriver {
termwiseLimit = compiled.getTermwiseLimit().orElse(deployProperties.featureFlags().defaultTermwiseLimit());
sortBlueprintsByCost = deployProperties.featureFlags().sortBlueprintsByCost();
alwaysMarkPhraseExpensive = deployProperties.featureFlags().alwaysMarkPhraseExpensive();
createPostinglistWhenNonStrict = deployProperties.featureFlags().createPostinglistWhenNonStrict();
useEstimateForFetchPostings = deployProperties.featureFlags().useEstimateForFetchPostings();
useThreadBundleForFetchPostings = deployProperties.featureFlags().useThreadBundleForFetchPostings();
postFilterThreshold = compiled.getPostFilterThreshold();
approximateThreshold = compiled.getApproximateThreshold();
targetHitsMaxAdjustmentFactor = compiled.getTargetHitsMaxAdjustmentFactor();
Expand Down Expand Up @@ -477,15 +471,6 @@ else if (RankingExpression.propertyName(RankProfile.GLOBAL_PHASE).equals(propert
if (alwaysMarkPhraseExpensive) {
properties.add(new Pair<>("vespa.matching.always_mark_phrase_expensive", String.valueOf(alwaysMarkPhraseExpensive)));
}
if ( ! createPostinglistWhenNonStrict) {
properties.add(new Pair<>("vespa.matching.create_postinglist_when_non_strict", String.valueOf(createPostinglistWhenNonStrict)));
}
if (useEstimateForFetchPostings) {
properties.add(new Pair<>("vespa.matching.use_estimate_for_fetch_postings", String.valueOf(useEstimateForFetchPostings)));
}
if (useThreadBundleForFetchPostings) {
properties.add(new Pair<>("vespa.matching.use_thread_bundle_for_fetch_postings", String.valueOf(useThreadBundleForFetchPostings)));
}
if (postFilterThreshold.isPresent()) {
properties.add(new Pair<>("vespa.matching.global_filter.upper_limit", String.valueOf(postFilterThreshold.getAsDouble())));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,6 @@ public static class FeatureFlags implements ModelContext.FeatureFlags {
private final String summaryDecodePolicy;
private boolean sortBlueprintsByCost;
private final boolean alwaysMarkPhraseExpensive;
private final boolean createPostinglistWhenNonStrict;
private final boolean useEstimateForFetchPostings;
private final boolean useThreadBundleForFetchPostings;
private final int contentLayerMetadataFeatureLevel;
private final boolean dynamicHeapSize;
private final String unknownConfigDefinition;
Expand Down Expand Up @@ -257,9 +254,6 @@ public FeatureFlags(FlagSource source, ApplicationId appId, Version version) {
this.mergingMaxMemoryUsagePerNode = flagValue(source, appId, version, Flags.MERGING_MAX_MEMORY_USAGE_PER_NODE);
this.usePerDocumentThrottledDeleteBucket = flagValue(source, appId, version, Flags.USE_PER_DOCUMENT_THROTTLED_DELETE_BUCKET);
this.alwaysMarkPhraseExpensive = flagValue(source, appId, version, Flags.ALWAYS_MARK_PHRASE_EXPENSIVE);
this.createPostinglistWhenNonStrict = flagValue(source, appId, version, Flags.CREATE_POSTINGLIST_WHEN_NON_STRICT);
this.useEstimateForFetchPostings = flagValue(source, appId, version, Flags.USE_ESTIMATE_FOR_FETCH_POSTINGS);
this.useThreadBundleForFetchPostings = flagValue(source, appId, version, Flags.USE_THREAD_BUNDLE_FOR_FETCH_POSTINGS);
this.restartOnDeployWhenOnnxModelChanges = flagValue(source, appId, version, Flags.RESTART_ON_DEPLOY_WHEN_ONNX_MODEL_CHANGES);
this.sortBlueprintsByCost = flagValue(source, appId, version, Flags.SORT_BLUEPRINTS_BY_COST);
}
Expand Down Expand Up @@ -308,9 +302,6 @@ public FeatureFlags(FlagSource source, ApplicationId appId, Version version) {
return defVal;
}
@Override public boolean alwaysMarkPhraseExpensive() { return alwaysMarkPhraseExpensive; }
@Override public boolean createPostinglistWhenNonStrict() { return createPostinglistWhenNonStrict; }
@Override public boolean useEstimateForFetchPostings() { return useEstimateForFetchPostings; }
@Override public boolean useThreadBundleForFetchPostings() { return useThreadBundleForFetchPostings; }
@Override public int contentLayerMetadataFeatureLevel() { return contentLayerMetadataFeatureLevel; }
@Override public boolean dynamicHeapSize() { return dynamicHeapSize; }
@Override public String unknownConfigDefinition() { return unknownConfigDefinition; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private void normalizeAlternatives(Language language, Session indexFacts, WordAl
List<Alternative> terms = block.getAlternatives();
for (Alternative term : terms) {
String accentDropped = linguistics.getTransformer().accentDrop(term.word, language);
if ( ! term.word.equals(accentDropped) && accentDropped.length() > 0)
if ( ! term.word.equals(accentDropped) && !accentDropped.isEmpty())
block.addTerm(accentDropped, term.exactness * .7d);
}
}
Expand All @@ -144,15 +144,14 @@ private Item normalizePhrase(Language language, IndexFacts.Session indexFacts, P
}

private void normalizeWord(Language language, IndexFacts.Session indexFacts, TermItem term, ListIterator<Item> i) {
if ( ! (term instanceof WordItem)) return;
if ( ! (term instanceof WordItem word)) return;
if ( ! term.isNormalizable()) return;
Index index = indexFacts.getIndex(term.getIndexName());
if (index.isAttribute()) return;
if ( ! index.getNormalize()) return;

WordItem word = (WordItem) term;
String accentDropped = linguistics.getTransformer().accentDrop(word.getWord(), language);
if (accentDropped.length() == 0)
if (accentDropped.isEmpty())
i.remove();
else
word.setWord(accentDropped);
Expand Down
23 changes: 1 addition & 22 deletions flags/src/main/java/com/yahoo/vespa/flags/Flags.java
Original file line number Diff line number Diff line change
Expand Up @@ -334,32 +334,11 @@ public class Flags {

public static final UnboundBooleanFlag ALWAYS_MARK_PHRASE_EXPENSIVE = defineFeatureFlag(
"always-mark-phrase-expensive", false,
List.of("baldersheim"), "2023-11-20", "2023-12-31",
List.of("baldersheim"), "2023-11-20", "2024-02-29",
"If true all phrases will be marked expensive, independent of parents",
"Takes effect at redeployment",
INSTANCE_ID);

public static final UnboundBooleanFlag CREATE_POSTINGLIST_WHEN_NON_STRICT = defineFeatureFlag(
"create-postinglist-when-non-strict", true,
List.of("baldersheim"), "2023-12-04", "2024-01-31",
"If true posting list can be created on the fly also for non-strict iterators",
"Takes effect at redeployment",
INSTANCE_ID);

public static final UnboundBooleanFlag USE_ESTIMATE_FOR_FETCH_POSTINGS = defineFeatureFlag(
"use-estimate-for-fetch-postings", true,
List.of("baldersheim"), "2023-12-06", "2024-01-31",
"If true an estimate assuming uncorrelated query terms is used in Blueprint::fetchPostings",
"Takes effect at redeployment",
INSTANCE_ID);

public static final UnboundBooleanFlag USE_THREAD_BUNDLE_FOR_FETCH_POSTINGS = defineFeatureFlag(
"use-thread-bundle-for-fetch-postings", true,
List.of("baldersheim"), "2023-12-06", "2024-01-31",
"If true the query thread bundle is used for Blueprint::fetchPostings",
"Takes effect at redeployment",
INSTANCE_ID);

public static final UnboundBooleanFlag WRITE_CONFIG_SERVER_SESSION_DATA_AS_ONE_BLOB = defineFeatureFlag(
"write-config-server-session-data-as-blob", false,
List.of("hmusum"), "2023-07-19", "2024-02-01",
Expand Down

0 comments on commit d73a4b8

Please sign in to comment.