|
|
|
@ -45,15 +45,25 @@ class BookSearch
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function addOrQuery(array $texts, $field)
|
|
|
|
public function addCompoundQuery(array $texts, $field, $operator)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(count($texts) > 0) {
|
|
|
|
if(count($texts) > 0) {
|
|
|
|
$texts = array_map(array('SolrUtils', 'escapeQueryChars'), $texts);
|
|
|
|
$texts = array_map(array('SolrUtils', 'escapeQueryChars'), $texts);
|
|
|
|
$query = sprintf('%s:("%s")', $field, implode('" OR "', $texts));
|
|
|
|
$query = sprintf('%s:("%s")', $field, implode('" '.$operator.'"', $texts));
|
|
|
|
$this->addQuery($query, null, false);
|
|
|
|
$this->addQuery($query, null, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function addOrQuery(array $texts, $field)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$this->addCompoundQuery($texts, $field, 'OR');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function addAndQuery(array $texts, $field)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$this->addCompoundQuery($texts, $field, 'AND');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function addQuery($queryText, $queryField = null, $escape = true)
|
|
|
|
public function addQuery($queryText, $queryField = null, $escape = true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if($escape) {
|
|
|
|
if($escape) {
|
|
|
|
|