Generate compiled form of each entry directly in the org-mode processor

- The logic for compiling an org-mode entry (for later encoding) now
  completely resides in the org-to-jsonl processor layer

- This allows asymmetric search to be generic and not be aware of
  org-mode specific properties that were extracted by the org-to-jsonl
  processor layer

- Now asymmetric search just expects the jsonl to (at least) have the
  'compiled' and 'raw' keys for each entry. What original text the
  entry was compiled from is irrelevant to it. The original text
  could be mail, chat, markdown, org-mode etc, it doesn't have to care
This commit is contained in:
Debanjum Singh Solanky
2022-07-21 01:47:51 +04:00
parent 4ead79d272
commit 06cf425314
2 changed files with 12 additions and 18 deletions

View File

@@ -55,18 +55,7 @@ def extract_entries(notesfile, verbose=0):
# Read File
for line in jsonl_file:
note = json.loads(line.strip(empty_escape_sequences))
# Ignore title notes i.e notes with just headings and empty body
if not "Body" in note or note["Body"].strip(empty_escape_sequences) == "":
continue
scheduled_str = f'\t Scheduled for {note["Scheduled"]}' if "Scheduled" in note else ""
closed_str = f'\t Closed on {note["Closed"]}' if "Closed" in note else ""
tags_str = f'\t {note["Tags"]}' if "Tags" in note else ""
body_str = f'\n {note["Body"]}' if "Body" in note else ""
note_string = f'{note["Title"]}{tags_str}{closed_str}{scheduled_str}{body_str}'
entries.append({'compiled': note_string, 'raw': note["Raw"]})
entries.append({'compiled': note['compiled'], 'raw': note["raw"]})
# Close File
jsonl_file.close()