Description
After a search populates the skill index, disabling or removing all
skills does not clear the index. Subsequent searches still return
previously indexed skill IDs.
Steps to reproduce
- Create a SkillCatalog with enabled skills.
- Create a SkillSearchEngine using the BM25 backend.
- Search for a term matching an enabled skill.
- Disable or remove every skill in the catalog.
- Run the same search again.
Expected behavior
The search returns an empty list because no enabled skills remain.
Actual behavior
The search returns stale results from the previous index.
Environment
- OS: Windows
- Python: 3.12
- Commit: 1860d85
Investigation
In SkillSearchEngine._ensure_indexed(), an empty document list skips
retriever indexing, but the cache version is still updated. This leaves
the previous index intact.
Resetting the retriever when there are no enabled skill documents
appears to resolve the problem.
I have a local fix and regression tests covering disabling/removing all
skills, clearing hybrid child indexes, and restoring search after skills
are enabled or added again. All 37 tests in test_skill_features.py pass
with the fix.
I would be happy to submit a PR.
Description
After a search populates the skill index, disabling or removing all
skills does not clear the index. Subsequent searches still return
previously indexed skill IDs.
Steps to reproduce
Expected behavior
The search returns an empty list because no enabled skills remain.
Actual behavior
The search returns stale results from the previous index.
Environment
Investigation
In SkillSearchEngine._ensure_indexed(), an empty document list skips
retriever indexing, but the cache version is still updated. This leaves
the previous index intact.
Resetting the retriever when there are no enabled skill documents
appears to resolve the problem.
I have a local fix and regression tests covering disabling/removing all
skills, clearing hybrid child indexes, and restoring search after skills
are enabled or added again. All 37 tests in test_skill_features.py pass
with the fix.
I would be happy to submit a PR.