Skip to content
This repository was archived by the owner on Nov 4, 2021. It is now read-only.

Commit 2b172ed

Browse files
committed
Merge branch 'master' of https://github.com/babenkoivan/scout-elasticsearch-driver into babenkoivan-master
2 parents 56398b1 + 2b3232d commit 2b172ed

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The package has been tested in the following configuration:
5151

5252
* PHP version >= 7.0
5353
* Laravel Framework version >= 5.5
54-
* Elasticsearch version >= 5.5
54+
* Elasticsearch version >= 6
5555

5656
## Installation
5757

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
}
2222
],
2323
"require": {
24-
"elasticsearch/elasticsearch": "^5.1",
24+
"elasticsearch/elasticsearch": "^6.0",
2525
"laravel/scout": "^3.0"
2626
},
2727
"autoload": {

src/Builders/FilterBuilder.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function where($field, $value)
4444
$this->wheres['must'][] = ['range' => [$field => ['gt' => $value]]];
4545
break;
4646

47-
case '<';
47+
case '<':
4848
$this->wheres['must'][] = ['range' => [$field => ['lt' => $value]]];
4949
break;
5050

@@ -114,6 +114,17 @@ public function whereRegexp($field, $value, $flags = 'ALL')
114114
return $this;
115115
}
116116

117+
public function when($value, callable $callback, callable $default = null)
118+
{
119+
if ($value) {
120+
return $callback($this);
121+
} elseif ($default) {
122+
return $default($this);
123+
}
124+
125+
return $this;
126+
}
127+
117128
/**
118129
* https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-distance-query.html
119130
* @param string $field
@@ -182,4 +193,4 @@ public function with($relations)
182193

183194
return $this;
184195
}
185-
}
196+
}

src/Builders/SearchBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ public function rule($rule)
1919

2020
return $this;
2121
}
22-
}
22+
}

0 commit comments

Comments
 (0)