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
* Example: rangeQuery('store', '45,-94', '46,-93')
* Returns: store:[45,-94 TO 46,-93]
*
* @static
* @param string $field
* @param string $from
* @param string $to
......@@ -131,7 +130,6 @@ class Solarium_Query_Helper
*
* Find all entries within the distance of a certain point.
*
* @static
* @param $pointX
* @param $pointY
* @param $field
......@@ -158,7 +156,6 @@ class Solarium_Query_Helper
* guaranteed to encompass all of the points of interest, but it may also
* include other points that are slightly outside of the required distance.
*
* @static
* @param string $pointX
* @param string $pointY
* @param string $field
......@@ -186,7 +183,6 @@ class Solarium_Query_Helper
* or combining the distance with the relevancy score,
* such as boosting by the inverse of the distance.
*
* @static
* @param $pointX
* @param $pointY
* @param $field
......@@ -203,7 +199,6 @@ class Solarium_Query_Helper
/**
* Render a qparser plugin call
*
* @static
* @param string $name
* @param array $params
* @return string
......@@ -211,7 +206,7 @@ class Solarium_Query_Helper
public function qparser($name, $params = array())
{
$output = '{!'.$name;
foreach ($params AS $key=>$value) {
foreach ($params as $key=>$value) {
$output .= ' ' . $key . '=' . $value;
}
$output .= '}';
......@@ -222,7 +217,6 @@ class Solarium_Query_Helper
/**
* Render a functionCall
*
* @static
* @param string $name
* @param array $params
* @return string
......@@ -297,4 +291,19 @@ class Solarium_Query_Helper
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
$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