How to perform a double query in one

2008-01-02 Thread Rishabh Joshi
Hi,

Is there a way to perform 2 search queries in one search request, and then
return their combined results?

Currently I am performing the following:

I have a document which consists of id field which is the unique
identifier, the info field, and an xid field which contains the ids of
other documents (these documents are also indexed) it relates to. Thus there
is a mapping between two or more documents thru the xid field.
Now, in my first search, I search for the document based on a given id, say
XYZ on the id field. this gives me exactly one document and I retrieve the
document's xid content.
Then I search for the same id - XYZ in the xid field and retrive the xid
content for all the matching documents.

Can I perform the same operation in one query? If yes, how do I go about it?
Do, I need to write my custom request handler? If no, any other efficient
way to do the same?


Regards,
Rishabh


Re: How to perform a double query in one

2008-01-02 Thread Otis Gospodnetic
Custom request handler approach seems the most straight forward and the only 
one I can think of quickly.

Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch

- Original Message 
From: Rishabh Joshi [EMAIL PROTECTED]
To: solr-user@lucene.apache.org
Sent: Wednesday, January 2, 2008 10:11:48 AM
Subject: How to perform a double query in one

Hi,

Is there a way to perform 2 search queries in one search request, and
 then
return their combined results?

Currently I am performing the following:

I have a document which consists of id field which is the unique
identifier, the info field, and an xid field which contains the ids
 of
other documents (these documents are also indexed) it relates to. Thus
 there
is a mapping between two or more documents thru the xid field.
Now, in my first search, I search for the document based on a given id,
 say
XYZ on the id field. this gives me exactly one document and I
 retrieve the
document's xid content.
Then I search for the same id - XYZ in the xid field and retrive the
 xid
content for all the matching documents.

Can I perform the same operation in one query? If yes, how do I go
 about it?
Do, I need to write my custom request handler? If no, any other
 efficient
way to do the same?


Regards,
Rishabh





Re: How to perform a double query in one

2008-01-02 Thread Ryan McKinley
If I understand the question...  you essentially want a JOIN function. 
Find the set of docs linked to by an initial query.


Right now, you either need to do two queries (in the client or custom 
RequestHandler) OR, if possible, flatten the data into each doc.  For 
your specific example, can you add a field for every reference to the 
referenced doc?  If so, then it is a single query.


ryan


Otis Gospodnetic wrote:

Custom request handler approach seems the most straight forward and the only 
one I can think of quickly.

Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch

- Original Message 
From: Rishabh Joshi [EMAIL PROTECTED]
To: solr-user@lucene.apache.org
Sent: Wednesday, January 2, 2008 10:11:48 AM
Subject: How to perform a double query in one

Hi,

Is there a way to perform 2 search queries in one search request, and
 then
return their combined results?

Currently I am performing the following:

I have a document which consists of id field which is the unique
identifier, the info field, and an xid field which contains the ids
 of
other documents (these documents are also indexed) it relates to. Thus
 there
is a mapping between two or more documents thru the xid field.
Now, in my first search, I search for the document based on a given id,
 say
XYZ on the id field. this gives me exactly one document and I
 retrieve the
document's xid content.
Then I search for the same id - XYZ in the xid field and retrive the
 xid
content for all the matching documents.

Can I perform the same operation in one query? If yes, how do I go
 about it?
Do, I need to write my custom request handler? If no, any other
 efficient
way to do the same?


Regards,
Rishabh