def term_info(self, fieldname, text): w = self.frequency(fieldname, text) df = self.doc_frequency(fieldname, text) ml, xl, xw, _ = self.termstats[fieldname, text] plist = self.invindex[fieldname][text] mid = plist[0][0] xid = plist[-1][0] return TermInfo(w, df, ml, xl, xw, mid, xid)
def start_term(self, btext): if self._btext is not None: raise Exception("Called start_term in a term") fieldname = self._fieldname fielddict = self._segment._invindex[fieldname] terminfos = self._segment._terminfos with self._segment._lock: if btext not in fielddict: fielddict[btext] = [] if (fieldname, btext) not in terminfos: terminfos[fieldname, btext] = TermInfo() self._postings = fielddict[btext] self._terminfo = terminfos[fieldname, btext] self._btext = btext
def _find_terminfo(self): c = self._find_line(3, "TERMINFO") return TermInfo(**c)
def start_term(self, btext): self._terminfo = TermInfo() self._print_line(2, "BTEXT", t=btext)