Hello Darin,

Let me try to answer below,

On Mon, Dec 15, 2014 at 10:38 PM, Darin Amos <dari...@gmail.com> wrote:
>
> Hello,
>
> I have a simple question, is an instance of the QueryParser created for
> every single request and is that object thread safe?
>
QueryParser and QParser are request scope not-thread safe objects. eg
QParser holds reference to SolrQueryRequest, and QueryParser holds parser
field which is QParser.


>
> I will try not to get into too much of the specifics but I have a custom
> QueryParser

I wonder why. We used to extend QParserPlugin and QParser, rather than
QueryParser.


> and Search Component. Within my query parser when it is instantiated, I
> execute a lucene search and use that docset to help build and filter my
> main query. In my search component later on, I might need to build another
> query with the query parser and use that same filter docset. I would rather
> just hold onto the docset and reuse it rather than re-execute the query.
>

Here it's not clear whether you are talking about same request or about
several ones. In case of former, you can pass whatever you need across your
componets,parsers, handlers, responsewriters, etc via
SolrQueryRequest.getContext().
Sharing across requests are more tricky, check how Solr uses filterCache.
The regular extensions uses
https://wiki.apache.org/solr/SolrCaching#User.2FGeneric_Caches to cache
DocSets by Strings or perhaps really heavy queries, which are also valid
across requests.


>
> Thanks!
>
> Darin
>
>

-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

<http://www.griddynamics.com>
<mkhlud...@griddynamics.com>

Reply via email to