Skip to content

Commit

Permalink
added multiple range fields in search; added short and long data type…
Browse files Browse the repository at this point in the history
…s to keyword type props in search query filters
  • Loading branch information
Elegi Sandi committed Sep 26, 2018
1 parent e224ab6 commit 3b4b394
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/ElasticSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ private function search(array $query = [], array $options = [], array $range = [

// set date range if not empty
if (!empty($range)) {
$filters['must'][] = ['range' => $range];
foreach ($range as $field => $value) {
$filters['must'][] = ['range' => [$field => $value]];
}
}

// set bool query if filters not empty
Expand Down
4 changes: 2 additions & 2 deletions src/Traits/ElasticSearchHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ protected function setSearchQueryFilters(Collection $query, array $bool_clauses
$text_type_props = $this->getMappingPropertiesByDataType($properties, 'text');

// get keyword type properties
// included types: keyword, ip, integer, array
$keyword_type_props = $this->getMappingPropertiesByDataType($properties, ['keyword', 'ip', 'integer', 'array']);
// included types: keyword, ip, integer, short, long
$keyword_type_props = $this->getMappingPropertiesByDataType($properties, ['keyword', 'ip', 'integer', 'short', 'long']);

// get boolean type properties
$bool_type_props = $this->getMappingPropertiesByDataType($properties, 'boolean');
Expand Down

0 comments on commit 3b4b394

Please sign in to comment.