Skip to content

Commit cf2cead

Browse files
committed
fix fulltext search
1 parent 3edec92 commit cf2cead

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

.github/workflows/test-application.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
pull_request:
55
push:
66
branches:
7-
- 'master'
87
- '[0-9]+.x'
98
- '[0-9]+.[0-9]+'
109
- '[0-9]+.[0-9]+.x'

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Changelog
22
=========
33

4+
1.8.0
5+
-----
6+
7+
* Fixed handling of QOM fulltext search expression which should never be string but a `QOM\StaticOperandInterface`.
8+
49
1.7.0
510
-----
611

composer.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,5 @@
4747
"PHPCR\\Util": "src"
4848
}
4949
},
50-
"bin": ["bin/phpcr"],
51-
"extra": {
52-
"branch-alias": {
53-
"dev-master": "1.x-dev"
54-
}
55-
}
50+
"bin": ["bin/phpcr"]
5651
}

src/PHPCR/Util/QOM/BaseQomToSqlQueryConverter.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use InvalidArgumentException;
66
use PHPCR\Query\QOM;
7+
use PHPCR\Query\QOM\StaticOperandInterface;
78

89
/**
910
* Common base class for the SQL(1) and SQL2 converters.
@@ -170,14 +171,23 @@ protected function convertFullTextSearch(QOM\FullTextSearchInterface $constraint
170171
/**
171172
* FullTextSearchExpression ::= BindVariable | ''' FullTextSearchLiteral '''.
172173
*
173-
* @param string $expr
174+
* @param string|QOM\StaticOperandInterface $expr
174175
*
175176
* @return string
176177
*/
177178
protected function convertFullTextSearchExpression($expr)
178179
{
179180
if ($expr instanceof QOM\BindVariableValueInterface) {
180-
return $this->convertBindVariable($expr);
181+
return $this->convertBindVariable($expr->getBindVariableName());
182+
}
183+
if ($expr instanceof QOM\LiteralInterface) {
184+
$literal = $expr->getLiteralValue();
185+
} elseif (is_string($expr)) {
186+
// this should not happen, the interface for full text search declares the return type to be StaticOperandInterface
187+
// however, without type checks, jackalope 1.0 got this wrong and returned a string.
188+
$literal = $expr;
189+
} else {
190+
throw new InvalidArgumentException('Unknown full text search expression type '.get_class($expr));
181191
}
182192

183193
$expr = $this->generator->evalFullText($expr);

0 commit comments

Comments
 (0)