mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +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:
@@ -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]]
|
||||
|
||||
Reference in New Issue
Block a user