simple boolean text search

71 views
Skip to first unread message

Shula

unread,
Feb 11, 2010, 5:49:21 AM2/11/10
to Booleano
i wonder whether and how to perform a "search engine style" boolean
search through simple english text.

i just need AND, OR, NOT (and maybe parenthesis)

for example:
(cheese AND ham) OR "baked beens" NOT spam

should be OK on
john bought ham
can i have baked beens

but not
baked beens and spam

i can use the default grammer or | (for 'or') & (for 'and') etc.
but i couldn't find how.

thank you,
shula

Gustavo Narea

unread,
Feb 11, 2010, 5:51:11 PM2/11/10
to bool...@googlegroups.com, Shula
Hello, Shula.

On 11/02/10 10:49, Shula wrote:
> i wonder whether and how to perform a "search engine style" boolean
> search through simple english text.
>
> i just need AND, OR, NOT (and maybe parenthesis)
>
> for example:
> (cheese AND ham) OR "baked beens" NOT spam
>
> should be OK on
> john bought ham
> can i have baked beens
>
> but not
> baked beens and spam
>

I'm afraid the answer is "no", right now. That's one of the things I'd
like to support in the future, but in the mean time I think you'd be
better off using Pyparsing directly.

The reason is that that kind of strings are not boolean expressions per
se. A boolean expression equivalent would be something like "{cheese,
ham} IN document AND NOT spam IN document": http://pastebin.com/d65f1f5b7

--
Gustavo Narea <xri://=Gustavo>.

Shula

unread,
Feb 11, 2010, 6:03:08 PM2/11/10
to Booleano
thank you for your reply.

The exact syntax does not matter for my need, which means that the
example that you wrote now is also good.

But I couldn't understand how to make it work in booleano.
Is there a simple example of how to use booleano for something similar
to what I need?

Shula

unread,
Feb 11, 2010, 6:07:03 PM2/11/10
to Booleano
ok, i see you just provided that example :-]
thank you!

On Feb 12, 12:51 am, Gustavo Narea <m...@gustavonarea.net> wrote:

Reply all
Reply to author
Forward
0 new messages