mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 14:05:29 +02:00
ENHANCEMENT Custom query params support in SolrIndex->search()
This commit is contained in:
parent
2a3e882d70
commit
65ce258578
@ -169,8 +169,16 @@ abstract class SolrIndex extends SearchIndex {
|
||||
Solr::service(get_class($this))->commit(false, false, false);
|
||||
}
|
||||
|
||||
public function search($query, $offset = -1, $limit = -1) {
|
||||
$service = Solr::service(get_class($this));
|
||||
/**
|
||||
* @param SearchQuery $query
|
||||
* @param integer $offset
|
||||
* @param integer $limit
|
||||
* @param Array $params Extra request parameters passed through to Solr
|
||||
* @return ArrayData Map with the following keys:
|
||||
* - 'Matches': ArrayList of the matched object instances
|
||||
*/
|
||||
public function search(SearchQuery $query, $offset = -1, $limit = -1, $params = array()) {
|
||||
$service = $this->getService();
|
||||
|
||||
SearchVariant::with(count($query->classes) == 1 ? $query->classes[0]['class'] : null)->call('alterQuery', $query, $this);
|
||||
|
||||
@ -266,7 +274,15 @@ abstract class SolrIndex extends SearchIndex {
|
||||
if ($limit == -1) $limit = $query->limit;
|
||||
if ($limit == -1) $limit = SearchQuery::$default_page_size;
|
||||
|
||||
$res = $service->search($q ? implode(' ', $q) : '*:*', $offset, $limit, array('fq' => implode(' ', $fq)), Apache_Solr_Service::METHOD_POST);
|
||||
$params = array_merge($params, array('fq' => implode(' ', $fq)));
|
||||
|
||||
$res = $service->search(
|
||||
$q ? implode(' ', $q) : '*:*',
|
||||
$offset,
|
||||
$limit,
|
||||
$params,
|
||||
Apache_Solr_Service::METHOD_POST
|
||||
);
|
||||
|
||||
$results = new ArrayList();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user