Bick
Bick

Reputation: 18541

solr add fl parameters to requestHandler

Currently my query defines the returned fields names .

http://127.0.0.1:8983/solr/.../select?q=wor&start=0&rows=100&fl=..%2C+...%2C+...%2...&qf=fieldA^1.1+fieldB&wt=json&indent=false&defType=edismax&stopwords=true&lowercaseOperators=true&hl=true&hl.simple.pre=<em>&hl.simple.post=</em>&omitHeader=true
  1. Is it possible to omit the fl parameter ?
    (add it to the config file, instead of request)

  2. can I replace my qf parameter if it contains a ratio ("1.1" in the example)? how?

  3. I have seen in the documentation that the requestHandler has an append element that you can append anything to the queries.

    <lst name="appends">
    

    Is it a better practice to use it ?

Upvotes: 1

Views: 741

Answers (2)

Maurizio In denmark
Maurizio In denmark

Reputation: 4284

  1. yes you can remove the fl from your query and add it as a default in the config file:
  <lst name="defaults">
          <str name="fl">field1,field2</str>
  </lst>
  1. if you move your filter query into the normal q query then you don't need the filter anymore. It may change performances though.

  2. you can use appends and is not unusual and is done pretty much in the same way as the default I showed at point 1. but that will apply to every single query that you make on that field and you will have no control over that from a query

Upvotes: 1

Jayendra
Jayendra

Reputation: 52799

Solr requesthanlder definition allows you to define

Configuration

  • defaults :- Add the params which defaults to the values and would need not be provided with the request URL. These params can however be overridden if the params are passed with the request. So add the fl parameter here if it is fixed so that it need not be specified with the Request URL everytime

  • invariants :- Params cannot be overridden. This params are locked by Solr and cannot be changed.

  • appends :- Params will be appended additionally to the ones passed by the User.

Upvotes: 1

Related Questions