Skip to content
Snippets Groups Projects
Commit 06cd9580 authored by Bryan BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

prefill when empty

parent a6e08d3c
No related branches found
No related tags found
No related merge requests found
...@@ -18,4 +18,21 @@ class Command(BaseCommand): ...@@ -18,4 +18,21 @@ class Command(BaseCommand):
business_process.rebuild_index() business_process.rebuild_index()
te = time.time() te = time.time()
print(f"Index rebuild in {int((te - ts) * 100) / 100}s, it contains {models.IndexedWord.objects.count()} words") print(f"Index rebuild in {int((te - ts) * 100) / 100}s, it contains {models.IndexedWord.objects.count()} words")
if not models.IndexedWord.objects.exists():
print("DB is empty, prefilling it with some words")
for s in [
"Coming soon",
"coming soon",
"coming",
"soon",
"Work in progress",
"work",
"progress",
"HUB",
"Bioinformatics and Biostatistics",
"Bioinformatics and Biostatistics HUB",
"bioinformatics",
"biostatistics",
]:
models.IndexedWord.objects.get_or_create(word=s, occurrence=1)
business_process.set_setting_in_storage(utils.REBUILD_NEEDED, False) business_process.set_setting_in_storage(utils.REBUILD_NEEDED, False)
[metadata] [metadata]
name = autocomplete-multi-models name = autocomplete-multi-models
version = 0.4.1 version = 0.4.3
description = An app that index fields across multiple models, and expose an api to query for word similar to the query. description = An app that index fields across multiple models, and expose an api to query for word similar to the query.
long_description = file: README.md long_description = file: README.md
author = Bryan Brancotte author = Bryan Brancotte
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment