Revisions
-
James McKinney revised this gist
Mar 19, 2012 . 1 changed file with 7 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ * http://code.google.com/p/solr-php-client/ */ require_once(dirname(__FILE__) . '/SolrPhpClient/Apache/Solr/Service.php'); solr_proxy_main(); @@ -21,6 +21,8 @@ function solr_proxy_main() { if (isset($_POST['query'])) { $params = array(); $keys = ''; $core = ''; // The names of Solr parameters that may be specified multiple times. $multivalue_keys = array('bf', 'bq', 'facet.date', 'facet.date.other', 'facet.field', 'facet.query', 'fq', 'pf', 'qf'); @@ -35,13 +37,16 @@ function solr_proxy_main() { elseif ($key == 'q') { $keys = $value; } elseif ($key == 'core') { $core = "$value/"; } else { $params[$key] = $value; } } // Replace these arguments as needed. $solr = new Apache_Solr_Service('example.solrstuff.org', 80, '/solrjs/' . $core); try { $response = $solr->search($keys, $params['start'], $params['rows'], $params); -
evolvingweb revised this gist
Feb 11, 2010 . 1 changed file with 4 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,11 +22,14 @@ function solr_proxy_main() { if (isset($_POST['query'])) { $params = array(); // The names of Solr parameters that may be specified multiple times. $multivalue_keys = array('bf', 'bq', 'facet.date', 'facet.date.other', 'facet.field', 'facet.query', 'fq', 'pf', 'qf'); $pairs = explode('&', $_POST['query']); foreach ($pairs as $pair) { list($key, $value) = explode('=', $pair, 2); $value = urldecode($value); if (in_array($key, $multivalue_keys)) { $params[$key][] = $value; } elseif ($key == 'q') { @@ -50,11 +53,3 @@ function solr_proxy_main() { print $response->getRawResponse(); } } -
evolvingweb revised this gist
Feb 11, 2010 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -37,6 +37,7 @@ function solr_proxy_main() { } } // Replace these arguments as needed. $solr = new Apache_Solr_Service('example.solrstuff.org', 80, '/solrjs/'); try { -
evolvingweb revised this gist
Feb 11, 2010 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,10 +4,13 @@ * @file * Implements a Solr proxy. * * Currently requires json_decode which is bundled with PHP >= 5.2.0. * * You must download the SolrPhpClient and store it in the same directory as this file. * * http://code.google.com/p/solr-php-client/ */ require_once(dirname(__FILE__) .'/SolrPhpClient/Apache/Solr/Service.php'); solr_proxy_main(); -
evolvingweb revised this gist
Feb 8, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ solr_proxy_main(); /** * Executes the Solr query and returns the JSON response. */ function solr_proxy_main() { if (isset($_POST['query'])) { -
evolvingweb revised this gist
Feb 8, 2010 . 1 changed file with 0 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -47,14 +47,6 @@ function solr_proxy_main() { } } /** * @return array The names of Solr parameters that may be specified multiple * times. -
evolvingweb revised this gist
Feb 8, 2010 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,6 +7,7 @@ * Currently requires json_decode which is bundled with PHP >= 5.2.0, */ // @see http://code.google.com/p/solr-php-client/ require_once(dirname(__FILE__) .'/SolrPhpClient/Apache/Solr/Service.php'); solr_proxy_main(); -
evolvingweb created this gist
Feb 8, 2010 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,63 @@ <?php /** * @file * Implements a Solr proxy. * * Currently requires json_decode which is bundled with PHP >= 5.2.0, */ require_once(dirname(__FILE__) .'/SolrPhpClient/Apache/Solr/Service.php'); solr_proxy_main(); /** * <p>Executes the Solr query and returns the JSON response.</p> */ function solr_proxy_main() { if (isset($_POST['query'])) { $params = array(); $pairs = explode('&', $_POST['query']); foreach ($pairs as $pair) { list($key, $value) = explode('=', $pair, 2); $value = urldecode($value); if (in_array($key, apachesolr_ajax_multivalue_keys())) { $params[$key][] = $value; } elseif ($key == 'q') { $keys = $value; } else { $params[$key] = $value; } } $solr = new Apache_Solr_Service('example.solrstuff.org', 80, '/solrjs/'); try { $response = $solr->search($keys, $params['start'], $params['rows'], $params); } catch (Exception $e) { die($e->__toString()); } print $response->getRawResponse(); } } /** * @param string $param The value of a Solr parameter. * @return bool Whether the value includes local parameters. */ function apachesolr_ajax_has_local_params($param) { return preg_match('/^\{/', $param); } /** * @return array The names of Solr parameters that may be specified multiple * times. */ function apachesolr_ajax_multivalue_keys() { return array('bf', 'bq', 'facet.date', 'facet.date.other', 'facet.field', 'facet.query', 'fq', 'pf', 'qf'); }