Skip to content

Commit 697d907

Browse files
committed
Merge remote-tracking branch 'origin/dev' into dev-l9
2 parents 547adaa + 47dc66d commit 697d907

File tree

4 files changed

+33
-5
lines changed

4 files changed

+33
-5
lines changed

src/DSL/QueryBuilder.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ private function _parseCondition($condition): array
313313
case 'not_between':
314314
$queryPart = ['bool' => ['must_not' => ['range' => [$field => ['gte' => $operand[0], 'lte' => $operand[1]]]]]];
315315
break;
316+
case 'phrase':
317+
$queryPart = ['match_phrase' => [$field => $operand]];
318+
break;
316319
case 'nested':
317320
$queryPart = [
318321
'nested' => [

src/Eloquent/Docs/ModelDocs.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
* @method search(array $columns = '*')
2020
* @method query(array $columns = '*')
2121
*
22+
* @method $this where(string $column, string $value)
23+
* @method $this whereIn(string $column, array $values)
24+
* @method $this wherePhrase(string $column, string $value)
2225
* @method $this filterGeoBox(string $column, array $topLeftCoords, array $bottomRightCoords)
2326
* @method $this filterGeoPoint(string $column, string $distance, array $point)
2427
* @method $this whereRegex(string $column, string $regex)

src/Query/Builder.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,25 @@ public function whereNotNestedObject($column, $callBack, $scoreMode = 'avg')
323323
return $this;
324324
}
325325

326-
326+
/**
327+
* @param $column
328+
* @param $value
329+
*
330+
* @return $this
331+
*/
332+
public function wherePhrase($column, $value)
333+
{
334+
$boolean = 'and';
335+
$this->wheres[] = [
336+
'column' => $column,
337+
'type' => 'Basic',
338+
'value' => $value,
339+
'operator' => 'phrase',
340+
'boolean' => $boolean,
341+
];
342+
343+
return $this;
344+
}
327345

328346

329347
//----------------------------------------------------------------------

src/Schema/IndexBlueprint.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ public function geo($field): Definitions\FieldDefinition
8888
return $this->addField('geo_point', $field);
8989
}
9090

91-
public function nested($field): Definitions\FieldDefinition
91+
public function nested($field, $params = []): Definitions\FieldDefinition
9292
{
93-
return $this->addField('nested', $field);
93+
return $this->addField('nested', $field, $params);
9494
}
9595

9696
public function alias($field, $path): Definitions\FieldDefinition
@@ -118,6 +118,10 @@ public function map($key, $value): void
118118
$this->parameters['map'][$key] = $value;
119119
}
120120

121+
public function field($type, $field, array $parameters = [])
122+
{
123+
return $this->addField($type, $field, $parameters);
124+
}
121125

122126
//----------------------------------------------------------------------
123127
// Definitions
@@ -173,12 +177,12 @@ public function buildIndexModify(Connection $connection)
173177

174178
public function increments($column)
175179
{
176-
return $this->addField('text', $column);
180+
return $this->addField('keyword', $column);
177181
}
178182

179183
public function string($column)
180184
{
181-
return $this->addField('text', $column);
185+
return $this->addField('keyword', $column);
182186
}
183187

184188

0 commit comments

Comments
 (0)