21 lines
687 B
Python
21 lines
687 B
Python
|
|
import os
|
|
from searching import es_search
|
|
ELASTIC_QUERY = os.environ.get("ELASTIC_QUERY","Anwesend")
|
|
import logging
|
|
|
|
logging.basicConfig(level=logging.DEBUG)
|
|
|
|
#for hit in resp["hits"]["hits"]: q
|
|
# print(hit)
|
|
|
|
if __name__ =="__main__":
|
|
logging.debug(f"searching with query: %s\n" % ELASTIC_QUERY)
|
|
resp = es_search(ELASTIC_QUERY)
|
|
for hit in resp["hits"]["hits"]:
|
|
print(f"\n\n%s\n%s\n%s - %s" % (
|
|
hit.get("_source",{}).get("url",""),
|
|
hit.get("_source",{}).get("title",""),
|
|
" ".join(hit.get("highlight",{}).get("title",[""])),
|
|
" ".join(hit.get("highlight",{}).get("text",[""]))
|
|
)) |