Thanks for the response but I'm still confused.  I don't see how a QParser will 
create multiple queries that need to be sent to shards sequentially.

Here's a more detailed example of what we're doing:

We're indexing documents in Solr that are somewhat equivalent to files.  We 
want users to be able to search by a file's directory.  We're shying away from 
the approach of storing the directory as an attribute because renaming a 
directory could mean re-indexing tens of thousands of file documents.  There 
are other file attributes that would have the same effect if they are modified.

So in an effort to avoid many large reindex jobs, we're trying to index both 
file documents and directory documents.  We don't want search users to have to 
deal with this implementation detail so we're looking to write a plugin that 
would do this for them.

e.g. For the following query that looks for a file in a directory:
q=+directory_name:"myDirectory" +file_name:"myFile"

We'd need to decompose the query into the following two queries:
1. q=+directory_name:"myDirectory"&fl=directory_id
2. q=+file_name:"myFile" +directory_id:(results from query #1)

I guess I'm looking for the following feedback:
- Does this sound crazy?  
- Is the QParser the right place for this logic?  If so, can I get a little 
more guidance on how to decompose the queries there (filter queries maybe)?

Thanks,
Laurent Vauthrin

-----Original Message-----
From: solr-user-return-29672-laurent.vauthrin=disney....@lucene.apache.org 
[mailto:solr-user-return-29672-laurent.vauthrin=disney....@lucene.apache.org] 
On Behalf Of Shalin Shekhar Mangar
Sent: Wednesday, November 25, 2009 5:42 AM
To: solr-user@lucene.apache.org
Subject: Re: SolrPlugin Guidance

On Tue, Nov 24, 2009 at 11:04 PM, Vauthrin, Laurent <
laurent.vauth...@disney.com> wrote:

>
> Our team is trying to make a Solr plugin that needs to parse/decompose a
> given query into potentially multiple queries.  The idea is that we're
> trying to abstract a complex schema (with different document types) from
> the users so that their queries can be simpler.
>
>
>
> So basically, we're trying to do the following:
>
>
>
> 1.       Decompose query A into query B and query C
>
> 2.       Send query B to all shards and plug query B's results into
> query C
>
> 3.       Send Query C to all shards and pass the results back to the
> client
>
>
>
> I started trying to implement this by subclassing the SearchHandler but
> realized that I would not have access to HttpCommComponent.  Then I
> tried to replicate the SearchHandler class but realized that I might not
> have access to fields I would need in ShardResponse.  So I figured I
> should step back and get advice from the mailing list now J.  What is
> the best plugin point for decomposing a query into multiple queries so
> that all resultant queries can be sent to each shard?
>
>
>
All queries are sent to all shards? If yes, it sounds like a job for a
custom QParser.

-- 
Regards,
Shalin Shekhar Mangar.

Reply via email to