سؤال

When running Solr queries from Blacklight the query parser being used is the DisMax query parser. However, the query parser configured in my solrconfig.xml file is the EDisMax parser. For some reason, Blacklight sends deftype=dismax in the request to Solr and so overrides the desired deftype=edismax value as it is defined in Solr's configuration.

How do I stop Blacklight from overriding the deftype parameter?

هل كانت مفيدة؟

المحلول

Are you using Blacklight's Advanced Search gem? The dismax parser is hard coded in the tree.rb file under lib/parsing_nesting in the Advanced Search gem. If you want to use the edismax parser you have to create a new "parsing_nesting" directory under the "lib" directory. Copy the tree.rb file to the "parsing_nesting" directory you have created. The easy (but kind of ugly) solution would be to replace all the "dismax" with "edismax" in the file. A better, but harder, solution would be to read the whole file thoroughly and change some function signatures so that they don't require the "force_deftype" parameter. Start with removing the :force_deftype => "dismax" from the build_nested_query function and see where this leads you.

نصائح أخرى

I think that the use of the dismax parser is default set in the Blacklight code. However, you can override it by modifying your /app/contollers/catalog_controller.rb file and adding the defType setting to the config.default_solr_params variable. The default that comes with Blacklight would look like the following after this modification:

    config.default_solr_params = { 
      :qt => 'search',
      :rows => 10,
      :defType => 'edismax' 
    }
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top