mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 23:48:56 +01: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(
|
||||
{
|
||||
"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
|
||||
in hits[0:count]]
|
||||
|
|
Loading…
Reference in a new issue