def index_doc(self, doc): with self.ix.writer() as writer: try: writer.add_document(title=encodeValue(doc['title']), content=encodeValue(doc['content'])) except KeyError: writer.add_document(content=encodeValue(doc['content'])) return writer
def is_relevant(self, query, directory): q = Query(query, directory) return q.match({"content": encodeValue(self.text)})