Class WebParser

All Implemented Interfaces:
CustomParser, Parser

public class WebParser extends AllParser
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
  • Constructor Details

  • Method Details

    • parseItemsBody

      protected Item parseItemsBody()
      Overrides:
      parseItemsBody in class AllParser
    • handleComposite

      protected Item handleComposite(boolean topLevel)
    • anyItems

      protected Item anyItems(boolean topLevel)
      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

      protected Item positiveItem()
    • compositeItem

      protected Item compositeItem()
    • setSubmodeFromIndex

      protected void setSubmodeFromIndex(String indexName, IndexFacts.Session indexFacts)
      Sets the submodes used for url parsing. Override this to influence when such submodes are used.
    • indexableItem

      protected com.yahoo.collections.Pair<Item,Boolean> indexableItem()
      Returns an item and whether it had an explicit index ('indexname:' prefix).
      Returns:
      an item and whether it has an explicit index, or a Pair with the first element null if none
    • word

      protected Item word(String indexName, boolean quoted)
      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