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

Commit 621ac44

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 141542c + eb58b28 commit 621ac44

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ More about index settings you can find in the [index management section](https:/
134134
To create an index just run the artisan command:
135135

136136
```
137-
php artisan elastic:create-index App\\MyIndexConfigurator
137+
php artisan elastic:create-index "App\MyIndexConfigurator"
138138
```
139139

140140
Note, that every searchable model requires its own index configurator.
@@ -200,7 +200,7 @@ We'll take a closer look at it in [the search rules section](#search-rules).
200200
After setting up a mapping in your model you can update an Elasticsearch type mapping:
201201

202202
```
203-
php artisan elastic:update-mapping App\\MyModel
203+
php artisan elastic:update-mapping "App\MyModel"
204204
```
205205

206206
## Usage
@@ -461,13 +461,13 @@ Before you run the command, make sure that your index configurator uses the `Sco
461461
If it's not, add the trait and run the artisan `elastic:update-index` command using your index configurator class name as an argument:
462462

463463
```
464-
php artisan elastic:update-index App\\MyIndexConfigurator
464+
php artisan elastic:update-index "App\MyIndexConfigurator"
465465
```
466466

467467
When you are ready, make changes in the model mapping and run the `elastic:migrate` command using the model class as the first argument and desired index name as the second argument:
468468

469469
```
470-
php artisan elastic:migrate App\\MyModel my_index_v2
470+
php artisan elastic:migrate "App\MyModel" my_index_v2
471471
```
472472

473473
Note, that if you need just to add new fields in your mapping, use the `elastic:update-mapping` command.

src/Builders/FilterBuilder.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,19 +366,21 @@ public function whereGeoPolygon($field, array $points)
366366
/**
367367
* Add a whereGeoShape condition.
368368
*
369-
* @see https://www.elastic.co/guide/en/elasticsearch/guide/current/querying-geo-shapes.html Querying Geo Shapes
369+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-shape-query.html Querying Geo Shapes
370370
*
371371
* @param string $field
372372
* @param array $shape
373+
* @param string $relation
373374
* @return $this
374375
*/
375-
public function whereGeoShape($field, array $shape)
376+
public function whereGeoShape($field, array $shape, $relation = 'INTERSECTS')
376377
{
377378
$this->wheres['must'][] = [
378379
'geo_shape' => [
379380
$field => [
380381
'shape' => $shape,
381-
],
382+
'relation' => $relation
383+
]
382384
],
383385
];
384386

tests/Builders/FilterBuilderTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,10 @@ public function testWhereGeoShape()
350350
],
351351
];
352352

353+
$relation = 'WITHIN';
354+
353355
$builder = (new FilterBuilder($this->mockModel()))
354-
->whereGeoShape('foo', $shape);
356+
->whereGeoShape('foo', $shape, $relation);
355357

356358
$this->assertEquals(
357359
[
@@ -360,6 +362,7 @@ public function testWhereGeoShape()
360362
'geo_shape' => [
361363
'foo' => [
362364
'shape' => $shape,
365+
'relation' => $relation
363366
],
364367
],
365368
],

0 commit comments

Comments
 (0)