Commit b81e2892 authored by Bas de Nooijer's avatar Bas de Nooijer

Added support for Solr join syntax in query helper

parent 2db071c4
...@@ -110,7 +110,6 @@ class Solarium_Query_Helper ...@@ -110,7 +110,6 @@ class Solarium_Query_Helper
* Example: rangeQuery('store', '45,-94', '46,-93') * Example: rangeQuery('store', '45,-94', '46,-93')
* Returns: store:[45,-94 TO 46,-93] * Returns: store:[45,-94 TO 46,-93]
* *
* @static
* @param string $field * @param string $field
* @param string $from * @param string $from
* @param string $to * @param string $to
...@@ -131,7 +130,6 @@ class Solarium_Query_Helper ...@@ -131,7 +130,6 @@ class Solarium_Query_Helper
* *
* Find all entries within the distance of a certain point. * Find all entries within the distance of a certain point.
* *
* @static
* @param $pointX * @param $pointX
* @param $pointY * @param $pointY
* @param $field * @param $field
...@@ -158,7 +156,6 @@ class Solarium_Query_Helper ...@@ -158,7 +156,6 @@ class Solarium_Query_Helper
* guaranteed to encompass all of the points of interest, but it may also * guaranteed to encompass all of the points of interest, but it may also
* include other points that are slightly outside of the required distance. * include other points that are slightly outside of the required distance.
* *
* @static
* @param string $pointX * @param string $pointX
* @param string $pointY * @param string $pointY
* @param string $field * @param string $field
...@@ -186,7 +183,6 @@ class Solarium_Query_Helper ...@@ -186,7 +183,6 @@ class Solarium_Query_Helper
* or combining the distance with the relevancy score, * or combining the distance with the relevancy score,
* such as boosting by the inverse of the distance. * such as boosting by the inverse of the distance.
* *
* @static
* @param $pointX * @param $pointX
* @param $pointY * @param $pointY
* @param $field * @param $field
...@@ -203,7 +199,6 @@ class Solarium_Query_Helper ...@@ -203,7 +199,6 @@ class Solarium_Query_Helper
/** /**
* Render a qparser plugin call * Render a qparser plugin call
* *
* @static
* @param string $name * @param string $name
* @param array $params * @param array $params
* @return string * @return string
...@@ -211,7 +206,7 @@ class Solarium_Query_Helper ...@@ -211,7 +206,7 @@ class Solarium_Query_Helper
public function qparser($name, $params = array()) public function qparser($name, $params = array())
{ {
$output = '{!'.$name; $output = '{!'.$name;
foreach ($params AS $key=>$value) { foreach ($params as $key=>$value) {
$output .= ' ' . $key . '=' . $value; $output .= ' ' . $key . '=' . $value;
} }
$output .= '}'; $output .= '}';
...@@ -222,7 +217,6 @@ class Solarium_Query_Helper ...@@ -222,7 +217,6 @@ class Solarium_Query_Helper
/** /**
* Render a functionCall * Render a functionCall
* *
* @static
* @param string $name * @param string $name
* @param array $params * @param array $params
* @return string * @return string
...@@ -297,4 +291,19 @@ class Solarium_Query_Helper ...@@ -297,4 +291,19 @@ class Solarium_Query_Helper
return $value; return $value;
} }
/**
* Render join localparams syntax
*
* @see http://wiki.apache.org/solr/Join
* @since 2.4.0
*
* @param $from
* @param $to
* @return string
*/
public function join($from, $to)
{
return $this->qparser('join', array('from' => $from, 'to' => $to));
}
} }
\ No newline at end of file
...@@ -197,4 +197,12 @@ class Solarium_Query_HelperTest extends PHPUnit_Framework_TestCase ...@@ -197,4 +197,12 @@ class Solarium_Query_HelperTest extends PHPUnit_Framework_TestCase
$this->_helper->assemble('cat:%1% AND content:%2%',array('value1')); $this->_helper->assemble('cat:%1% AND content:%2%',array('value1'));
} }
public function testJoin()
{
$this->assertEquals(
'{!join from=manu_id to=id}',
$this->_helper->join('manu_id', 'id')
);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment