简体   繁体   中英

Blacklight solr relevancy : How to boost a field?

I have a little project that combines black light and Solr and need a) to boost a field b) to boost a document depending on a field value. I m reading SolrRelevancyFAQ and extendedDisMax but unable to apply them on the rails project because I m new on the framework/language . I know that there is a catalog.controller though , that pretty much has all solr configs. So for part aa guess I must somehow apply in my catalogue controller but have no idea how to implement it:

q=title:superman^2 subject:superman

or

ExtendedDisMax with qf=title^2 subject^2.8

For part 2 . I have no idea. Please help.

Edit , I managed (A) with the following code in catalogue_controller

  config.default_solr_params = { 
  :qt => 'search',
  :rows => 10,
  :facet => 'true',
  :qf => 'title^3 subject^2', 
  :defType =>'edismax'
  }

For (b) I try to search for doc whose field canfly value is "yes" but it doesnt work. Any ideas?

config.default_solr_params = { 
  :qt => 'search',
  :rows => 10,
  :facet => 'true',
  :bq => 'canfly:yes^50.0',
  :defType =>'edismax'
}

According to solr documentation bq boosts the field whose value is the specified ie

http://localhost:8983/solr/select/?q=video&defType=edismax&qf=features^20.0+text^0.3&bq=cat:electronics^5.0

but this doesnt work in when applied in the catalog controller. why is that ?

Solr.log (Here we can see the actual fields that exist label,description and source )

INFO  - 2014-08-28 15:10:24.017; org.apache.solr.core.SolrCore; [raw_Geospatial_Collection] webapp=/solr path=/select params={facet=true&sort=time_created+desc&spellcheck.q=Pink&qf=label^20+description^2&f.tag.facet.mincount=1&wt=ruby&rows=10&defType=edismax&f.tag.facet.limit=6&bq=source:foursquare^50.0&q=Pink&facet.field={!ex%3Dtype_single}type&facet.field={!ex%3Dsource_single}source&facet.field={!ex%3Dcity_single}city&facet.field=tag&facet.field=gs_category_level2&qt=search&facet.pivot=gs_category_level1,gs_category_level2} hits=855 status=0 QTime=64 

I removed the 2 lines from catalog_controller that ordered the results in the GUI by timestamp

   config.add_sort_field 'time_created desc', :label => "timestamp (earliest first)"
   config.add_sort_field 'time_created asc', :label => "timestamp (earliest last)"

Then set the desired params in solr.config

  <requestHandler name="/select" class="solr.SearchHandler">
    <!-- default values for query parameters can be specified, these
         will be overridden by parameters in the request
      -->
     <lst name="defaults">
       <str name="echoParams">explicit</str>
       <int name="rows">10</int>
       <str name="df">text</str>
       <str name="bq">source:dbpedia^9.0 source:flickr^9.9</str>
       <str name="qf">description^0.2 label^0.1</str>
       <str name="defType">edismax</str>
     </lst>
     ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM