Skip to content

Commit

Permalink
Update text search
Browse files Browse the repository at this point in the history
  • Loading branch information
vectornguyen76 committed Oct 10, 2023
1 parent bddbb6e commit 3ecc002
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function Home() {

useEffect(() => {
// This effect runs when the component mounts
const apiUrl = `${NEXT_PUBLIC_TEXT_SEARCH}/full-text-search?query=aoso&size=20`; // You can set your initial API URL here
const apiUrl = `${NEXT_PUBLIC_TEXT_SEARCH}/full-text-search?query=Áo&size=20`; // You can set your initial API URL here
fetch(apiUrl, { method: "GET" })
.then((response) => response.json())
.then((data) => {
Expand Down
9 changes: 7 additions & 2 deletions text-search-engine/elastic_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,19 @@ def indexing_batch_document(self):

print(f"Indexed {successes}/{self.number_of_docs} documents")

def check_index_exists(self):
"""Check index name exists"""
return not self.elastic_search.indices.exists(index=self.index_name)


def main():
"""
Main function to perform Elasticsearch data ingestion.
"""
es_ingest = ElasticSeachIngest()
es_ingest.create_index()
es_ingest.indexing_batch_document()
if not es_ingest.check_index_exists():
es_ingest.create_index()
es_ingest.indexing_batch_document()


if __name__ == "__main__":
Expand Down

0 comments on commit 3ecc002

Please sign in to comment.