mirror of
https://github.com/pirate/ArchiveBox.git
synced 2025-08-12 01:24:53 +02:00
fix index SEARCH_BACKENDS import_backend to load via ABX instead of settings
This commit is contained in:
@@ -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')
|
||||||
|
Reference in New Issue
Block a user