mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 17:35:07 +01:00
Update content_config pytest fixture to index plugin content
This commit is contained in:
parent
88344f9ed2
commit
f944408e69
1 changed files with 16 additions and 1 deletions
|
@ -14,6 +14,7 @@ from khoj.utils.rawconfig import (
|
||||||
TextSearchConfig,
|
TextSearchConfig,
|
||||||
ImageSearchConfig,
|
ImageSearchConfig,
|
||||||
)
|
)
|
||||||
|
from khoj.processor.jsonl.jsonl_to_jsonl import JsonlToJsonl
|
||||||
from khoj.processor.org_mode.org_to_jsonl import OrgToJsonl
|
from khoj.processor.org_mode.org_to_jsonl import OrgToJsonl
|
||||||
from khoj.search_filter.date_filter import DateFilter
|
from khoj.search_filter.date_filter import DateFilter
|
||||||
from khoj.search_filter.word_filter import WordFilter
|
from khoj.search_filter.word_filter import WordFilter
|
||||||
|
@ -64,13 +65,27 @@ def content_config(tmp_path_factory, search_config: SearchConfig):
|
||||||
content_config.org = TextContentConfig(
|
content_config.org = TextContentConfig(
|
||||||
input_files=None,
|
input_files=None,
|
||||||
input_filter=["tests/data/org/*.org"],
|
input_filter=["tests/data/org/*.org"],
|
||||||
compressed_jsonl=content_dir.joinpath("notes.jsonl.gz"),
|
compressed_jsonl=content_dir.joinpath("notes.jsonl"),
|
||||||
embeddings_file=content_dir.joinpath("note_embeddings.pt"),
|
embeddings_file=content_dir.joinpath("note_embeddings.pt"),
|
||||||
)
|
)
|
||||||
|
|
||||||
filters = [DateFilter(), WordFilter(), FileFilter()]
|
filters = [DateFilter(), WordFilter(), FileFilter()]
|
||||||
text_search.setup(OrgToJsonl, content_config.org, search_config.asymmetric, regenerate=False, filters=filters)
|
text_search.setup(OrgToJsonl, content_config.org, search_config.asymmetric, regenerate=False, filters=filters)
|
||||||
|
|
||||||
|
content_config.plugins = {
|
||||||
|
"plugin1": TextContentConfig(
|
||||||
|
input_files=[content_dir.joinpath("notes.jsonl")],
|
||||||
|
input_filter=None,
|
||||||
|
compressed_jsonl=content_dir.joinpath("plugin.jsonl.gz"),
|
||||||
|
embeddings_file=content_dir.joinpath("plugin_embeddings.pt"),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
filters = [DateFilter(), WordFilter(), FileFilter()]
|
||||||
|
text_search.setup(
|
||||||
|
JsonlToJsonl, content_config.plugins["plugin1"], search_config.asymmetric, regenerate=False, filters=filters
|
||||||
|
)
|
||||||
|
|
||||||
return content_config
|
return content_config
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue