Skip to content

Commit

Permalink
Merge pull request #1 from PlasticStudio/fix/multiple_manymany_filters
Browse files Browse the repository at this point in the history
Fix/multiple manymany filters
  • Loading branch information
monkeyfeet authored Sep 7, 2020
2 parents ded729c + 96f134a commit cddad8b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "jaedb/search",
"name": "plasticstudio/search",
"type": "silverstripe-vendormodule",
"description": "SilverStripe search engine",
"homepage": "http://jamesbarnsley.co.nz",
"homepage": "https://psdigital.co.nz",
"keywords": ["silverstripe"],
"license": "BSD-3-Clause",
"authors": [
Expand All @@ -13,7 +13,7 @@
}
],
"support": {
"issues": "http://github.com/jaedb/search/issues"
"issues": "http://github.com/plasticstudio/search/issues"
},
"extra": {
"expose": [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.1.0",
"author": "James Barnsley",
"description": "SilverStripe Search Engine",
"repository": "https://github.com/jaedb/search",
"repository": "https://github.com/plasticstudio/search",
"licenses": {
"type": "Apache License",
"url": "http://www.apache.org/licenses/LICENSE-2.0.txt"
Expand Down
4 changes: 4 additions & 0 deletions src/SearchPageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ public function PerformSearch(){
$filter_join = $filter['JoinTables'][$type['Key']];

$joins.= "LEFT JOIN \"".$filter_join['Table']."\" ON \"".$type['Table']."\".\"ID\" = \"".$filter_join['Column']."\"";
$joins.= "LEFT JOIN \"".$filter_join['Table']."\" ON \"".$type['Table']."\".\"ID\" = \"".$filter_join['Table']."\".\"".$filter_join['Column']."\"";

if (is_array($filter['Value'])){
$ids = '';
Expand All @@ -440,6 +441,9 @@ public function PerformSearch(){
$ids = $filter['Value'];
}

if ($relations_sql !== ''){
$relations_sql.= " AND ";
}
$relations_sql.= "\"".$filter_join['Table']."\".\"".$filter['Table']."ID\" IN (". $ids .")";
}

Expand Down

0 comments on commit cddad8b

Please sign in to comment.