MoreLikeThis API
This commit is contained in:
@@ -15,7 +15,7 @@ class BookSearch
|
||||
private $query;
|
||||
private $queryParts = array();
|
||||
|
||||
public function __construct()
|
||||
public function __construct($edismax = true)
|
||||
{
|
||||
$options = array
|
||||
(
|
||||
@@ -27,10 +27,13 @@ class BookSearch
|
||||
);
|
||||
|
||||
$this->client = new \SolrClient($options);
|
||||
$this->query = new \SolrDisMaxQuery();
|
||||
|
||||
// use the Extended DisMax Query parser
|
||||
$this->query->useEDisMaxQueryParser();
|
||||
if($edismax) {
|
||||
$this->query = new \SolrDisMaxQuery();
|
||||
$this->query->useEDisMaxQueryParser();
|
||||
} else {
|
||||
$this->query = new \SolrQuery();
|
||||
}
|
||||
|
||||
// most options like search fields, sorting, etc are already set
|
||||
// as default in the Solr config and thus should be set only on a
|
||||
@@ -45,6 +48,11 @@ class BookSearch
|
||||
*/
|
||||
}
|
||||
|
||||
public function setHandler($handler)
|
||||
{
|
||||
$this->client->setServlet(\SolrClient::SEARCH_SERVLET_TYPE, $handler);
|
||||
}
|
||||
|
||||
public function addCompoundQuery(array $texts, $field, $operator)
|
||||
{
|
||||
if(count($texts) > 0) {
|
||||
|
||||
Reference in New Issue
Block a user