hasu / notdeft

NotDeft note manager for Emacs
https://tero.hasu.is/notdeft/
170 stars 14 forks source link

Help getting "title:" search working #1

Closed kaushalmodi closed 6 years ago

kaushalmodi commented 6 years ago

Hello,

By random chance, I discovered your project, and it looks great!

I got it running in the capacity of "deft". But I am having trouble using the title: search.

For example, I have this Org file (it shows up fine in the *NotDeft* buffer). Its contents are:

#+TITLE: sed
#+AUTHOR: Kaushal Modi

#+SETUPFILE: ~/org/common/config.org

#+STARTUP: inlineimages

* Hold Buffer
..

But searching for "title:sed" does not return this note.

What am I doing wrong?

Also, I have many notes with lowercase #+title: instead of #+TITLE:. Is the search for title case-sensitive? If so, can you please make the Org keyword searches for title, tags, etc. case-insensitive?

Thanks.

hasu commented 6 years ago

Searching for "title:sed" works for me with that note.

You can try some things:

  1. Make sure that there are no empty lines before the #+TITLE. (The parsing is not exactly the same as for Org.)
  2. Be sure to use M-x notdeft-query-edit (bound to TAB) to enter your query, rather than just typing "title:sed" as the filter string.
  3. If that reports "Found no notes", then your search index may not be correctly built, or up-to-date, and you can try M-x notdeft-reindex (bound to C-c R) to rebuild the index.
  4. If that still does not work, and notdeft-xapian-program is correctly set, it may be worth trying to run the program directly, and seeing what it says. For example,

    /path/to/notdeft-xapian search -q title:sed ~/.deft
  5. If that reports no errors nor matches, a tool such as xapian-delve may be used to inspect the contents of the search index.

Yes, any #+TITLE keyword is parsed in a case sensitive manner, currently. I'm not sure if lowercase in-buffer setting keywords are exactly documented syntax for Org—haven't seen it stated explicitly in the docs. Still, pcomplete at least offers lowercase versions also. I agree that the keyword parsing could be made insensitive.

kaushalmodi commented 6 years ago

Searching for "title:sed" works for me with that note.

Thanks. I was able to make it work, but only using the TAB binding. There, I faced some UX issues, details below.

Make sure that there are no empty lines before the #+TITLE. (The parsing is not exactly the same as for Org.)

That wasn't the case.

Be sure to use M-x notdeft-query-edit (bound to TAB) to enter your query, rather than just typing "title:sed" as the filter string.

That worked! But would it be possible to make typing just "title:sed" work too?

You do have this in your documentation Press Tab in a NotDeft buffer to enter a search query. So sorry for missing that. May be that should be made in bold for folks like me? :)

Thank you for taking time to list the alternative ways to debug this; it's very much appreciated.

Yes, any #+TITLE keyword is parsed in a case sensitive manner, currently. I'm not sure if lowercase in-buffer setting keywords are exactly documented syntax for Org—haven't seen it stated explicitly in the docs.

Org actually parses all #+ keywords in case-insensitive fashion. There even was a commit few months back that showed the preference to use lower-case keywords. (I liked that very much and even have a little helper function to lower-case all keywords in the current Org document 😄 ).

I agree that the keyword parsing could be made insensitive.

Thank you! I'll be looking forward to that.

kaushalmodi commented 6 years ago

I'll open separate issues for the case-insensitive keyword parsing and the other UX issue that I briefly mentioned above.

Thank you.