search: added deprecation for whoosh searcher

This commit is contained in:
RhodeCode Admin 2025-06-04 08:43:07 +02:00
parent 65cd564db6
commit df76529428
2 changed files with 13 additions and 23 deletions

View file

@ -147,6 +147,11 @@ def searcher_from_config(config, prefix="search."):
# use an old legacy ES version set to 8
_config["es_version"] = DEFAULT_ES_VERSION
imported = importlib.import_module(_config.get("module", default_searcher))
search_module = _config.get("module", default_searcher)
if search_module == "rhodecode.lib.index.whoosh":
log.warning("rhodecode.lib.index.whoosh module is no longer supported, using default searcher rc_elasticsearch")
search_module = "rc_elasticsearch"
imported = importlib.import_module(search_module)
searcher = imported.Searcher(config=_config)
return searcher

View file

@ -36,28 +36,13 @@ from rhodecode.lib.str_utils import safe_str
log = logging.getLogger(__name__)
try:
# we first try to import from rhodecode tools, fallback to copies if
# we're unable to
from rhodecode_tools.lib.fts_index.whoosh_schema import (
ANALYZER,
FILE_INDEX_NAME,
FILE_SCHEMA,
COMMIT_INDEX_NAME,
COMMIT_SCHEMA,
)
except ImportError:
log.warning(
"rhodecode_tools schema not available, doing a fallback "
"import from `rhodecode.lib.index.whoosh_fallback_schema`"
)
from rhodecode.lib.index.whoosh_fallback_schema import (
ANALYZER,
FILE_INDEX_NAME,
FILE_SCHEMA,
COMMIT_INDEX_NAME,
COMMIT_SCHEMA,
)
from rhodecode.lib.index.whoosh_fallback_schema import (
ANALYZER,
FILE_INDEX_NAME,
FILE_SCHEMA,
COMMIT_INDEX_NAME,
COMMIT_SCHEMA,
)
FORMATTER = HtmlFormatter("span", between='\n<span class="break">...</span>\n')