Skip to content

Commit

Permalink
Add LessThan, LessThanEqual, GreaterThan, GreaterThanEqual Conditions…
Browse files Browse the repository at this point in the history
… to Solr
  • Loading branch information
alexander-schranz committed Feb 1, 2023
1 parent 33b2a37 commit 1382fcd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/seal-solr-adapter/SolrConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ public function search(Search $search): Result
foreach ($search->filters as $filter) {
match (true) {
$filter instanceof Condition\SearchCondition => $queryText = $filter->query,
$filter instanceof Condition\IdentifierCondition => $filters[] = $index->getIdentifierField()->name . ':' . $filter->identifier . '', // TODO escape?
$filter instanceof Condition\EqualCondition => $filters[] = $filter->field . ':' . $filter->value . '', // TODO escape?
$filter instanceof Condition\NotEqualCondition => $filters[] = '-' . $filter->field . ':' . $filter->value . '', // TODO escape?
$filter instanceof Condition\GreaterThanCondition => $filters[] = $filter->field . ' >= ' . $filter->value . '', // TODO escape?
$filter instanceof Condition\GreaterThanEqualCondition => $filters[] = $filter->field . ' > ' . $filter->value . '', // TODO escape?
$filter instanceof Condition\LessThanCondition => $filters[] = $filter->field . ' <= ' . $filter->value . '', // TODO escape?
$filter instanceof Condition\LessThanEqualCondition => $filters[] = $filter->field . ' < ' . $filter->value . '', // TODO escape?
$filter instanceof Condition\IdentifierCondition => $filters[] = $index->getIdentifierField()->name . ':"' . $filter->identifier . '"', // TODO escape?
$filter instanceof Condition\EqualCondition => $filters[] = $filter->field . ':"' . $filter->value . '"', // TODO escape?
$filter instanceof Condition\NotEqualCondition => $filters[] = '-' . $filter->field . ':"' . $filter->value . '"', // TODO escape?
$filter instanceof Condition\GreaterThanCondition => $filters[] = $filter->field . ':{' . $filter->value . ' TO *}', // TODO escape?
$filter instanceof Condition\GreaterThanEqualCondition => $filters[] = $filter->field . ':[' . $filter->value . ' TO *]', // TODO escape?
$filter instanceof Condition\LessThanCondition => $filters[] = $filter->field . ':{* TO ' . $filter->value . '}', // TODO escape?
$filter instanceof Condition\LessThanEqualCondition => $filters[] = $filter->field . ':[* TO ' . $filter->value . ']', // TODO escape?
default => throw new \LogicException($filter::class . ' filter not implemented.'),
};
}
Expand Down

0 comments on commit 1382fcd

Please sign in to comment.