Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@
* text=auto eol=lf

# Exclude non-essential files from dist
/.github export-ignore
/.* export-ignore
/*.dist export-ignore
/.neon export-ignore
/docs export-ignore
/benchmark export-ignore
/phpbench.json export-ignore
/tests export-ignore
/tools export-ignore
/.doctrine-project.json export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.gitmodules export-ignore
/.scrutinizer.yml export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

namespace Doctrine\ODM\MongoDB\Aggregation\Stage\Search;

use GeoJson\Geometry\LineString;
use GeoJson\Geometry\MultiPolygon;
use GeoJson\Geometry\Point;
use GeoJson\Geometry\Polygon;
use MongoDB\BSON\ObjectId;
use MongoDB\BSON\UTCDateTime;

interface CompoundSearchOperatorInterface extends SupportsCompoundableSearchOperators
{
public function must(): Compound;
Expand All @@ -13,4 +20,39 @@ public function mustNot(): Compound;
public function should(?int $minimumShouldMatch = null): Compound;

public function filter(): Compound;

public function autocomplete(string $path = '', string ...$query): Autocomplete&CompoundSearchOperatorInterface;

public function embeddedDocument(string $path = ''): EmbeddedDocument&CompoundSearchOperatorInterface;

/** @param string|int|float|ObjectId|UTCDateTime|null $value */
public function equals(string $path = '', $value = null): Equals&CompoundSearchOperatorInterface;

public function exists(string $path): Exists&CompoundSearchOperatorInterface;

/** @param LineString|Point|Polygon|MultiPolygon|array<string, mixed>|null $geometry */
public function geoShape($geometry = null, string $relation = '', string ...$path): GeoShape&CompoundSearchOperatorInterface;

public function geoWithin(string ...$path): GeoWithin&CompoundSearchOperatorInterface;

/** @param array<string, mixed>|object $documents */
public function moreLikeThis(...$documents): MoreLikeThis&CompoundSearchOperatorInterface;

/**
* @param int|float|UTCDateTime|array<string, mixed>|Point|null $origin
* @param int|float|null $pivot
*/
public function near($origin = null, $pivot = null, string ...$path): Near&CompoundSearchOperatorInterface;

public function phrase(): Phrase&CompoundSearchOperatorInterface;

public function queryString(string $query = '', string $defaultPath = ''): QueryString&CompoundSearchOperatorInterface;

public function range(): Range&CompoundSearchOperatorInterface;

public function regex(): Regex&CompoundSearchOperatorInterface;

public function text(): Text&CompoundSearchOperatorInterface;

public function wildcard(): Wildcard&CompoundSearchOperatorInterface;
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function exists(string $path): Exists
return $this->addOperator(new Exists($this->getSearchStage(), $path));
}

/** @param LineString|Point|Polygon|MultiPolygon|array|null $geometry */
/** @param LineString|Point|Polygon|MultiPolygon|array<string, mixed>|null $geometry */
public function geoShape($geometry = null, string $relation = '', string ...$path): GeoShape
{
return $this->addOperator(new GeoShape($this->getSearchStage(), $geometry, $relation, ...$path));
Expand All @@ -70,8 +70,8 @@ public function moreLikeThis(...$documents): MoreLikeThis
}

/**
* @param int|float|UTCDateTime|array|Point|null $origin
* @param int|float|null $pivot
* @param int|float|UTCDateTime|array<string, mixed>|Point|null $origin
* @param int|float|null $pivot
*/
public function near($origin = null, $pivot = null, string ...$path): Near
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,103 +45,79 @@ abstract protected function getAddOperatorClosure(): Closure;
*/
abstract protected function addOperator(SearchOperator $operator): SearchOperator;

/** return Autocomplete&CompoundSearchOperatorInterface */
public function autocomplete(string $path = '', string ...$query): Autocomplete
public function autocomplete(string $path = '', string ...$query): Autocomplete&CompoundSearchOperatorInterface
{
return $this->addOperator(new CompoundedAutocomplete($this->getCompoundStage(), $this->getAddOperatorClosure(), $this->getSearchStage(), $path, ...$query));
}

/** @return EmbeddedDocument&CompoundSearchOperatorInterface */
public function embeddedDocument(string $path = ''): EmbeddedDocument
public function embeddedDocument(string $path = ''): EmbeddedDocument&CompoundSearchOperatorInterface
{
return $this->addOperator(new CompoundedEmbeddedDocument($this->getCompoundStage(), $this->getAddOperatorClosure(), $this->getSearchStage(), $path));
}

/**
* @param string|int|float|ObjectId|UTCDateTime|null $value
*
* @return Equals&CompoundSearchOperatorInterface
*/
public function equals(string $path = '', $value = null): Equals
/** @param string|int|float|ObjectId|UTCDateTime|null $value */
public function equals(string $path = '', $value = null): Equals&CompoundSearchOperatorInterface
{
return $this->addOperator(new CompoundedEquals($this->getCompoundStage(), $this->getAddOperatorClosure(), $this->getSearchStage(), $path, $value));
}

/** @return Exists&CompoundSearchOperatorInterface */
public function exists(string $path): Exists
public function exists(string $path): Exists&CompoundSearchOperatorInterface
{
return $this->addOperator(new CompoundedExists($this->getCompoundStage(), $this->getAddOperatorClosure(), $this->getSearchStage(), $path));
}

/**
* @param LineString|Point|Polygon|MultiPolygon|array|null $geometry
*
* @return GeoShape&CompoundSearchOperatorInterface
*/
public function geoShape($geometry = null, string $relation = '', string ...$path): GeoShape
/** @param LineString|Point|Polygon|MultiPolygon|array<string, mixed>|null $geometry */
public function geoShape($geometry = null, string $relation = '', string ...$path): GeoShape&CompoundSearchOperatorInterface
{
return $this->addOperator(new CompoundedGeoShape($this->getCompoundStage(), $this->getAddOperatorClosure(), $this->getSearchStage(), $geometry, $relation, ...$path));
}

/** @return GeoWithin&CompoundSearchOperatorInterface */
public function geoWithin(string ...$path): GeoWithin
public function geoWithin(string ...$path): GeoWithin&CompoundSearchOperatorInterface
{
return $this->addOperator(new CompoundedGeoWithin($this->getCompoundStage(), $this->getAddOperatorClosure(), $this->getSearchStage(), ...$path));
}

/**
* @param array<string, mixed>|object $documents
*
* @return MoreLikeThis&CompoundSearchOperatorInterface
*/
public function moreLikeThis(...$documents): MoreLikeThis
/** @param array<string, mixed>|object $documents */
public function moreLikeThis(...$documents): MoreLikeThis&CompoundSearchOperatorInterface
{
return $this->addOperator(new CompoundedMoreLikeThis($this->getCompoundStage(), $this->getAddOperatorClosure(), $this->getSearchStage(), ...$documents));
}

/**
* @param int|float|UTCDateTime|array|Point|null $origin
* @param int|float|null $pivot
*
* @return Near&CompoundSearchOperatorInterface
* @param int|float|UTCDateTime|array<string, mixed>|Point|null $origin
* @param int|float|null $pivot
*/
public function near($origin = null, $pivot = null, string ...$path): Near
public function near($origin = null, $pivot = null, string ...$path): Near&CompoundSearchOperatorInterface
{
return $this->addOperator(new CompoundedNear($this->getCompoundStage(), $this->getAddOperatorClosure(), $this->getSearchStage(), $origin, $pivot, ...$path));
}

/** @return Phrase&CompoundSearchOperatorInterface */
public function phrase(): Phrase
public function phrase(): Phrase&CompoundSearchOperatorInterface
{
return $this->addOperator(new CompoundedPhrase($this->getCompoundStage(), $this->getAddOperatorClosure(), $this->getSearchStage()));
}

/** @return QueryString&CompoundSearchOperatorInterface */
public function queryString(string $query = '', string $defaultPath = ''): QueryString
public function queryString(string $query = '', string $defaultPath = ''): QueryString&CompoundSearchOperatorInterface
{
return $this->addOperator(new CompoundedQueryString($this->getCompoundStage(), $this->getAddOperatorClosure(), $this->getSearchStage(), $query, $defaultPath));
}

/** @return Range&CompoundSearchOperatorInterface */
public function range(): Range
public function range(): Range&CompoundSearchOperatorInterface
{
return $this->addOperator(new CompoundedRange($this->getCompoundStage(), $this->getAddOperatorClosure(), $this->getSearchStage()));
}

/** @return Regex&CompoundSearchOperatorInterface */
public function regex(): Regex
public function regex(): Regex&CompoundSearchOperatorInterface
{
return $this->addOperator(new CompoundedRegex($this->getCompoundStage(), $this->getAddOperatorClosure(), $this->getSearchStage()));
}

/** @return Text&CompoundSearchOperatorInterface */
public function text(): Text
public function text(): Text&CompoundSearchOperatorInterface
{
return $this->addOperator(new CompoundedText($this->getCompoundStage(), $this->getAddOperatorClosure(), $this->getSearchStage()));
}

/** @return Wildcard&CompoundSearchOperatorInterface */
public function wildcard(): Wildcard
public function wildcard(): Wildcard&CompoundSearchOperatorInterface
{
return $this->addOperator(new CompoundedWildcard($this->getCompoundStage(), $this->getAddOperatorClosure(), $this->getSearchStage()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

interface SupportsGeoShapeOperator
{
/** @param LineString|Point|Polygon|MultiPolygon|array|null $geometry */
/** @param LineString|Point|Polygon|MultiPolygon|array<string, mixed>|null $geometry */
public function geoShape($geometry = null, string $relation = '', string ...$path): GeoShape;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
interface SupportsNearOperator
{
/**
* @param int|float|UTCDateTime|array|Point|null $origin
* @param int|float|null $pivot
* @param int|float|UTCDateTime|array<string, mixed>|Point|null $origin
* @param int|float|null $pivot
*/
public function near($origin = null, $pivot = null, string ...$path): Near;
}
Loading