File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Lucene problem... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Lucene problem..." Watch "Lucene problem..." New topic

Lucene problem...

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830

I am using lucene for text search. I am facing one problem. Please help me in this query:

I want to get name of persons who work for IBM and Oracle or IBM and Infosys. In other words, the person must work for IBM and Oracle/Infosys. I don't want to write logic for this, I am looking for just 1/2 line query like IBM AND Oracle OR IBM AND Infosys. but this is not working.

The code is as follows:

[ August 08, 2005: Message edited by: rathi ji ]
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
The Lucene Query Syntax allows parens for grouping. Would one of these work?

(IBM AND Oracle) OR (IBM AND Infosys)
IBM AND ( Oracle OR Infosys )

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Thank you very much Stan. .
I agree. Here's the link:
subject: Lucene problem...
It's not a secret anymore!