Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
5b611b53
Commit
5b611b53
authored
Jul 27, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
201f821b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
21 deletions
+20
-21
Query.php
lib/Doctrine/Search/Query.php
+20
-21
No files found.
lib/Doctrine/Search/Query.php
View file @
5b611b53
...
@@ -177,10 +177,19 @@ class Doctrine_Search_Query
...
@@ -177,10 +177,19 @@ class Doctrine_Search_Query
foreach
(
$terms
as
$term
)
{
foreach
(
$terms
as
$term
)
{
if
(
is_array
(
$term
))
{
if
(
is_array
(
$term
))
{
$parsed
=
$this
->
parseTerms
(
$term
);
$parsed
=
$this
->
parseTerms
(
$term
);
}
else
{
if
(
strpos
(
$term
,
'('
)
===
false
)
{
$parsed
=
$foreignId
.
' IN (SELECT '
.
$foreignId
.
' FROM '
.
$this
->
_table
->
getTableName
()
.
' WHERE '
.
$this
->
parseClause
(
$term
)
.
')'
;
}
else
{
}
else
{
$parsed
=
$this
->
parseClause
(
$term
);
$parsed
=
$this
->
parseClause
(
$term
);
}
}
$ret
[]
=
$foreignId
.
' IN (SELECT '
.
$foreignId
.
' FROM '
.
$this
->
_table
->
getTableName
()
.
' WHERE '
.
$parsed
.
')'
;
}
if
(
strlen
(
$parsed
)
>
20
)
{
$ret
[]
=
'('
.
$parsed
.
')'
;
}
else
{
$ret
[]
=
$parsed
;
}
}
}
$r
=
implode
(
' AND '
,
$ret
);
$r
=
implode
(
' AND '
,
$ret
);
...
@@ -193,35 +202,25 @@ class Doctrine_Search_Query
...
@@ -193,35 +202,25 @@ class Doctrine_Search_Query
}
}
public
function
parseTerms
(
array
$terms
)
public
function
parseTerms
(
array
$terms
)
{
{
$foreignId
=
current
(
array_diff
(
$this
->
_table
->
getColumnNames
(),
array
(
'keyword'
,
'field'
,
'position'
)));
if
(
count
(
$terms
)
>
1
)
{
if
(
count
(
$terms
)
>
1
)
{
$ret
=
array
();
$ret
=
array
();
foreach
(
$terms
as
$term
)
{
foreach
(
$terms
as
$term
)
{
$parsed
=
$this
->
parseClause
(
$term
);
$ret
[]
=
$this
->
parseClause
(
$term
);
if
(
strlen
(
$parsed
)
>
20
)
{
$ret
[]
=
'('
.
$parsed
.
')'
;
}
else
{
$ret
[]
=
$parsed
;
}
}
$parsed
=
implode
(
' OR '
,
$ret
);
if
(
strpos
(
$parsed
,
'('
)
===
false
)
{
$parsed
=
$foreignId
.
' IN (SELECT '
.
$foreignId
.
' FROM '
.
$this
->
_table
->
getTableName
()
.
' WHERE '
.
$parsed
.
')'
;
}
}
return
implode
(
' OR '
,
$ret
)
;
return
$parsed
;
}
else
{
}
else
{
$ret
=
$this
->
parseTerm
(
$terms
[
0
]);
$ret
=
$this
->
parseTerm
(
$terms
[
0
]);
return
$ret
[
0
];
return
$ret
[
0
];
}
}
}
}
public
function
parseAndSeparatedTerms
(
$terms
,
$foreignId
)
{
$ret
=
array
();
foreach
(
$terms
as
$term
)
{
$parsed
=
$this
->
parseClause
(
$term
);
$ret
[]
=
$foreignId
.
' IN (SELECT '
.
$foreignId
.
' FROM '
.
$this
->
_table
->
getTableName
()
.
' WHERE '
.
$parsed
.
')'
;
}
$r
=
implode
(
' AND '
,
$ret
);
}
public
function
parseTerm
(
$term
)
public
function
parseTerm
(
$term
)
{
{
if
(
strpos
(
$term
,
"'"
)
===
false
)
{
if
(
strpos
(
$term
,
"'"
)
===
false
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment