diff options
Diffstat (limited to 'container-search')
8 files changed, 56 insertions, 57 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/hitfield/AnnotateStringFieldPart.java b/container-search/src/main/java/com/yahoo/prelude/hitfield/AnnotateStringFieldPart.java index f1b91ab5b72..e61d2ad8af5 100644 --- a/container-search/src/main/java/com/yahoo/prelude/hitfield/AnnotateStringFieldPart.java +++ b/container-search/src/main/java/com/yahoo/prelude/hitfield/AnnotateStringFieldPart.java @@ -1,7 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.prelude.hitfield; -/** TODO: Class header! */ public class AnnotateStringFieldPart implements FieldPart { public static final char RAW_ANNOTATE_BEGIN_CHAR = '\uFFF9'; diff --git a/container-search/src/main/java/com/yahoo/prelude/hitfield/HitField.java b/container-search/src/main/java/com/yahoo/prelude/hitfield/HitField.java index fd8648b758a..e81a6653b08 100644 --- a/container-search/src/main/java/com/yahoo/prelude/hitfield/HitField.java +++ b/container-search/src/main/java/com/yahoo/prelude/hitfield/HitField.java @@ -29,65 +29,48 @@ public class HitField { private Object original; - /** - * @param f The field name - * @param c The field content - */ - public HitField(String f, String c) { - this(f, c, c.indexOf(JuniperSearcher.RAW_HIGHLIGHT_CHAR) > -1); + public HitField(String fieldName, String content) { + this(fieldName, content, content.indexOf(JuniperSearcher.RAW_HIGHLIGHT_CHAR) > -1); } - /** - * @param f The field name - * @param c The field content - */ - public HitField(String f, XMLString c) { - this(f, c, c.toString().indexOf(JuniperSearcher.RAW_HIGHLIGHT_CHAR) > -1); + public HitField(String fieldName, XMLString content) { + this(fieldName, content, content.toString().indexOf(JuniperSearcher.RAW_HIGHLIGHT_CHAR) > -1); } - /** - * @param f The field name - * @param c The field content - * @param cjk true if the content is CJK text - */ - public HitField(String f, String c, boolean cjk) { - this(f, c, cjk, false); + public HitField(String fieldName, String content, boolean cjk) { + this(fieldName, content, cjk, false); } /** - * @param f The field name - * @param c The field content + * Creates a hit field + * * @param cjk true if the content is CJK text */ - public HitField(String f, XMLString c, boolean cjk) { - this(f, c.toString(), cjk, true); + public HitField(String fieldName, XMLString content, boolean cjk) { + this(fieldName, content.toString(), cjk, true); } /** - * @param f The field name - * @param c The field content + * Creates a hit field + * + * @param fieldname The field name + * @param content The field content * @param cjk true if the content is CJK text * @param xmlProperty true if this should not quote XML syntax */ - public HitField(String f, String c, boolean cjk, boolean xmlProperty) { - name = f; - rawContent = c; - content = null; + public HitField(String fieldname, String content, boolean cjk, boolean xmlProperty) { + name = fieldname; + rawContent = content; + this.content = null; isCJK = cjk; this.xmlProperty = xmlProperty; } - /** - * @return the name of this field - */ public String getName() { return name; } - /** - * @return the raw/original content of this field - */ public String getRawContent() { return rawContent; } @@ -243,18 +226,13 @@ public class HitField { } return tokenizedContent; } - /** - * Return an iterator for the tokens, delimiters and markup elements - * of the field. - */ + /** Return an iterator for the tokens, delimiters and markup elements of the field. */ public ListIterator<FieldPart> listIterator() { return new FieldIterator(ensureTokenized(), this); } - /** - * Return an iterator for the tokens in the field - */ + /** Return an iterator over the tokens of this field */ public ListIterator<FieldPart> tokenIterator() { return new TokenFieldIterator(ensureTokenized(), this); diff --git a/container-search/src/main/java/com/yahoo/prelude/query/parser/AbstractParser.java b/container-search/src/main/java/com/yahoo/prelude/query/parser/AbstractParser.java index 1923fdbc50d..8297a566a72 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/parser/AbstractParser.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/parser/AbstractParser.java @@ -94,10 +94,10 @@ public abstract class AbstractParser implements CustomParser { } /** - * <p>Creates a new instance of this class, storing the given {@link ParserEnvironment} for parse-time access to the - * environment.</p> + * Creates a new instance of this class, storing the given {@link ParserEnvironment} for parse-time access to the + * environment. * - * @param environment The environment settings to attach to the Parser. + * @param environment the environment settings to attach to the Parser */ protected AbstractParser(ParserEnvironment environment) { this.environment = ParserEnvironment.fromParserEnvironment(environment); diff --git a/container-search/src/main/java/com/yahoo/prelude/query/parser/AdvancedParser.java b/container-search/src/main/java/com/yahoo/prelude/query/parser/AdvancedParser.java index 244d895f357..e3d1b280a5a 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/parser/AdvancedParser.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/parser/AdvancedParser.java @@ -11,7 +11,7 @@ import static com.yahoo.prelude.query.parser.Token.Kind.NUMBER; * Parser for queries of type advanced. * * @author Steinar Knutsen - * @deprecated since 5.11, YQL+ should be used for formal queries + * @deprecated YQL should be used for formal queries */ @Deprecated // DO NOT REMOVE (we'll keep this around longer) public class AdvancedParser extends StructuredParser { diff --git a/container-search/src/main/java/com/yahoo/prelude/query/parser/AllParser.java b/container-search/src/main/java/com/yahoo/prelude/query/parser/AllParser.java index 72ee4ae2c12..d9b969757c2 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/parser/AllParser.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/parser/AllParser.java @@ -1,7 +1,15 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.prelude.query.parser; -import com.yahoo.prelude.query.*; +import com.yahoo.prelude.query.AndItem; +import com.yahoo.prelude.query.IntItem; +import com.yahoo.prelude.query.Item; +import com.yahoo.prelude.query.NotItem; +import com.yahoo.prelude.query.NullItem; +import com.yahoo.prelude.query.OrItem; +import com.yahoo.prelude.query.PhraseItem; +import com.yahoo.prelude.query.QueryCanonicalizer; +import com.yahoo.prelude.query.RankItem; import com.yahoo.search.query.QueryTree; import com.yahoo.search.query.parser.ParserEnvironment; @@ -86,14 +94,14 @@ public class AllParser extends SimpleParser { return and; } - protected OrItem addOr(Item item,OrItem or) { + protected OrItem addOr(Item item, OrItem or) { if (or == null) or = new OrItem(); or.addItem(item); return or; } - protected NotItem addNot(Item item,NotItem not) { + protected NotItem addNot(Item item, NotItem not) { if (not == null) not = new NotItem(); not.addNegativeItem(item); @@ -129,9 +137,9 @@ public class AllParser extends SimpleParser { // Interpret -N as a positive item matching a negative number (by backtracking out of this) // but not if there is an explicit index (such as -a:b) // but interpret --N as a negative item matching a negative number - if ( item instanceof IntItem && - ((IntItem)item).getIndexName().isEmpty() && - ! ((IntItem)item).getNumber().startsWith(("-"))) + if (item instanceof IntItem && + ((IntItem)item).getIndexName().isEmpty() && + ! ((IntItem)item).getNumber().startsWith(("-"))) item = null; return item; diff --git a/container-search/src/main/java/com/yahoo/prelude/query/parser/AnyParser.java b/container-search/src/main/java/com/yahoo/prelude/query/parser/AnyParser.java index 9cb9f36b8a6..dd836e9c8e1 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/parser/AnyParser.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/parser/AnyParser.java @@ -3,7 +3,15 @@ package com.yahoo.prelude.query.parser; import com.yahoo.language.Language; import com.yahoo.prelude.IndexFacts; -import com.yahoo.prelude.query.*; +import com.yahoo.prelude.query.AndItem; +import com.yahoo.prelude.query.BlockItem; +import com.yahoo.prelude.query.CompositeItem; +import com.yahoo.prelude.query.Item; +import com.yahoo.prelude.query.NotItem; +import com.yahoo.prelude.query.OrItem; +import com.yahoo.prelude.query.PhraseItem; +import com.yahoo.prelude.query.RankItem; +import com.yahoo.prelude.query.TermItem; import com.yahoo.search.query.parser.ParserEnvironment; import java.util.Collections; diff --git a/container-search/src/main/java/com/yahoo/prelude/query/parser/CustomParser.java b/container-search/src/main/java/com/yahoo/prelude/query/parser/CustomParser.java index e57e06f6b12..91ccb4a5cca 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/parser/CustomParser.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/parser/CustomParser.java @@ -12,7 +12,6 @@ import java.util.Set; /** * @author Simon Thoresen Hult - * @since 5.1.4 */ public interface CustomParser extends Parser { diff --git a/container-search/src/main/java/com/yahoo/prelude/query/textualrepresentation/TextualQueryRepresentation.java b/container-search/src/main/java/com/yahoo/prelude/query/textualrepresentation/TextualQueryRepresentation.java index e299ccb5674..858a85aeaf4 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/textualrepresentation/TextualQueryRepresentation.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/textualrepresentation/TextualQueryRepresentation.java @@ -4,7 +4,13 @@ package com.yahoo.prelude.query.textualrepresentation; import com.yahoo.prelude.query.Item; import java.lang.reflect.Array; -import java.util.*; +import java.util.ArrayList; +import java.util.IdentityHashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; import java.util.regex.Pattern; /** @@ -21,6 +27,7 @@ public class TextualQueryRepresentation { /** Creates the textual representation for a single Item. */ private class ItemDiscloser implements Discloser { + private final Item item; final Map<String, Object> properties = new TreeMap<>(); @@ -57,7 +64,7 @@ public class TextualQueryRepresentation { StringBuilder builder = new StringBuilder(); builder.append(name); - if (!properties.isEmpty() || itemReferences.get(item) != null) { + if ( ! properties.isEmpty() || itemReferences.get(item) != null) { builder.append('['); addPropertiesString(builder); builder.append(']'); |