Avner Levy
Avner Levy

Reputation: 6751

Storing filter definition on Solr server

I have a situation where all my queries have some sub filter queries which are added each time and are very long.
The query filters are the same each time so it is a waste of time sending them over and over to Solr server and parsing them on the other side just to find them in the cache.
Is there a way I can send filter query definition once to the Solr server and then reference it in following queries?

Upvotes: 0

Views: 29

Answers (1)

MatsLindh
MatsLindh

Reputation: 52912

You can add a static configuration directive in your solr config (solrconfig.xml):

<requestHandler name="/select" class="solr.SearchHandler">
    <lst name="appends">
        <str name="fq">foo:value</str>
    </lst>
</requestHandler>

.. this will always append a fq= term to the query string before the SearchHandler receives the query. Other options are invariants or defaults. See Request Handlers and Search Handlers on the community wiki for more information.

Upvotes: 2

Related Questions