khoj-ai / khoj

Your AI second brain. Self-hostable. Get answers from the web or your docs. Build custom agents, schedule automations, do deep research. Turn any online or local LLM into your personal, autonomous AI (e.g gpt, claude, gemini, llama, qwen, mistral).
https://khoj.dev
GNU Affero General Public License v3.0
14.28k stars 708 forks source link

More lenient date searching #481

Closed Jonny-GM closed 1 year ago

Jonny-GM commented 1 year ago

Suppose we have a scenario where we have notes such that the date of the note is in the filename; this is prevalent and is for example the default behavior of the Obsidian Daily Notes feature. Chatting using a simple chat message such as "what does yesterday's note say" then fails to give relevant results, for 2 reasons:

  1. By default the DateFilter uses the raw content of the entry, rather than the compiled content which includes the filename. Given how prevalent naming notes by date is, I think the DateFilter should use the compiled content.
  2. The defiltered search query is then something like "Note from yesterday" which is below the score threshold because the note contents itself generally contains nothing about "yesterday" or "note". Information about the actual date should be included (what's the reasoning behind defiltering the search query in the first place? keeping privacy about the full file-path?)

This PR resolves these such that the simple chat query works as expected.

debanjum commented 1 year ago

Thanks for the thorough thinking for this PR! 👌🏾

what's the reasoning behind defiltering the search query in the first place? keeping privacy about the full file-path?)