It would be great if other modules could change the search keys in the current search query.

For example, in one of our sites. We need to search on a given field, when a searchmode is given.

We do the following in the apachesolr_modify_query hook:
if (isset($_GET['searchmode'])) {
$params['qt'] = 'standard';
$query->setKeys($_GET['searchmode'] .':'. search_get_keys());
}

Following was added in Solr_Base_Query.php
/**
* Set the search keywords
*/
public function setKeys($keys) {
$this->keys = $keys;
}

Comments

janusman’s picture

Status: Active » Closed (fixed)

Uhm, Solr_Base_Query.php in 6.x-2.x-dev already had this:

/**
   * Set keywords in this query.
   *
   * @param $keys
   *   New keywords
   */
  function set_keys($keys) {
    $this->keys = $keys;
  }

  /**
   * Get this query's keywords.
   */
  function get_keys() {
    return $this->keys;
  }

=) Closing this out.

swentel’s picture

Status: Closed (fixed) » Active

But not in in 6-x-1-dev, should be fairly simple to backport that, no ?

robertDouglass’s picture

Version: 6.x-2.x-dev » 6.x-1.x-dev
Status: Active » Fixed

Hi swentel,

there's a patch in the closed issue somewhere that you can use to backport your DRUPAL-6--1 version. I'll leave the issue open for pwolanin to look at and decide if he wants it in DRUPAL-6--1. I'm inclined not to backport.

Please find that issue and reopen it, marking it "patch (to be ported)". Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.