Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
solarium
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
solarium
Commits
54c3b82d
Unverified
Commit
54c3b82d
authored
Jul 22, 2018
by
Markus Kalkbrenner
Committed by
GitHub
Jul 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes #606 multiple dictionaries for suggesters (#607)
parent
db7eace3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
8 deletions
+50
-8
docs/queries/suggester-query.md
docs/queries/suggester-query.md
+6
-6
src/Component/ComponentTraits/SuggesterTrait.php
src/Component/ComponentTraits/SuggesterTrait.php
+2
-2
tests/Component/RequestBuilder/SuggesterTest.php
tests/Component/RequestBuilder/SuggesterTest.php
+29
-0
tests/QueryType/Select/RequestBuilderTest.php
tests/QueryType/Select/RequestBuilderTest.php
+13
-0
No files found.
docs/queries/suggester-query.md
View file @
54c3b82d
...
@@ -7,12 +7,12 @@ See the example code below.
...
@@ -7,12 +7,12 @@ See the example code below.
**Available options:**
**Available options:**
| Name | Type | Default value | Description |
| Name | Type
| Default value | Description |
|-----------------|---------|---------------|----------------------------------------------------------------------------------------|
|-----------------|---------
---------
|---------------|----------------------------------------------------------------------------------------|
| query | string | null | Query to spellcheck |
| query | string
| null | Query to spellcheck |
| dictionary | string
| null | The name of the dictionary
to use |
| dictionary | string
or array | null | The name(s) of the dictionary or dictionaries
to use |
| onlymorepopular | boolean | null | Only return suggestions that result in more hits for the query than the existing query |
| onlymorepopular | boolean
| null | Only return suggestions that result in more hits for the query than the existing query |
| collate | boolean | null | |
| collate | boolean
| null | |
||
||
Executing a terms query
Executing a terms query
...
...
src/Component/ComponentTraits/SuggesterTrait.php
View file @
54c3b82d
...
@@ -10,9 +10,9 @@ trait SuggesterTrait
...
@@ -10,9 +10,9 @@ trait SuggesterTrait
/**
/**
* Set dictionary option.
* Set dictionary option.
*
*
* The name of the dictionary to use
* The name of the dictionary
or dictionaries
to use
*
*
* @param string $dictionary
* @param string
|array
$dictionary
*
*
* @return self Provides fluent interface
* @return self Provides fluent interface
*/
*/
...
...
tests/Component/RequestBuilder/SuggesterTest.php
View file @
54c3b82d
...
@@ -37,4 +37,33 @@ class SuggesterTest extends TestCase
...
@@ -37,4 +37,33 @@ class SuggesterTest extends TestCase
$request
->
getParams
()
$request
->
getParams
()
);
);
}
}
public
function
testBuildComponentMulipleDictionaries
()
{
$builder
=
new
RequestBuilder
();
$request
=
new
Request
();
$component
=
new
Component
();
$component
->
setDictionary
([
'dictionary'
,
'alt_dictionary'
]);
$component
->
setQuery
(
'ap ip'
);
$component
->
setCount
(
13
);
$component
->
setContextFilterQuery
(
'foo bar'
);
$component
->
setBuild
(
'true'
);
$component
->
setReload
(
'false'
);
$request
=
$builder
->
buildComponent
(
$component
,
$request
);
$this
->
assertEquals
(
[
'suggest'
=>
'true'
,
'suggest.dictionary'
=>
[
'dictionary'
,
'alt_dictionary'
],
'suggest.q'
=>
'ap ip'
,
'suggest.count'
=>
13
,
'suggest.cfq'
=>
'foo bar'
,
'suggest.build'
=>
'true'
,
'suggest.reload'
=>
'false'
,
],
$request
->
getParams
()
);
}
}
}
tests/QueryType/Select/RequestBuilderTest.php
View file @
54c3b82d
...
@@ -119,6 +119,19 @@ class RequestBuilderTest extends TestCase
...
@@ -119,6 +119,19 @@ class RequestBuilderTest extends TestCase
$this
->
assertSame
(
'edismax'
,
$request
->
getParam
(
'defType'
));
$this
->
assertSame
(
'edismax'
,
$request
->
getParam
(
'defType'
));
}
}
public
function
testWithSuggesterComponent
()
{
$suggester
=
$this
->
query
->
getSuggester
();
$suggester
->
setDictionary
([
'dict1'
,
'dict2'
]);
$request
=
$this
->
builder
->
build
(
$this
->
query
);
$this
->
assertSame
(
'select?omitHeader=true&wt=json&json.nl=flat&q=*:*&start=0&rows=10&fl=*,score&suggest=true&suggest.dictionary=dict1&suggest.dictionary=dict2'
,
urldecode
(
$request
->
getUri
())
);
}
public
function
testWithTags
()
public
function
testWithTags
()
{
{
$this
->
query
->
setTags
([
't1'
,
't2'
]);
$this
->
query
->
setTags
([
't1'
,
't2'
]);
...
...
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