diff options
author | Jon Bratseth <bratseth@yahoo-inc.com> | 2017-04-26 10:04:22 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@yahoo-inc.com> | 2017-04-26 10:04:22 +0200 |
commit | b11644c35d1408cea4e211f24e2473e9c3f5b9c7 (patch) | |
tree | 1282264dcdd46b9cddcbed58ffd6aa5eafa1fc0c /container-search | |
parent | 4e988bedc4071b52b228cc54c215999ff37d6b49 (diff) |
Correct heuristic for urls
Diffstat (limited to 'container-search')
-rw-r--r-- | container-search/src/main/java/com/yahoo/prelude/query/parser/Tokenizer.java | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/query/parser/Tokenizer.java b/container-search/src/main/java/com/yahoo/prelude/query/parser/Tokenizer.java index 9ce98055335..f20ea91b088 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/parser/Tokenizer.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/parser/Tokenizer.java @@ -166,24 +166,20 @@ public final class Tokenizer { return tokens; } - @SuppressWarnings("fallthrough") private boolean acceptApostropheAsWordCharacter(Index currentIndex) { - if (!(currentIndex.isUriIndex() || currentIndex.isHostIndex())) { + if ( ! (currentIndex.isUriIndex() || currentIndex.isHostIndex())) { return true; } // this is a heuristic to check whether we probably have reached the end of an URL element for (int i = tokens.size() - 1; i >= 0; --i) { - Token lookAt = tokens.get(i); - switch (lookAt.kind) { - case COLON: - if (i == indexLastExplicitlyChangedAt) { - return false; - } - // XXX was fallthrough intended here? - case SPACE: - return true; - default: - // do nothing + switch (tokens.get(i).kind) { + case COLON: + if (i == indexLastExplicitlyChangedAt) return false; + break; + case SPACE: + return true; + default: + // do nothing } } // really not sure whether we should choose false instead, on cause of the guard at |