Closed (won't fix)
Project:
Apache Solr Search
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
16 Dec 2011 at 01:32 UTC
Updated:
3 May 2012 at 18:21 UTC
apachesorl_l() is great but I have need for an apachesolr_url() equivalent.
/**
* This is the url version of apachesolr_l
*
*/
function apachesolr_url($path, $options = array()) {
// Merge in defaults.
$options += array(
'attributes' => array(),
'html' => FALSE,
'query' => array(),
);
// Don't need this, and just to be safe.
unset($options['attributes']['title']);
// Double encode + characters for clean URL Apache quirks.
if (variable_get('clean_url', '0')) {
$path = str_replace('+', '%2B', $path);
}
// Retain GET parameters that ApacheSolr knows nothing about.
$query = apachesolr_current_query();
$get = array_diff_key($_GET, array('q' => 1, 'page' => 1), $options['query'], $query->get_url_queryvalues());
$options['query'] += $get;
return check_url(url($path, $options));
}
Comments
Comment #1
simeI have approached the problem in a different way.
Comment #2
simeLOL, again this came up so re-opening. I was building a url for a drupal_goto, I created a new SOLR query object and added the filters, then I basically reimplemented the above logic because apachesolr_l() does too much.
Comment #3
simeI would modify this a bit. I think it needs to be possible to build up what is needed for a drupal_goto or #redirect on a $form, which means the path and options are separated further.
Comment #4
simeUpdate, it appears that I can do:
Comment #5
pwolanin commented6.x-2.x is unsupported