mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-04 13:20:17 +00:00
Set filename as top heading of org entries for better search context
Previously filename was only being appended to markdown entries. Test filename getting prepended to compiled entry as heading
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# Standard Packages
|
||||
import glob
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from typing import Iterable, List
|
||||
|
||||
# Internal Packages
|
||||
@@ -112,7 +113,11 @@ class OrgToJsonl(TextToJsonl):
|
||||
# Ignore title notes i.e notes with just headings and empty body
|
||||
continue
|
||||
|
||||
compiled = f"{parsed_entry.heading}."
|
||||
# Prepend filename as top heading to entry
|
||||
filename = Path(entry_to_file_map[parsed_entry]).stem
|
||||
heading = f"* {filename}\n** {parsed_entry.heading}." if parsed_entry.heading else f"* {filename}."
|
||||
|
||||
compiled = heading
|
||||
if state.verbose > 2:
|
||||
logger.debug(f"Title: {parsed_entry.heading}")
|
||||
|
||||
@@ -142,7 +147,7 @@ class OrgToJsonl(TextToJsonl):
|
||||
Entry(
|
||||
compiled=compiled,
|
||||
raw=f"{parsed_entry}",
|
||||
heading=f"{parsed_entry.heading}",
|
||||
heading=f"{heading}",
|
||||
file=f"{entry_to_file_map[parsed_entry]}",
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user