fix index SEARCH_BACKENDS import_backend to load via ABX instead of settings
Some checks are pending
CodeQL / Analyze (python) (push) Waiting to run
Build Debian package / build (push) Waiting to run
Build Docker image / buildx (push) Waiting to run
Build Homebrew package / build (push) Waiting to run
Build GitHub Pages website / build (push) Waiting to run
Build GitHub Pages website / deploy (push) Blocked by required conditions
Run linters / lint (push) Waiting to run
Build Pip package / build (push) Waiting to run
Run tests / python_tests (ubuntu-22.04, 3.11) (push) Waiting to run
Run tests / docker_tests (push) Waiting to run

This commit is contained in:
Nick Sweeting 2024-10-01 00:19:19 -07:00
parent dac134dfca
commit 5697ecefad
No known key found for this signature in database

View file

@ -1,21 +1,21 @@
__package__ = 'archivebox.search' __package__ = 'archivebox.search'
from typing import List, Union
from pathlib import Path from pathlib import Path
from typing import List, Union
from django.db.models import QuerySet from django.db.models import QuerySet
from django.conf import settings from django.conf import settings
import abx.archivebox.use
from archivebox.index.schema import Link from archivebox.index.schema import Link
from archivebox.misc.util import enforce_types from archivebox.misc.util import enforce_types
from archivebox.misc.logging import stderr from archivebox.misc.logging import stderr
from archivebox.config.legacy import ANSI
from archivebox.config import SEARCH_BACKEND_CONFIG from archivebox.config import SEARCH_BACKEND_CONFIG
def log_index_started(url): def log_index_started(url):
print('{green}[*] Indexing url: {} in the search index {reset}'.format(url, **ANSI)) print('[green][*] Indexing url: {} in the search index[/]'.format(url))
print( ) print( )
def get_file_result_content(res, extra_path, use_pwd=False): def get_file_result_content(res, extra_path, use_pwd=False):
@ -57,7 +57,7 @@ def get_indexable_content(results: QuerySet):
def import_backend(): def import_backend():
for backend in settings.SEARCH_BACKENDS.values(): for backend in abx.archivebox.use.get_SEARCHBACKENDS().values():
if backend.name == SEARCH_BACKEND_CONFIG.SEARCH_BACKEND_ENGINE: if backend.name == SEARCH_BACKEND_CONFIG.SEARCH_BACKEND_ENGINE:
return backend return backend
raise Exception(f'Could not load {SEARCH_BACKEND_CONFIG.SEARCH_BACKEND_ENGINE} as search backend') raise Exception(f'Could not load {SEARCH_BACKEND_CONFIG.SEARCH_BACKEND_ENGINE} as search backend')