Ejemplo n.º 1
0
 def import_search(self, q):
     from sefaria.search import query
     res = query(q)
     for hit in res["hits"]["hits"]:
         tags = {"default": hit["_source"]["path"].split("/")}
         stop = {
             "type": "inside_source",
             "ref": hit["_source"]["ref"],
             "enVersionTitle": hit["_source"]["version"],
             "tags": tags
         }
         if hit["_source"]["lang"] == "en":
             stop["enText"] = u" ".join(hit["highlight"]["content"])
         elif hit["_source"]["lang"] == "he":
             stop["heText"] = u" ".join(hit["highlight"]["content"])
         self.add_stop(stop)
Ejemplo n.º 2
0
    def import_search(self, q):
        from sefaria.search import query
        res = query(q)

        self.updateFilter("default", {"en": "Categories", "he": u"קטגוריות"})

        for hit in res["hits"]["hits"]:
            tags = {"default": hit["_source"]["path"].split("/")}
            stop = {
                "type": "inside_source",
                "ref": hit["_source"]["ref"],
                "enVersionTitle": hit["_source"]["version"],
                "tags": tags
            }
            if hit["_source"]["lang"] == "en":
                stop["enText"] = u" ".join(hit["highlight"]["content"])
            elif hit["_source"]["lang"] == "he":
                stop["heText"] = u" ".join(hit["highlight"]["content"])
            self.add_stop(stop)