geeknote icon indicating copy to clipboard operation
geeknote copied to clipboard

Wrong search behavior (intitle: applied wrongly)

Open saladpanda opened this issue 10 years ago • 0 comments

I think the "find" feature is not working as expected/advertised. The README says:

--content-search : find command searches by note's title. If you want to search by note's content - set this option.

The default behaviour is to put an intitle: in front of the whole search term. I think this is supposed to make the whole search consider only intitle-matches. What it actually does, is apply the intitle: to the first word and do a content-search for all other words. This is according to the formal search grammer defined by Evernote: https://dev.evernote.com/doc/articles/search_grammar.php#Formal_Search_Grammar

Example: $ gn find "one two" is converted to the search-query intitle:one two. This means: search one in notes title and search two in content+title+everything. To get the intended behaviour it should have been converted to the query intitle:one intitle:two

Another example:

$ gn create --title "foobar" --content "asdfasdfasdf"
Note has been successfully created.

$ gn create --title "test" --content "foobar"
Note has been successfully created.

$ gn create --title "foobar asdfasdfasdf" --content "blabla"
Note has been successfully created.

$ gn find "asdfasdfasdf"
Search request: intitle:asdfasdfasdf    
Total found: 1
  1 : 17.01.1970        foobar asdfasdfasdf

$ gn find "foobar asdfasdfasdf"
Search request: intitle:foobar asdfasdfasdf
Total found: 2
  1 : 17.01.1970        foobar asdfasdfasdf
  2 : 17.01.1970        foobar
##### If this was a "completely intitle"-search the second result should not turn up

$ gn find "foobar intitle:asdfasdfasdf"
Search request: intitle:foobar intitle:asdfasdfasdf
Total found: 1
  1 : 17.01.1970        foobar asdfasdfasdf
##### This is what a "completely intitle"-search must look

My suggestion is to remove automatic intitle: behaviour and make --content-search the default behaviour. That is: don't add anything to the users search-query. If he/she wants to use modifiers like intitle:, pass them through unmodified.

saladpanda avatar Apr 06 '16 09:04 saladpanda