def _q_anyword(self, q): res = KeyArray() word = q.word.lower() for entry in self.entries.itervalues(): found = False for attrs in entry.values (): for attr in attrs: idx = attr.index () if word in idx: found = True break if found: break if not found: continue res.add(entry.key) return res
def _q_all(self): r = KeyArray() for k in self.entries: r.add(k) return r
def _q_hasfield(self, q): res = KeyArray() for e in self.entries.itervalues(): try: fs = e[q.field] except KeyError: continue res.add(e.key) return res
def _idxadd(self, key, val): for attribs in val.values(): for attrib in attribs: for idx in attrib.index(): self._idx_b.setdefault(key, {})[idx] = True try: self._idx_f[idx].add(key) except KeyError: a = KeyArray() a.add(key) self._idx_f[idx] = a return
def _q_txo(self, q): res = KeyArray() full = self.schema.txo[q.txo.group].expand(q.txo.id) for e in self.entries.itervalues(): try: fs = e[q.field] except KeyError: continue for f in fs: if f.id in full: res.add(e.key) break return res