Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

Boolean query search

Thread view: 
puzzlecracker - 08 Jan 2006 17:02 GMT
Hi group,

I am implementing a fairly simple and  straightforward  text-search (I
display each line that contains required pattern ) that supports
Boolean queries in the following format:

str1 AND str2 NOT str3 -  where not is a unary operation  thus the
following would be equivalent to  str1 AND str ANDNOT str3 by default
unless a user specifies otherwise....

Additionally,  It is left-associative;

I would also like to have parenthesis as well: (str1 AND (str2 OR
str3))

That is it....

Should I write a parser for that followed by walking the AST (abstract
syntax tree) - javacc or antlar? -  or would java regular expressions
suffice? it should  be fast, whereas java regex is known to be slow....

Any suggestions, examples, references would be highly appreciated.

Thx
Thomas Weidenfeller - 09 Jan 2006 08:46 GMT
>  Hi group,
>
> I am implementing a fairly simple and  straightforward  text-search (I
> display each line that contains required pattern ) that supports
> Boolean queries in the following format:

First, there is no need to post the same question three times within
minutes. Please familiarize yourself with the way Usenet works.

Second, ...

> Should I write a parser for that followed by walking the AST (abstract
> syntax tree) - javacc or antlar? -  or would java regular expressions
> suffice? it should  be fast, whereas java regex is known to be slow....

... write a parser. Use the tool you feel most comfortable with, or,
since this seems to be a simple parser, write the parser by hand.

Regular expressions are not a panacea to all kinds of processing text input.

/Thomas
Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.