def _parse_index_definition(self, index_field): """Parse a field definition for an index, returning a Getter.""" # Note: We may want to keep a Parser object around, and cache the # Getter objects for a greater length of time. Specifically, if # you create a bunch of indexes, and then insert 50k docs, you'll # re-parse the indexes between puts. The time to insert the docs # is still likely to dominate put_doc time, though. parser = query_parser.Parser() getter = parser.parse(index_field) return getter
def _evaluate_index(self, raw_doc, field): parser = query_parser.Parser() getter = parser.parse(field) return getter.get(raw_doc)
def __init__(self, index_name, index_definition): self._name = index_name self._definition = index_definition self._values = {} parser = query_parser.Parser() self._getters = parser.parse_all(self._definition)
def parse_all(self, specs): parser = query_parser.Parser() return parser.parse_all(specs)
def parse(self, spec): parser = query_parser.Parser() return parser.parse(spec)
def setUp(self): super(TestMakeTree, self).setUp() self.parser = query_parser.Parser()