Hi Eric,

On Sun, Nov 12, 2023 at 12:10:50AM +0000, Eric Wong wrote:
> Henrik Grimler <[email protected]> wrote:
> > Hi,
> > 
> > I recently found out about lei and installed it through archlinux's
> > package manager and am trying out queries. When using AND/OR extra
> > quotes are inserted in the curl command which messes it up, for
> > example:
> > 
> > $ lei q -I https://lore.kernel.org/all/ -o ~/mail/foo 'dfn:COPYING OR 
> > dfn:Makefile'
> > # /home/grimler/.local/share/lei/store 0/0
> > # /usr/bin/curl -Sf -s -d '' 
> > https://lore.kernel.org/all/?x=m&q=dfn%3A%22COPYING+OR+dfn%3AMakefile%22
> > # 0 written to /home/grimler/mail/foo/ (0 matches)
> > 
> > where it can be seen that it tries to search for 'dfn:"COPYING OR
> > dfn:Makefile"', and no hits are returned since there is no file named
> > "COPYING OR dfn:Makefile".
> 
> Don't use quotes unless you want a phrase search.

The quotes are added by lei (or some dependency) when query contains
space. Happens also if I search for a single file:
  lei q -I https://lore.kernel.org/all/ -o ~/mail/foo ' dfn:COPYING'
which results in this curl cmd:
  /usr/bin/curl -Sf -s -d '' 
https://lore.kernel.org/all/?x=m&q=+dfn%3A%22COPYING%22
where %22 then is "

Without spaces in the query all is well:
  lei q -I https://lore.kernel.org/all/ -o ~/mail/foo 'dfn:COPYING'
which gives expected results
  /usr/bin/curl -Sf -s -d '' https://lore.kernel.org/all/?x=m&q=dfn%3ACOPYING

So, maybe there is an issue in some perl dependency on archlinux, any
suggestion where I should start digging?

Best regards,
Henrik Grimler

> Basically, I wanted the CLI and WWW search to feel the same.
> 
> > Is this a known issue, or am I doing something wrong?
> 
> I think you're the second user to add unnecessary quotes;
> is it learned behavior from another search tool?
> 
> In my experience, generic web search engines don't use quotes
> outside of phrase search, either...
> 
> My primary mail experience is from using mairix, so lei borrows
> heavily from it.  But IIRC, mairix doesn't support phrase search.
> 
> Anyways, thanks for the note and any future comments you provide :>

Reply via email to