Package com.yahoo.search.query.parser
Class Parsable
java.lang.Object
com.yahoo.search.query.parser.Parsable
This class encapsulates all the parameters required to call Parser.parse(Parsable). Because all set-
methods return a reference to self, you can write very compact calls to the parser:
parser.parse(new Parsable()
.setQuery("foo")
.setFilter("bar")
.setDefaultIndexName("default")
.setLanguage(Language.ENGLISH))
In case you are parsing the content of a Model, you can use the fromQueryModel(Model) factory for
convenience.
- Author:
- Simon Thoresen Hult
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddRestrict(String restrictName) addRestricts(Collection<String> restrictNames) addSources(Collection<String> sourceNames) static ParsablefromQueryModel(Model model) Optional<com.yahoo.language.Language>Returns the language explicitly set to be used when parsing, or empty if none is set.com.yahoo.language.LanguageReturns the language to use when parsing, or null to decide during parsing.com.yahoo.language.LanguagegetOrDetectLanguage(String languageDetectionText) Returns the language to use when parsing, with a text to use for detection if necessary.getQuery()setDefaultIndexName(String defaultIndexName) setExplicitLanguage(Optional<com.yahoo.language.Language> language) setLanguage(com.yahoo.language.Language language)
-
Constructor Details
-
Parsable
public Parsable()
-
-
Method Details
-
getQuery
-
setQuery
-
getFilter
-
setFilter
-
getDefaultIndexName
-
setDefaultIndexName
-
getLanguage
public com.yahoo.language.Language getLanguage()Returns the language to use when parsing, or null to decide during parsing. -
getOrDetectLanguage
Returns the language to use when parsing, with a text to use for detection if necessary. if not decided by the item under parsing. This is never null or UNKNOWN -
setLanguage
-
getExplicitLanguage
Returns the language explicitly set to be used when parsing, or empty if none is set. -
setExplicitLanguage
-
setModel
-
getSources
-
addSource
-
addSources
-
getRestrict
-
addRestrict
-
addRestricts
-
setSelect
-
getSelect
-
fromQueryModel
-