hkulekci / qdrant-php

Qdrant is a vector similarity engine & vector database. It deploys as an API service providing search for the nearest high-dimensional vectors. With Qdrant, embeddings or neural network encoders can be turned into full-fledged applications for matching, searching, recommending, and much more!
MIT License
93 stars 21 forks source link

Use php feature constructor property promotion #35

Closed NiCr42 closed 1 year ago

codecov[bot] commented 1 year ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (5627d6e) 87.99% compared to head (46c3a43) 89.10%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #35 +/- ## ============================================ + Coverage 87.99% 89.10% +1.11% + Complexity 291 290 -1 ============================================ Files 58 58 Lines 966 936 -30 ============================================ - Hits 850 834 -16 + Misses 116 102 -14 ``` | [Flag](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/35/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/35/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0) | `89.10% <100.00%> (+1.11%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/35?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0) | Coverage Δ | | |---|---|---| | [src/Config.php](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/35?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#diff-c3JjL0NvbmZpZy5waHA=) | `100.00% <100.00%> (ø)` | | | [src/Endpoints/AbstractEndpoint.php](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/35?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#diff-c3JjL0VuZHBvaW50cy9BYnN0cmFjdEVuZHBvaW50LnBocA==) | `86.95% <100.00%> (ø)` | | | [src/Http/GuzzleClient.php](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/35?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#diff-c3JjL0h0dHAvR3V6emxlQ2xpZW50LnBocA==) | `71.42% <100.00%> (-1.30%)` | :arrow_down: | | [src/Models/Filter/Condition/AbstractCondition.php](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/35?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#diff-c3JjL01vZGVscy9GaWx0ZXIvQ29uZGl0aW9uL0Fic3RyYWN0Q29uZGl0aW9uLnBocA==) | `100.00% <100.00%> (ø)` | | | [src/Models/Filter/Condition/FullTextMatch.php](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/35?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#diff-c3JjL01vZGVscy9GaWx0ZXIvQ29uZGl0aW9uL0Z1bGxUZXh0TWF0Y2gucGhw) | `100.00% <100.00%> (ø)` | | | [src/Models/Filter/Condition/GeoBoundingBox.php](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/35?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#diff-c3JjL01vZGVscy9GaWx0ZXIvQ29uZGl0aW9uL0dlb0JvdW5kaW5nQm94LnBocA==) | `100.00% <100.00%> (ø)` | | | [src/Models/Filter/Condition/GeoRadius.php](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/35?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#diff-c3JjL01vZGVscy9GaWx0ZXIvQ29uZGl0aW9uL0dlb1JhZGl1cy5waHA=) | `100.00% <100.00%> (ø)` | | | [src/Models/Filter/Condition/HasId.php](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/35?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#diff-c3JjL01vZGVscy9GaWx0ZXIvQ29uZGl0aW9uL0hhc0lkLnBocA==) | `100.00% <100.00%> (ø)` | | | [src/Models/Filter/Condition/MatchAny.php](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/35?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#diff-c3JjL01vZGVscy9GaWx0ZXIvQ29uZGl0aW9uL01hdGNoQW55LnBocA==) | `100.00% <100.00%> (ø)` | | | [src/Models/Filter/Condition/MatchBool.php](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/35?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#diff-c3JjL01vZGVscy9GaWx0ZXIvQ29uZGl0aW9uL01hdGNoQm9vbC5waHA=) | `100.00% <100.00%> (ø)` | | | ... and [17 more](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/35?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0) | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

hkulekci commented 1 year ago

Hey @NiCr42 thanks for contributing. I rerun the pipeline. Lets see. We can merge if it pass.

hkulekci commented 1 year ago

Hey @NiCr42, we did not have a test for the Point class. So, for this reason, whenever you change that class coverage, expect a unit test for it. Could you please add the following test to your branch?

Need to be created as tests/Unit/Models/Request/PointTest.php

<?php
/**
 * @since     Mar 2023
 * @author    Haydar KULEKCI <haydarkulekci@gmail.com>
 */

namespace Qdrant\Tests\Unit\Models\Request;

use PHPUnit\Framework\TestCase;
use Qdrant\Models\Request\Point;
use Qdrant\Models\VectorStruct;

class PointTest extends TestCase
{
    public function testValidBasic(): void
    {
        $point = new Point(
            '1',
            new VectorStruct([1, 2, 3])
        );

        $this->assertEquals([
            'id' => '1',
            'vector' => [1, 2, 3]
        ], $point->toArray());
    }

    public function testValidBasicWithArrayVector(): void
    {
        $point = new Point(
            '1',
            [1, 2, 3]
        );

        $this->assertEquals([
            'id' => '1',
            'vector' => [1, 2, 3]
        ], $point->toArray());
    }

    public function testValidBasicWithPayload(): void
    {
        $point = new Point(
            '1',
            [1, 2, 3],
            ['foo' => 'bar']
        );

        $this->assertEquals([
            'id' => '1',
            'vector' => [1, 2, 3],
            'payload' => ['foo' => 'bar']
        ], $point->toArray());
    }
}
hkulekci commented 1 year ago

Other than this, LGTM. Thanks again. I've wanted to do this for a long time but could not find a chance.

NiCr42 commented 1 year ago

Hello @hkulekci. It's done.