Skip to content

Modifying search query so one field scores higher over others? #139

@AmandaUCSC

Description

@AmandaUCSC

Has anyone yet modified this plug-in's query so it scores a field higher over others? It should be possible according to the SolrRelevance FAQs wiki. Specifically, I want to do this:

How can I make "superman" in the title field score higher than in the subject field? For the standard request handler, "boost" the clause on the title field: q=title:superman^2 subject:superman Using the dismax request handler, one can specify boosts on fields in parameters such as qf: q=superman&qf=title^2 subject

I think what I need to do is somehow change the code in the ResultsController.php here:

  // Get the facet GET parameter
   $facet = $this->_request->facet;

    // Form the composite Solr query.
    if (!empty($facet)) $query .= " AND {$facet}";

    // Limit the query to public items if required
    if($limitToPublicItems) {
       $query .= ' AND public:"true"';
    }

    return $query;

Am I right? Has anyone already done this before?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions