radhika garg
radhika garg

Reputation: 57

How to disable the facet in solr externally through a query if it is true in the qt defination

I want to disable the facet thrpough the query. i am having a qt as tester with facet=true and facet.field = city i am using a query like localhost:8983/solr/mywork/select?q=:&qt=tester i want to false the facet field through the query and not changing the qt.How can i do this.

Upvotes: 0

Views: 850

Answers (3)

DDeMartini
DDeMartini

Reputation: 337

The correct settings are 'on' or 'off' (not true or false).

If you want to disable all faceting for a specific RequestHandler, this is how I've implemented it:

  <requestHandler name="/Spellcheck" class="org.apache.solr.handler.component.SearchHandler">
<lst name="defaults">
  <str name="df">NOSEARCH</str>
  <str name="spellcheck.dictionary">default</str>
  <str name="spellcheck">on</str>
</lst>
<lst name="invariants">
    <str name="rows">0</str>
    <str name="facet">off</str>
</lst>
<arr name="last-components">
  <str>spellcheck</str>
</arr>

The section that is relevant to preventing the user of facets with the handler is the 'invariants' section. This over-rides any of the settings passed in the command.

Upvotes: 0

vsri293
vsri293

Reputation: 541

You can control faceting from query by giving facet param as true or false.

  • facet = true

localhost:8983/solr/mywork/select?q=:&qt=tester&facet=true&facet.field=city

  • facet = false

localhost:8983/solr/mywork/select?q=:&qt=tester&facet=false

Upvotes: 0

Vinod
Vinod

Reputation: 1953

qt used to choose a request handler. when 'qt' is not specified, the default handler is chosen which is usually /select.

All handler are defined in solrconfig.xml file. open that file and search for request handler with name tester see how it defined for faceting, there you can modify facet defaults.

if you see line like this <str name="facet">on</str> delete things related to facet.

Restart solr and try again.

Upvotes: 0

Related Questions