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.22k stars 705 forks source link

Index Parent Headings of Org-Mode Entries to Improve Search Context #548

Closed debanjum closed 11 months ago

debanjum commented 12 months ago

Overview

The parent hierarchy of org-mode entries can store important context.

This change updates OrgNode to track parent headings for each org entry and adds the parent outline for each entry to the index

Details

Resolves #85

yantar92 commented 11 months ago

sabaimran @.***> writes:

  • Prepend ancestor headings, filename as top heading to entry for context

It would be either ancestor headings OR filename, right? It looks like filename won't be included if it has ancestors, but correct me if I'm wrong. We should make sure to include them.

Another candidate for indexing that is equivalent to the filename is the file #+TITLE.

-- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92

debanjum commented 11 months ago

Another candidate for indexing that is equivalent to the filename is the file #+TITLE.

Hey @yantar92 👋🏾, yeah good idea. I've updated the code to use #+TITLE, when present, instead of filename as the root ancestor of all entries in an org-mode file