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
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
0 deletions
+38
-0
CHANGELOG.md
extensions/sphinx/CHANGELOG.md
+1
-0
Schema.php
extensions/sphinx/Schema.php
+7
-0
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
-
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 #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 #4048: Added
`init`
event to
`ActiveQuery`
classes (qiangxue)
-
Enh #4086: changedAttributes of afterSave Event now contain old values (dizews)
...
...
extensions/sphinx/Schema.php
View file @
98a86ce7
...
...
@@ -459,6 +459,8 @@ class Schema extends Object
}
throw
$e
;
}
if
(
empty
(
$columns
[
0
][
'Agent'
]))
{
foreach
(
$columns
as
$info
)
{
$column
=
$this
->
loadColumnSchema
(
$info
);
$index
->
columns
[
$column
->
name
]
=
$column
;
...
...
@@ -466,6 +468,11 @@ class Schema extends Object
$index
->
primaryKey
=
$column
->
name
;
}
}
}
else
{
// Distributed index :
$agent
=
$this
->
getIndexSchema
(
$columns
[
0
][
'Agent'
]);
$index
->
columns
=
$agent
->
columns
;
}
return
true
;
}
...
...
tests/unit/data/sphinx/sphinx.conf
View file @
98a86ce7
...
...
@@ -101,6 +101,13 @@ index yii2_test_rt_index
}
index
yii2_test_distributed
{
type
=
distributed
local
=
yii2_test_article_index
}
indexer
{
mem_limit
=
32
M
...
...
tests/unit/extensions/sphinx/QueryTest.php
View file @
98a86ce7
...
...
@@ -324,4 +324,27 @@ class QueryTest extends SphinxTestCase
->
all
(
$connection
);
$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