mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 16:14:21 +00:00
Return the file of each search result in response
- Useful for enabling jump to note functionality in interfaces - It will be used in the Khoj plugin for Obsidian
This commit is contained in:
parent
fe1398401d
commit
152e5f1661
1 changed files with 4 additions and 1 deletions
|
@ -186,7 +186,10 @@ def collate_results(hits, entries: list[Entry], count=5) -> list[SearchResponse]
|
||||||
return [SearchResponse.parse_obj(
|
return [SearchResponse.parse_obj(
|
||||||
{
|
{
|
||||||
"entry": entries[hit['corpus_id']].raw,
|
"entry": entries[hit['corpus_id']].raw,
|
||||||
"score": f"{hit['cross-score'] if 'cross-score' in hit else hit['score']:.3f}"
|
"score": f"{hit['cross-score'] if 'cross-score' in hit else hit['score']:.3f}",
|
||||||
|
"additional": {
|
||||||
|
"file": entries[hit['corpus_id']].file,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
for hit
|
for hit
|
||||||
in hits[0:count]]
|
in hits[0:count]]
|
||||||
|
|
Loading…
Add table
Reference in a new issue