mirror of
https://github.com/simon987/Simple-Incremental-Search-Tool.git
synced 2025-12-14 15:49:04 +00:00
Progress bar + thumbnail generator
This commit is contained in:
24
search.py
Normal file
24
search.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import elasticsearch
|
||||
from elasticsearch import helpers
|
||||
import requests
|
||||
|
||||
|
||||
class Search:
|
||||
|
||||
def __init__(self, index: str):
|
||||
self.index_name = index
|
||||
self.es = elasticsearch.Elasticsearch()
|
||||
|
||||
try:
|
||||
requests.head("http://localhost:9200")
|
||||
print("elasticsearch is already running")
|
||||
except:
|
||||
print("elasticsearch is not running")
|
||||
|
||||
def getAllDocuments(self, dir_id: int):
|
||||
|
||||
return helpers.scan(client=self.es,
|
||||
query={"_source": {"includes": ["path", "name"]},
|
||||
"query": {"term": {"directory": dir_id}}},
|
||||
index=self.index_name)
|
||||
|
||||
Reference in New Issue
Block a user