Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
PSDI Army
yii2
Commits
98a86ce7
Commit
98a86ce7
authored
Jul 21, 2014
by
Klimov Paul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sphinx distributed indexes support provided
parent
10d617a9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
5 deletions
+43
-5
CHANGELOG.md
extensions/sphinx/CHANGELOG.md
+1
-0
Schema.php
extensions/sphinx/Schema.php
+12
-5
sphinx.conf
tests/unit/data/sphinx/sphinx.conf
+7
-0
QueryTest.php
tests/unit/extensions/sphinx/QueryTest.php
+23
-0
No files found.
extensions/sphinx/CHANGELOG.md
View file @
98a86ce7
...
@@ -6,6 +6,7 @@ Yii Framework 2 sphinx extension Change Log
...
@@ -6,6 +6,7 @@ Yii Framework 2 sphinx extension Change Log
-
Bug #3668: Escaping of the special characters at 'MATCH' statement added (klimov-paul)
-
Bug #3668: Escaping of the special characters at 'MATCH' statement added (klimov-paul)
-
Bug #4018: AR relation eager loading does not work with db models (klimov-paul)
-
Bug #4018: AR relation eager loading does not work with db models (klimov-paul)
-
Bug #4375: Distributed indexes support provided (klimov-paul)
-
Enh #3520: Added
`unlinkAll()`
-method to active record to remove all records of a model relation (NmDimas, samdark, cebe)
-
Enh #3520: Added
`unlinkAll()`
-method to active record to remove all records of a model relation (NmDimas, samdark, cebe)
-
Enh #4048: Added
`init`
event to
`ActiveQuery`
classes (qiangxue)
-
Enh #4048: Added
`init`
event to
`ActiveQuery`
classes (qiangxue)
-
Enh #4086: changedAttributes of afterSave Event now contain old values (dizews)
-
Enh #4086: changedAttributes of afterSave Event now contain old values (dizews)
...
...
extensions/sphinx/Schema.php
View file @
98a86ce7
...
@@ -459,12 +459,19 @@ class Schema extends Object
...
@@ -459,12 +459,19 @@ class Schema extends Object
}
}
throw
$e
;
throw
$e
;
}
}
foreach
(
$columns
as
$info
)
{
$column
=
$this
->
loadColumnSchema
(
$info
);
if
(
empty
(
$columns
[
0
][
'Agent'
]))
{
$index
->
columns
[
$column
->
name
]
=
$column
;
foreach
(
$columns
as
$info
)
{
if
(
$column
->
isPrimaryKey
)
{
$column
=
$this
->
loadColumnSchema
(
$info
);
$index
->
primaryKey
=
$column
->
name
;
$index
->
columns
[
$column
->
name
]
=
$column
;
if
(
$column
->
isPrimaryKey
)
{
$index
->
primaryKey
=
$column
->
name
;
}
}
}
}
else
{
// Distributed index :
$agent
=
$this
->
getIndexSchema
(
$columns
[
0
][
'Agent'
]);
$index
->
columns
=
$agent
->
columns
;
}
}
return
true
;
return
true
;
...
...
tests/unit/data/sphinx/sphinx.conf
View file @
98a86ce7
...
@@ -101,6 +101,13 @@ index yii2_test_rt_index
...
@@ -101,6 +101,13 @@ index yii2_test_rt_index
}
}
index
yii2_test_distributed
{
type
=
distributed
local
=
yii2_test_article_index
}
indexer
indexer
{
{
mem_limit
=
32
M
mem_limit
=
32
M
...
...
tests/unit/extensions/sphinx/QueryTest.php
View file @
98a86ce7
...
@@ -324,4 +324,27 @@ class QueryTest extends SphinxTestCase
...
@@ -324,4 +324,27 @@ class QueryTest extends SphinxTestCase
->
all
(
$connection
);
->
all
(
$connection
);
$this
->
assertNotEmpty
(
$rows
);
$this
->
assertNotEmpty
(
$rows
);
}
}
/**
* @depends testRun
*
* @see https://github.com/yiisoft/yii2/issues/4375
*/
public
function
testRunOnDistributedIndex
()
{
$connection
=
$this
->
getConnection
();
$query
=
new
Query
;
$rows
=
$query
->
from
(
'yii2_test_distributed'
)
->
match
(
'about'
)
->
options
([
'cutoff'
=>
50
,
'field_weights'
=>
[
'title'
=>
10
,
'content'
=>
3
,
],
])
->
all
(
$connection
);
$this
->
assertNotEmpty
(
$rows
);
}
}
}
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