diff options
author | Jon Bratseth <bratseth@verizonmedia.com> | 2019-08-26 12:44:11 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@verizonmedia.com> | 2019-08-26 12:44:11 +0200 |
commit | 072a47d3e0c9352add3e5a3cf9d6d7bd22ec04ff (patch) | |
tree | 18955c2a837c4cda1ba9c23e585c99ffc9523abb /container-search/src/main/java/com/yahoo/prelude/Index.java | |
parent | 1baf860bedd3b2193799ddd3a4a5b9dc50cb5c6a (diff) |
Support index-command phrase-segmenting
- Set connectivity to max between items in implicit phrases (always)
- Allow indexes to choose to represent implicit phrases by and in
legacy parsers by adding index-command: phrase-segmenting false
Diffstat (limited to 'container-search/src/main/java/com/yahoo/prelude/Index.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/prelude/Index.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/Index.java b/container-search/src/main/java/com/yahoo/prelude/Index.java index 8433939090b..245612d24bd 100644 --- a/container-search/src/main/java/com/yahoo/prelude/Index.java +++ b/container-search/src/main/java/com/yahoo/prelude/Index.java @@ -66,10 +66,16 @@ public class Index { private boolean numerical = false; private long predicateUpperBound = Long.MAX_VALUE; private long predicateLowerBound = Long.MIN_VALUE; + /** True if this is an <i>exact</i> index - which should match tokens containing any characters */ private boolean exact = false; + private boolean isNGram = false; - private int gramSize=2; + private int gramSize = 2; + + /** Whether implicit phrases should lead to a phrase item or an and item */ + private boolean phraseSegmenting = true; + /** The string terminating an exact token in this index, or null to use the default (space) */ private String exactTerminator = null; @@ -178,6 +184,10 @@ public class Index { setNumerical(true); } else if (commandString.startsWith("predicate-bounds ")) { setPredicateBounds(commandString.substring(17)); + } else if (commandString.startsWith("phrase-segmenting ")) { + setPhraseSegmenting(true); + } else if (commandString.startsWith("phrase-segmenting ")) { + setPhraseSegmenting(Boolean.parseBoolean(commandString.substring("phrase-segmenting ".length()))); } else { commands.add(commandString); } @@ -307,6 +317,10 @@ public class Index { public long getPredicateLowerBound() { return predicateLowerBound; } + public boolean getPhraseSegmenting() { return phraseSegmenting; } + + public boolean setPhraseSegmenting(boolean phraseSegmenting) { return this.phraseSegmenting = phraseSegmenting; } + /** Returns all the literal command strings given as arguments to addCommand in this instance */ public List<String> allCommands() { return allCommands; } |