Skip to content

Commit

Permalink
feat: version 6 update
Browse files Browse the repository at this point in the history
  • Loading branch information
gskema committed Oct 25, 2023
1 parent 343dfdc commit 36f54c6
Show file tree
Hide file tree
Showing 388 changed files with 4,844 additions and 4,552 deletions.
15 changes: 0 additions & 15 deletions .editorconfig

This file was deleted.

7 changes: 4 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
* text=auto

# Ignore all test and documentation with "export-ignore".
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/tests export-ignore
/docs export-ignore
/build export-ignore
/phpcs.xml export-ignore
/phpunit.xml export-ignore
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI

on:
push:
branches:
- 6.x
- 7.x

env:
FORCE_COLOR: 1

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: ['8.1', '8.2']

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: xdebug

- name: Install dependencies
run: |
composer self-update
composer install
- name: Tests & Style
run: |
composer test-coverage
composer phpcs
- name: Upload Coverage
if: github.repository_owner == 'gskema'
run: composer upload-coverage
30 changes: 0 additions & 30 deletions .scrutinizer.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@ All notable changes to `elasticsearch-query-dsl-php` will be documented in this

Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.

## [6.0.0] - 2023-10-*
### Added
- TermsSetMatcher
- WrapperMatcher
- AutoIntervalDateHistogramAggregation
- CompositeAggregation
- ParentAggregation
- SignificantTextAggregation
- MedianAbsoluteDeviationAggregation
- WeightedAvgAggregation
- BucketSortAggregation
- MovingFunctionAggregation
- `SourceFilterInterface|array|null` for simplified usage

### Changed
- Parameter, property, return types
- Renamed `RegexMatcher` to `RegexpMatcher`

### Removed
- GeoDistanceRangeMatcher
- IndicesMatcher
- TemplateMatcher

## [5.0.1] - 2018-11-04
### Added
- Documentation for using RangeMatcher with range mapping type
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Gytis Šk.
Copyright (c) 2023 Gytis Šk.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# ElasticSearch Query DSL

[![Latest Version on Packagist][ico-version]][link-packagist]
[![Build Status][ico-travis]][link-travis]
[![Software License][ico-license]](LICENSE.md)
[![Build Status][ico-build]][link-build]
[![Coverage Status][ico-scrutinizer]][link-scrutinizer]
[![Quality Score][ico-code-quality]][link-code-quality]
[![Total Downloads][ico-downloads]][link-downloads]
Expand All @@ -13,20 +14,23 @@ Feature complete, object oriented, composable, extendable ElasticSearch query DS
- Dependency free
- Can be used with any PHP ElasticSearch client
- Fully interfaced, ready for custom classes
- Explicit class and property naming, fully matches produced JSON
- Explicit class and property naming, fully matches produced JSON and ElasticSearch docs
- All configuration options are listed inside classes, links to documentation
- Classes can be easily composed, extended
- Design that is easy to test and maintain
- Chainable methods
- Usage of setters/getters so that everything can be inlined and chained.
- Fully working `::__clone()` methods
- Extendable code: no usage of `private`, `final` or `readonly`
- Basic objects created on `__construct`, no unnecessary body build logic until `jsonSerialize()` is called

## Versions

Most of the classes should be compatible with any ElasticSearch versions.
If something is not compatible or not supported, `Raw*` or custom classes can be used.

| Package version | ElasticSearch version |
| ----------------| ----------------------|
|-----------------|-----------------------|
| >=6.0.0 <7.0.0 | >=6.0.0 <7.0.0 |
| >=5.0.0 <6.0.0 | >=5.0.0 <6.0.0 |

Because major version number follows ElasticSearch major version number, second number is reserved for breaking changes.
Expand Down Expand Up @@ -56,6 +60,14 @@ $searchRequest->setAgg(
(new ElasticSearchClient())->search($searchRequest->jsonSerialize());
```

## Matcher?

Request object that is received by ElasticSearch `/_search/` has many properties and sub-properties
like `query`, `filter`, `post_filter`, etc.

To avoid convoluted expressions like `(new SearchRequest())->setQuery((new BoolQuery()->addFilter(new TermQuery('))`
keyword `matcher` was explicitly chosen.

## Change log

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
Expand All @@ -75,14 +87,14 @@ Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

[ico-version]: https://img.shields.io/packagist/v/gskema/elasticsearch-query-dsl-php.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/gskema/elasticsearch-query-dsl-php/master.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[ico-build]: https://img.shields.io/github/actions/workflow/status/gskema/elasticsearch-query-dsl-php/ci.yml?branch=81.x
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/gskema/elasticsearch-query-dsl-php.svg?style=flat-square
[ico-code-quality]: https://img.shields.io/scrutinizer/g/gskema/elasticsearch-query-dsl-php.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/gskema/elasticsearch-query-dsl-php.svg?style=flat-square

[link-packagist]: https://packagist.org/packages/gskema/elasticsearch-query-dsl-php
[link-travis]: https://travis-ci.org/gskema/elasticsearch-query-dsl-php
[link-build]: https://github.com/gskema/elasticsearch-query-dsl-php/actions
[link-scrutinizer]: https://scrutinizer-ci.com/g/gskema/elasticsearch-query-dsl-php/code-structure
[link-code-quality]: https://scrutinizer-ci.com/g/gskema/elasticsearch-query-dsl-php
[link-downloads]: https://packagist.org/packages/gskema/elasticsearch-query-dsl-php
[link-contributors]: ../../contributors
23 changes: 11 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
}
],
"require": {
"php" : "^7.0",
"ext-json": "*"
"php": "^8.1",
"ext-json": "*",
"gskema/phpcs-type-sniff": "^81.3"
},
"require-dev": {
"phpunit/phpunit" : "^6.5",
"squizlabs/php_codesniffer": "^2.6.2"
"phpunit/phpunit" : "^10.4",
"squizlabs/php_codesniffer": "^3.7",
"scrutinizer/ocular": "^1.9"
},
"autoload": {
"psr-4": {
Expand All @@ -33,14 +35,11 @@
"psr-4": { "Gskema\\ElasticSearchQueryDSL\\": "tests/" }
},
"scripts": {
"test": "phpunit",
"check-style": "phpcs -p --standard=PSR2 --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 src tests --exclude=Generic.Files.LineLength",
"fix-style": "phpcbf -p --standard=PSR2 --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 src tests"
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
"test": "vendor/bin/phpunit",
"test-coverage": "vendor/bin/phpunit --coverage-clover=clover.xml",
"test-coverage-local": "php -d xdebug.mode=coverage ./vendor/bin/phpunit --coverage-html=build/coverage",
"upload-coverage": "vendor/bin/ocular code-coverage:upload --format=php-clover coverage.xml;",
"style": "@composer prep && ./vendor/bin/phpcs --standard=phpcs.xml -p"
},
"config": {
"sort-packages": true
Expand Down
18 changes: 18 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<ruleset name="phpcs_ruleset">
<!-- @see https://github.com/squizlabs/PHP_CodeSniffer/wiki -->
<description>~</description>

<arg name="extensions" value="php"/>
<arg name="cache" value="build/phpcs.cache" />
<file>src</file>
<file>tests</file>

<rule ref="PSR12">
<exclude name="Generic.Files.LineLength" />
</rule>

<autoload>./vendor/autoload.php</autoload>
<rule ref="./vendor/gskema/phpcs-type-sniff/src/Sniffs/CompositeCodeElementSniff.php" />

</ruleset>
43 changes: 21 additions & 22 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<phpunit
bootstrap="./vendor/autoload.php"
cacheDirectory="./build/.phpunit.cache"
colors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnSkippedTests="true"
processIsolation="false"
stopOnFailure="false"
>
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
<testsuite name="Tests">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>

<coverage>
<report>
<html outputDirectory="./build/coverage" lowUpperBound="35" highLowerBound="70"/>
<clover outputFile="./build/clover.xml"/>
</report>
</coverage>
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<junit outputFile="./build/junit.xml"/>
</logging>
</phpunit>
2 changes: 1 addition & 1 deletion src/Aggregation/AggregationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use JsonSerializable;

/**
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/search-aggregations.html
* @see https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search-aggregations.html
*/
interface AggregationInterface extends JsonSerializable
{
Expand Down
Loading

0 comments on commit 36f54c6

Please sign in to comment.