Mason G. Zhwiti
Mason G. Zhwiti

Reputation: 6540

Is it possible to filter Solr results using solrconfig.xml?

I have a set of documents in Solr which I search through two different requestHandlers. One requestHandler is used internally and should be able to see all documents. The other is used by a public-facing search engine.

Is there a way I can apply an fq parameter in my requestHandler definition, so that a subset of the documents won't be returned?

In this instance I only want to return documents where the "fivi" field is NOT ZERO.

Upvotes: 2

Views: 371

Answers (1)

Shane Andrade
Shane Andrade

Reputation: 2675

The request handler wiki page shows how to specify default values:

<requestHandler name="/foo" class="my.package.CustomRequestHandler" />
    <!-- initialization args may optionally be defined here -->
     <lst name="defaults">
       <int name="rows">10</int>
       <str name="fl">*</str>
       <str name="version">2.1</str>
     </lst>
  </requestHandler>

But if you don't want them to be able to override the values then use invariants instead of defaults for the name of the lst element.

Upvotes: 5

Related Questions