public abstract class AbstractParser extends Object implements CustomParser
Modifier and Type | Field and Description |
---|---|
protected int |
braceLevelURL
The counter for braces in URLs, braces in URLs are accepted so long as
they are balanced.
|
protected ParserEnvironment |
environment |
protected IndexFacts.Session |
indexFacts
The IndexFacts.Session of this query
|
protected com.yahoo.language.Language |
language
The current language of this parser.
|
protected com.yahoo.prelude.query.parser.AbstractParser.Submodes |
submodes
The current submodes of this parser
|
protected com.yahoo.prelude.query.parser.TokenPosition |
tokens |
Modifier | Constructor and Description |
---|---|
protected |
AbstractParser(ParserEnvironment environment)
Creates a new instance of this class, storing the given
ParserEnvironment for parse-time access to the
environment. |
Modifier and Type | Method and Description |
---|---|
protected String |
normalize(String input)
Unicode normalizes some piece of natural language text.
|
QueryTree |
parse(Parsable query)
|
Item |
parse(String queryToParse,
String filterToParse,
com.yahoo.language.Language parsingLanguage,
IndexFacts.Session indexFacts,
String defaultIndexName) |
protected abstract Item |
parseItems() |
protected Item |
segment(Token token) |
protected void |
setState(com.yahoo.language.Language queryLanguage,
IndexFacts.Session indexFacts) |
static Item |
simplifyPhrases(Item unwashed)
Collapses single item phrases in the tree to the contained item.
|
protected void |
tokenize(String query,
String defaultIndexName,
IndexFacts.Session indexFacts,
com.yahoo.language.Language language)
Tokenizes the given string and initializes tokens with the found tokens.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
parse
protected com.yahoo.prelude.query.parser.AbstractParser.Submodes submodes
protected com.yahoo.language.Language language
protected IndexFacts.Session indexFacts
protected int braceLevelURL
protected final ParserEnvironment environment
protected final com.yahoo.prelude.query.parser.TokenPosition tokens
protected AbstractParser(ParserEnvironment environment)
Creates a new instance of this class, storing the given ParserEnvironment
for parse-time access to the
environment.
environment
- The environment settings to attach to the Parser.public final Item parse(String queryToParse, String filterToParse, com.yahoo.language.Language parsingLanguage, IndexFacts.Session indexFacts, String defaultIndexName)
parse
in interface CustomParser
protected abstract Item parseItems()
protected String normalize(String input)
input
- The string to normalize.protected void setState(com.yahoo.language.Language queryLanguage, IndexFacts.Session indexFacts)
protected void tokenize(String query, String defaultIndexName, IndexFacts.Session indexFacts, com.yahoo.language.Language language)
query
- the string to tokenize.defaultIndexName
- the name of the index to use as default.indexFacts
- resolved information about the index we are searchinglanguage
- the language set for this query, or null if nonepublic static Item simplifyPhrases(Item unwashed)
unwashed
- The item whose phrases to simplify.Copyright © 2018. All rights reserved.