Package com.yahoo.prelude.query.parser
Class WebParser
java.lang.Object
com.yahoo.prelude.query.parser.AbstractParser
com.yahoo.prelude.query.parser.AllParser
com.yahoo.prelude.query.parser.WebParser
- All Implemented Interfaces:
CustomParser,Parser
Parser for web search queries. Language:
- +item: always include this item as-is when searching (term becomes protected)
- -item: Exclude item when searching (terms becomes protected)
- a OR b (capital or): Or search for a or b
- "a b": Phrase search for a followed by b
- Author:
- bratseth
-
Field Summary
Fields inherited from class com.yahoo.prelude.query.parser.AbstractParser
braceLevelURL, defaultIndex, environment, indexFacts, language, submodes, tokens -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ItemanyItems(boolean topLevel) A collection of one or more items.protected Itemprotected ItemhandleComposite(boolean topLevel) indexableItem(String indexPath) Returns an item and whether it had an explicit index ('indexname:' prefix).protected Itemprotected Itemprotected voidsetSubmodeFromIndex(String indexName, IndexFacts.Session indexFacts) Sets the submodes used for url parsing.protected ItemReturns a WordItem if this is a non CJK query, a WordItem or SegmentItem if this is a CJK query, null if the current item is not a wordMethods inherited from class com.yahoo.prelude.query.parser.AllParser
addAnd, addNot, addOr, combineItems, negativeItem, parseItems, simplifyUnnecessaryCompositesMethods inherited from class com.yahoo.prelude.query.parser.AbstractParser
newComposite, normalize, parse, parse, segment, setState, simplifyPhrases, tokenizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.yahoo.prelude.query.parser.CustomParser
parse
-
Constructor Details
-
WebParser
-
-
Method Details
-
parseItemsBody
- Overrides:
parseItemsBodyin classAllParser
-
handleComposite
-
anyItems
A collection of one or more items. More items are collected in the default composite - or. If there's a explicit composite and some other terms, a rank terms combines them -
positiveItem
-
compositeItem
-
setSubmodeFromIndex
Sets the submodes used for url parsing. Override this to influence when such submodes are used. -
indexableItem
Returns an item and whether it had an explicit index ('indexname:' prefix).- Parameters:
indexPath- the index name prefix this is in the context of, only non-empty if this is inside a sameElement. The path includes the index name and the trailing dot.- Returns:
- an item and whether it has an explicit index, or a Pair with the first element null if none
-
word
Returns a WordItem if this is a non CJK query, a WordItem or SegmentItem if this is a CJK query, null if the current item is not a word- Parameters:
quoted- whether this token is inside quotes
-