Skip to content

microfts doesn't handle org source blocks #14

@fpatz

Description

@fpatz

The org parser/chunker in microfts seems to get confused by source blocks. When searching for a term that appears in a file with source blocks, the search UI displays just one huge line with the first source block for the org file (and none of the other matches). The screen shot shows a situation, where many lines in the file match "sphinx". In this case, the source block doesn't even have a match for the search term (it looks like the org parser squeezed all text into the source block chunk).

Bildschirmfoto 2021-01-16 um 14 44 14

A simple workaround obviously is to remove -org from org-fts-input-args, which I did (and it's still very useful then, but not quite what you intended, I guess).

Here is a shell transcript of reproducing this from the command line:

$ THIS IS WRONG
$ rm org-fts.db
$ ./microfts create org-fts.db
$ ./microfts input -org org-fts.db ~/org/links.org
$ ./microfts search org-fts.db sphinx | cut -c -80
~/org/links.org:29:    #+begin_src python\n      import sys, 

$ WITHOUT ORG PARSING (same input file)
$ rm org-fts.db
$ ./microfts create org-fts.db
$ ./microfts input org-fts.db ~/org/links.org
$ ./microfts search org-fts.db sphinx | cut -c -80
~/org/links.org:682:** Sphinx
~/org/links.org:684:*** Requirements, Bugs, Test cases, … ins
~/org/links.org:688:*** Why use reStructuredText and Sphinx s
~/org/links.org:695:    documents, then Sphinx (or any of Mar
~/org/links.org:698:    sphinx-static-site-generator-for-main
...

I looked into the code, but my Go fu is moot, so no patch, sorry ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions