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
08bec685
Commit
08bec685
authored
Oct 17, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
f8e2c314
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
32 deletions
+16
-32
Search.php
lib/Doctrine/Search.php
+3
-5
Query.php
lib/Doctrine/Search/Query.php
+10
-24
Searchable.php
lib/Doctrine/Template/Searchable.php
+3
-3
No files found.
lib/Doctrine/Search.php
View file @
08bec685
...
...
@@ -66,9 +66,9 @@ class Doctrine_Search extends Doctrine_Plugin
{
$q
=
new
Doctrine_Search_Query
(
$this
->
_options
[
'pluginTable'
]);
$q
->
search
(
$query
);
$q
->
query
(
$query
);
return
$
q
->
execute
()
;
return
$
this
->
_options
[
'connection'
]
->
fetchAll
(
$q
->
getSql
(),
$q
->
getParams
());
;
}
public
function
analyze
(
$text
)
...
...
@@ -145,7 +145,7 @@ class Doctrine_Search extends Doctrine_Plugin
public
function
processPending
(
$limit
=
null
,
$offset
=
null
)
public
function
batchUpdateIndex
(
$limit
=
null
,
$offset
=
null
)
{
$this
->
buildDefinition
();
...
...
@@ -215,8 +215,6 @@ class Doctrine_Search extends Doctrine_Plugin
return
false
;
}
$columns
=
array
(
'keyword'
=>
array
(
'type'
=>
'string'
,
'length'
=>
200
,
'primary'
=>
true
,
...
...
lib/Doctrine/Search/Query.php
View file @
08bec685
...
...
@@ -32,10 +32,7 @@
*/
class
Doctrine_Search_Query
{
/**
* @var Doctrine_Query $query the base query
*/
protected
$_query
;
/**
* @var Doctrine_Table $_table the index table
*/
...
...
@@ -48,32 +45,27 @@ class Doctrine_Search_Query
protected
$_condition
;
/**
* @param
octrine_Table $_table
the index table
* @param
Doctrine_Table $_table
the index table
*/
public
function
__construct
(
$table
)
{
if
(
is_string
(
$table
))
{
$table
=
Doctrine_Manager
::
table
(
$table
);
}
else
{
if
(
!
$table
instanceof
Doctrine_Table
)
{
throw
new
Doctrine_Search_Exception
(
'Invalid argument type. Expected instance of Doctrine_Table.'
);
}
}
$this
->
_table
=
$table
;
$this
->
_query
=
new
Doctrine_Query
();
$foreignId
=
current
(
array_diff
(
$this
->
_table
->
getColumnNames
(),
array
(
'keyword'
,
'field'
,
'position'
)));
$this
->
_condition
=
$foreignId
.
' %s (SELECT '
.
$foreignId
.
' FROM '
.
$this
->
_table
->
getTableName
()
.
' WHERE '
;
}
/**
* getQuery
*
* @return Doctrine_Query returns the query object associated with this object
*/
public
function
getQuery
()
{
return
$this
->
_query
;
}
public
function
search
(
$text
)
public
function
query
(
$text
)
{
$text
=
trim
(
$text
);
...
...
@@ -228,10 +220,4 @@ class Doctrine_Search_Query
{
return
$this
->
_sql
;
}
public
function
execute
()
{
$resultSet
=
$this
->
_query
->
execute
();
return
$resultSet
;
}
}
lib/Doctrine/Template/Searchable.php
View file @
08bec685
...
...
@@ -62,8 +62,8 @@ class Doctrine_Template_Searchable extends Doctrine_Template
$this
->
addListener
(
new
Doctrine_Search_Listener
(
$this
->
_plugin
));
}
public
function
processPending
(
$limit
=
null
,
$offset
=
null
)
public
function
batchUpdateIndex
(
$limit
=
null
,
$offset
=
null
)
{
$this
->
_plugin
->
processPending
(
$limit
,
$offset
);
$this
->
_plugin
->
batchUpdateIndex
(
$limit
,
$offset
);
}
}
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