tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Support for boolean queries in apropos

On Sun, 11 Mar 2012, Abhinav Upadhyay wrote:
The FTS engine of Sqlite supports Boolean queries. Boolean queries simply means building complex queries by combining simple queries using Boolean operators: AND, OR, and NOT. For example:

$ apropos add new user NOT (git OR ssh)

This will provide results which match the query "add new user" but do not match for "git" or "ssh".

Instead of exposing the underlying syntax of the SQL engine, I would prefer to see a user interface syntax similar to that ptovided by google search.

        $ apropos 'add "new user" -(git|ssh)'
        $ apropos add '"new user"' '-(git|ssh)'

where the outer quotes are for the shell, the inner quotes around "new user" mean that those two words must appear together, the "-" means the following term must not appear, the "|" means OR, and the parentheses are for scoping. Not shown in the example is the "+" operator, which google search uses to mean that the term must appear, or that the term has a higher weight than other terms in determining the overall ranking of the results.

2. Or, another option is to use '||', '&&' and '~' as the symbols for the OR, AND, NOT Boolean operators respectively in the apropos frontend and pre-process it to build a proper SQL query so that Sqlite is able to understand and execute it properly.

Please don't make users learn new syntax. I expect many users will already familiar with the syntax offered by google search, so I think it's a good idea to re-use that syntax.

--apb (Alan Barrett)

Home | Main Index | Thread Index | Old Index