Hi Steve,
Thanks for the response.
Actually I am not looking for a query language. My question is, whether Lucene supports Nested Queries or self joins? As per http://lucene.apache.org/java/docs/api/org/apache/lucene/queryParser/QueryParser.html

In BNF, the query grammar is:

  Query  ::= ( Clause )*
  Clause ::= ["+", "-"] [<TERM> ":"] ( <TERM> | "(" Query ")" )

Which means that FIELD2:(FIELD2:3) is a correct query. Correct me if I am wrong.

What will this query translate into? Will it be same as FIELD2: 1 OR FIELD2: 2


Thanks
kapilChhabra

Steven Rowe wrote:
Hi Kapil,

Kapil Chhabra wrote:
Just to mention, I have tokenized FIELD2 on "," and indexed it.

FIELD2:3 should return 1,2
FIELD2:(FIELD2:3) should return something like the output of:

*FIELD2: 1 OR FIELD2: 2

Given your data table, I assume you mean:

   FIELD1:3 should return 1,2
   FIELD1:(FIELD2:3) should return something like the output of:

   *FIELD1: 1 OR FIELD1: 2

If you make FIELD1 stored, and search using "FIELD2:3", you can iterate
through the hits and return the values for FIELD1.

Are you looking for a query language that does this work for you?  That
is, one which can query on any field and then return information from
other field(s) in matching documents?  If so, I don't know of such a
query language that exists for Lucene.

There have been several integrations of Lucene with databases, some of
which enable SQL queries something like:

    SELECT FIELD1 WHERE FIELD2 CONTAINS('3');

1. Marcelo Ochoa's Oracle JVM implementation for Lucene DataStore:
<http://issues.apache.org/jira/browse/LUCENE-724>; see also these
threads on the Lucene Java-Users list:
<http://www.nabble.com/Oracle-and-Lucene-Integration-tf2689965.html>
<http://www.nabble.com/Oracle-Lucene-integration--status--tf2865873.html>

2. Mark Harwood's Lucene database bindings for HSQLDB and Derby:
<http://issues.apache.org/jira/browse/LUCENE-434>; see also this thread
on the Lucene Java-Users list:
<http://www.nabble.com/Lucene-database-bindings-tf316816.html>

3. Hibernate (as of v3.1, I think) Lucene Integration:
<http://www.hibernate.org/hib_docs/annotations/reference/en/html/lucene.html>

4. DBSight enables Lucene search with databases: <http://www.dbsight.net/>


Hope it helps,
Steve

Kapil Chhabra wrote:
Hi,

Please see the following data-structure
+--------+----------+
| FIELD1 | FIELD2   |
+--------+----------+
| 1      | 2,3,4,6, |
| 2      | 3,1,5,7, |
| 3      | 1,2,     |
| 4      | 1,8,10,  |
| 5      | 2,9,     |
| 6      | 1,       |
| 7      | 2,9,     |
| 8      | 4,9,     |
| 9      | 5,7,8,   |
| 10     | 4,       |
+--------+----------+

My requirement is to find all values in FIELD1 where FIELD2 contains
all values of FIELD1 where FIELD2 contains 3
Which means something like
FIELD2:(FIELD2:3)

Is it possible to achieve this in a single query? If yes, then how
should I go about it?



Thanks in anticipation,
kapilChhabra



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to