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
a90167e1
Commit
a90167e1
authored
Oct 21, 2011
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release/2.2.0' into develop
parents
6542c720
cb45f8b7
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
84 additions
and
77 deletions
+84
-77
examples/1.1-check-solarium-and-ping.php
examples/1.1-check-solarium-and-ping.php
+3
-1
examples/2.1.3-filterquery.php
examples/2.1.3-filterquery.php
+1
-6
examples/2.1.5.1.1-facet-field.php
examples/2.1.5.1.1-facet-field.php
+1
-6
examples/2.1.5.1.2-facet-query.php
examples/2.1.5.1.2-facet-query.php
+1
-6
examples/2.1.5.1.3-facet-multiquery.php
examples/2.1.5.1.3-facet-multiquery.php
+1
-5
examples/2.1.5.1.4-facet-range.php
examples/2.1.5.1.4-facet-range.php
+1
-5
examples/2.1.5.9-spellcheck.php
examples/2.1.5.9-spellcheck.php
+1
-2
examples/2.1.6-helper-functions.php
examples/2.1.6-helper-functions.php
+3
-9
examples/2.4.1-analysis-document.php
examples/2.4.1-analysis-document.php
+2
-0
examples/2.4.2-analysis-field.php
examples/2.4.2-analysis-field.php
+2
-0
examples/4.1-api-usage.php
examples/4.1-api-usage.php
+2
-9
examples/4.3-extending-usage.php
examples/4.3-extending-usage.php
+2
-10
library/Solarium/Client/Adapter/ZendHttp.php
library/Solarium/Client/Adapter/ZendHttp.php
+1
-0
library/Solarium/Client/Request.php
library/Solarium/Client/Request.php
+10
-10
library/Solarium/Client/RequestBuilder/Ping.php
library/Solarium/Client/RequestBuilder/Ping.php
+2
-1
library/Solarium/Client/ResponseParser/Analysis/Field.php
library/Solarium/Client/ResponseParser/Analysis/Field.php
+1
-1
library/Solarium/Client/ResponseParser/Select/Component/FacetSet.php
...arium/Client/ResponseParser/Select/Component/FacetSet.php
+8
-2
library/Solarium/Client/ResponseParser/Select/Component/Spellcheck.php
...ium/Client/ResponseParser/Select/Component/Spellcheck.php
+13
-0
library/Solarium/Query/Select.php
library/Solarium/Query/Select.php
+2
-2
library/Solarium/Result/Analysis/Item.php
library/Solarium/Result/Analysis/Item.php
+19
-1
library/Solarium/Result/Ping.php
library/Solarium/Result/Ping.php
+1
-1
tests/Solarium/Client/Adapter/ZendHttpTest.php
tests/Solarium/Client/Adapter/ZendHttpTest.php
+7
-0
No files found.
examples/1.1-check-solarium-and-ping.php
View file @
a90167e1
...
@@ -14,8 +14,10 @@ $ping = $client->createPing();
...
@@ -14,8 +14,10 @@ $ping = $client->createPing();
// execute the ping query
// execute the ping query
try
{
try
{
$client
->
ping
(
$ping
);
$
result
=
$
client
->
ping
(
$ping
);
echo
'Ping query succesful'
;
echo
'Ping query succesful'
;
echo
'<br/><pre>'
;
var_dump
(
$result
->
getData
());
}
catch
(
Solarium_Exception
$e
){
}
catch
(
Solarium_Exception
$e
){
echo
'Ping query failed'
;
echo
'Ping query failed'
;
}
}
...
...
examples/2.1.3-filterquery.php
View file @
a90167e1
...
@@ -10,12 +10,7 @@ $client = new Solarium_Client($config);
...
@@ -10,12 +10,7 @@ $client = new Solarium_Client($config);
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
// create a filterquery
// create a filterquery
$fq
=
$query
->
createFilterQuery
();
$query
->
createFilterQuery
(
'maxprice'
)
->
setQuery
(
'price:[1 TO 300]'
);
$fq
->
setKey
(
'maxprice'
);
$fq
->
setQuery
(
'price:[1 TO 300]'
);
// add it to the query
$query
->
addFilterQuery
(
$fq
);
// this executes the query and returns the result
// this executes the query and returns the result
$resultset
=
$client
->
select
(
$query
);
$resultset
=
$client
->
select
(
$query
);
...
...
examples/2.1.5.1.1-facet-field.php
View file @
a90167e1
...
@@ -13,12 +13,7 @@ $query = $client->createSelect();
...
@@ -13,12 +13,7 @@ $query = $client->createSelect();
$facetSet
=
$query
->
getFacetSet
();
$facetSet
=
$query
->
getFacetSet
();
// create a facet field instance and set options
// create a facet field instance and set options
$facet
=
$facetSet
->
createFacetField
();
$facetSet
->
createFacetField
(
'stock'
)
->
setField
(
'inStock'
);
$facet
->
setKey
(
'stock'
);
$facet
->
setField
(
'inStock'
);
// add the facet instance to the facetset
$facetSet
->
addFacet
(
$facet
);
// this executes the query and returns the result
// this executes the query and returns the result
$resultset
=
$client
->
select
(
$query
);
$resultset
=
$client
->
select
(
$query
);
...
...
examples/2.1.5.1.2-facet-query.php
View file @
a90167e1
...
@@ -13,12 +13,7 @@ $query = $client->createSelect();
...
@@ -13,12 +13,7 @@ $query = $client->createSelect();
$facetSet
=
$query
->
getFacetSet
();
$facetSet
=
$query
->
getFacetSet
();
// create a facet query instance and set options
// create a facet query instance and set options
$facet
=
$facetSet
->
createFacetQuery
();
$facetSet
->
createFacetQuery
(
'stock'
)
->
setQuery
(
'inStock: true'
);
$facet
->
setKey
(
'stock'
);
$facet
->
setQuery
(
'inStock: true'
);
// add the facet instance to the facetset
$facetSet
->
addFacet
(
$facet
);
// this executes the query and returns the result
// this executes the query and returns the result
$resultset
=
$client
->
select
(
$query
);
$resultset
=
$client
->
select
(
$query
);
...
...
examples/2.1.5.1.3-facet-multiquery.php
View file @
a90167e1
...
@@ -13,16 +13,12 @@ $query = $client->createSelect();
...
@@ -13,16 +13,12 @@ $query = $client->createSelect();
$facetSet
=
$query
->
getFacetSet
();
$facetSet
=
$query
->
getFacetSet
();
// create a facet query instance and set options
// create a facet query instance and set options
$facet
=
$facetSet
->
createFacetMultiQuery
();
$facet
=
$facetSet
->
createFacetMultiQuery
(
'stock'
);
$facet
->
setKey
(
'stock'
);
$facet
->
createQuery
(
'stock_pricecat1'
,
'inStock:true AND price:[1 TO 300]'
);
$facet
->
createQuery
(
'stock_pricecat1'
,
'inStock:true AND price:[1 TO 300]'
);
$facet
->
createQuery
(
'nostock_pricecat1'
,
'inStock:false AND price:[1 TO 300]'
);
$facet
->
createQuery
(
'nostock_pricecat1'
,
'inStock:false AND price:[1 TO 300]'
);
$facet
->
createQuery
(
'stock_pricecat2'
,
'inStock:true AND price:[300 TO *]'
);
$facet
->
createQuery
(
'stock_pricecat2'
,
'inStock:true AND price:[300 TO *]'
);
$facet
->
createQuery
(
'nostock_pricecat2'
,
'inStock:false AND price:[300 TO *]'
);
$facet
->
createQuery
(
'nostock_pricecat2'
,
'inStock:false AND price:[300 TO *]'
);
// add the facet instance to the facetset
$facetSet
->
addFacet
(
$facet
);
// this executes the query and returns the result
// this executes the query and returns the result
$resultset
=
$client
->
select
(
$query
);
$resultset
=
$client
->
select
(
$query
);
...
...
examples/2.1.5.1.4-facet-range.php
View file @
a90167e1
...
@@ -13,16 +13,12 @@ $query = $client->createSelect();
...
@@ -13,16 +13,12 @@ $query = $client->createSelect();
$facetSet
=
$query
->
getFacetSet
();
$facetSet
=
$query
->
getFacetSet
();
// create a facet field instance and set options
// create a facet field instance and set options
$facet
=
$facetSet
->
createFacetRange
();
$facet
=
$facetSet
->
createFacetRange
(
'priceranges'
);
$facet
->
setKey
(
'priceranges'
);
$facet
->
setField
(
'price'
);
$facet
->
setField
(
'price'
);
$facet
->
setStart
(
1
);
$facet
->
setStart
(
1
);
$facet
->
setGap
(
100
);
$facet
->
setGap
(
100
);
$facet
->
setEnd
(
1000
);
$facet
->
setEnd
(
1000
);
// add the facet instance to the facetset
$facetSet
->
addFacet
(
$facet
);
// this executes the query and returns the result
// this executes the query and returns the result
$resultset
=
$client
->
select
(
$query
);
$resultset
=
$client
->
select
(
$query
);
...
...
examples/2.1.5.9-spellcheck.php
View file @
a90167e1
...
@@ -10,8 +10,7 @@ $client = new Solarium_Client($config);
...
@@ -10,8 +10,7 @@ $client = new Solarium_Client($config);
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
$query
->
setRows
(
0
);
$query
->
setRows
(
0
);
// add distributed search settings
// add spellcheck settings
// see http://wiki.apache.org/solr/DistributedSearch#Distributed_Search_Example for setting up two solr instances
$spellcheck
=
$query
->
getSpellcheck
();
$spellcheck
=
$query
->
getSpellcheck
();
$spellcheck
->
setQuery
(
'delll ultrashar'
);
$spellcheck
->
setQuery
(
'delll ultrashar'
);
$spellcheck
->
setBuild
(
true
);
$spellcheck
->
setBuild
(
true
);
...
...
examples/2.1.6-helper-functions.php
View file @
a90167e1
...
@@ -11,16 +11,10 @@ $query = $client->createSelect();
...
@@ -11,16 +11,10 @@ $query = $client->createSelect();
$helper
=
$query
->
getHelper
();
$helper
=
$query
->
getHelper
();
// add a filterquery on a price range, using the helper to generate the range
// add a filterquery on a price range, using the helper to generate the range
$fqPrice
=
$query
->
createFilterQuery
();
$query
->
createFilterQuery
(
'price'
)
->
setQuery
(
$helper
->
rangeQuery
(
'price'
,
10
,
300
));
$fqPrice
->
setKey
(
'price'
);
$fqPrice
->
setQuery
(
$helper
->
rangeQuery
(
'price'
,
10
,
300
));
$query
->
addFilterQuery
(
$fqPrice
);
// add a filterquery to find products in a range of 5km, using the helper to generate the 'geofilt' filter
// add a filterquery to find products in a range of 5km, using the helper to generate the 'geofilt' filter
$fqRegion
=
$query
->
createFilterQuery
();
$query
->
createFilterQuery
(
'region'
)
->
setQuery
(
$helper
->
geofilt
(
45.15
,
-
93.85
,
'store'
,
5
));
$fqRegion
->
setKey
(
'region'
);
$fqRegion
->
setQuery
(
$helper
->
geofilt
(
45.15
,
-
93.85
,
'store'
,
5
));
$query
->
addFilterQuery
(
$fqRegion
);
// this executes the query and returns the result
// this executes the query and returns the result
$resultset
=
$client
->
select
(
$query
);
$resultset
=
$client
->
select
(
$query
);
...
...
examples/2.4.1-analysis-document.php
View file @
a90167e1
...
@@ -62,6 +62,7 @@ foreach ($result as $document) {
...
@@ -62,6 +62,7 @@ foreach ($result as $document) {
echo
'Position: '
.
$result
->
getPosition
()
.
'<br/>'
;
echo
'Position: '
.
$result
->
getPosition
()
.
'<br/>'
;
echo
'Position history: '
.
implode
(
', '
,
$result
->
getPositionHistory
())
.
'<br/>'
;
echo
'Position history: '
.
implode
(
', '
,
$result
->
getPositionHistory
())
.
'<br/>'
;
echo
'Type: '
.
htmlspecialchars
(
$result
->
getType
())
.
'<br/>'
;
echo
'Type: '
.
htmlspecialchars
(
$result
->
getType
())
.
'<br/>'
;
echo
'Match: '
.
var_export
(
$result
->
getMatch
(),
true
)
.
'<br/>'
;
echo
'-----------<br/>'
;
echo
'-----------<br/>'
;
}
}
}
}
...
@@ -82,6 +83,7 @@ foreach ($result as $document) {
...
@@ -82,6 +83,7 @@ foreach ($result as $document) {
echo
'Position: '
.
$result
->
getPosition
()
.
'<br/>'
;
echo
'Position: '
.
$result
->
getPosition
()
.
'<br/>'
;
echo
'Position history: '
.
implode
(
', '
,
$result
->
getPositionHistory
())
.
'<br/>'
;
echo
'Position history: '
.
implode
(
', '
,
$result
->
getPositionHistory
())
.
'<br/>'
;
echo
'Type: '
.
htmlspecialchars
(
$result
->
getType
())
.
'<br/>'
;
echo
'Type: '
.
htmlspecialchars
(
$result
->
getType
())
.
'<br/>'
;
echo
'Match: '
.
var_export
(
$result
->
getMatch
(),
true
)
.
'<br/>'
;
echo
'-----------<br/>'
;
echo
'-----------<br/>'
;
}
}
}
}
...
...
examples/2.4.2-analysis-field.php
View file @
a90167e1
...
@@ -42,6 +42,7 @@ foreach ($results as $result) {
...
@@ -42,6 +42,7 @@ foreach ($results as $result) {
echo
'Position: '
.
$result
->
getPosition
()
.
'<br/>'
;
echo
'Position: '
.
$result
->
getPosition
()
.
'<br/>'
;
echo
'Position history: '
.
implode
(
', '
,
$result
->
getPositionHistory
())
.
'<br/>'
;
echo
'Position history: '
.
implode
(
', '
,
$result
->
getPositionHistory
())
.
'<br/>'
;
echo
'Type: '
.
htmlspecialchars
(
$result
->
getType
())
.
'<br/>'
;
echo
'Type: '
.
htmlspecialchars
(
$result
->
getType
())
.
'<br/>'
;
echo
'Match: '
.
var_export
(
$result
->
getMatch
(),
true
)
.
'<br/>'
;
echo
'-----------<br/>'
;
echo
'-----------<br/>'
;
}
}
}
}
...
@@ -62,6 +63,7 @@ foreach ($results as $result) {
...
@@ -62,6 +63,7 @@ foreach ($results as $result) {
echo
'Position: '
.
$result
->
getPosition
()
.
'<br/>'
;
echo
'Position: '
.
$result
->
getPosition
()
.
'<br/>'
;
echo
'Position history: '
.
implode
(
', '
,
$result
->
getPositionHistory
())
.
'<br/>'
;
echo
'Position history: '
.
implode
(
', '
,
$result
->
getPositionHistory
())
.
'<br/>'
;
echo
'Type: '
.
htmlspecialchars
(
$result
->
getType
())
.
'<br/>'
;
echo
'Type: '
.
htmlspecialchars
(
$result
->
getType
())
.
'<br/>'
;
echo
'Match: '
.
var_export
(
$result
->
getMatch
(),
true
)
.
'<br/>'
;
echo
'-----------<br/>'
;
echo
'-----------<br/>'
;
}
}
}
}
...
...
examples/4.1-api-usage.php
View file @
a90167e1
...
@@ -16,18 +16,11 @@ $query->setFields(array('id','name','price'));
...
@@ -16,18 +16,11 @@ $query->setFields(array('id','name','price'));
$query
->
addSort
(
'price'
,
Solarium_Query_Select
::
SORT_ASC
);
$query
->
addSort
(
'price'
,
Solarium_Query_Select
::
SORT_ASC
);
// create a filterquery using the API
// create a filterquery using the API
$fq
=
$query
->
createFilterQuery
();
$fq
=
$query
->
createFilterQuery
(
'maxprice'
)
->
setQuery
(
'price:[1 TO 300]'
);
$fq
->
setKey
(
'maxprice'
);
$fq
->
setQuery
(
'price:[1 TO 300]'
);
// and add it to the query
$query
->
addFilterQuery
(
$fq
);
// create a facet field instance and set options using the API
// create a facet field instance and set options using the API
$facetSet
=
$query
->
getFacetSet
();
$facetSet
=
$query
->
getFacetSet
();
$facet
=
$facetSet
->
createFacetField
();
$facet
=
$facetSet
->
createFacetField
(
'stock'
)
->
setField
(
'inStock'
);
$facet
->
setKey
(
'stock'
);
$facet
->
setField
(
'inStock'
);
$facetSet
->
addFacet
(
$facet
);
// this executes the query and returns the result
// this executes the query and returns the result
$resultset
=
$client
->
select
(
$query
);
$resultset
=
$client
->
select
(
$query
);
...
...
examples/4.3-extending-usage.php
View file @
a90167e1
...
@@ -19,10 +19,7 @@ class ProductQuery extends Solarium_Query_Select{
...
@@ -19,10 +19,7 @@ class ProductQuery extends Solarium_Query_Select{
// create a facet field instance and set options
// create a facet field instance and set options
$facetSet
=
$this
->
getFacetSet
();
$facetSet
=
$this
->
getFacetSet
();
$facet
=
$facetSet
->
createFacetField
();
$facetSet
->
createFacetField
(
'stock'
)
->
setField
(
'inStock'
);
$facet
->
setKey
(
'stock'
);
$facet
->
setField
(
'inStock'
);
$facetSet
->
addFacet
(
$facet
);
}
}
}
}
...
@@ -36,12 +33,7 @@ class ProductPriceLimitedQuery extends ProductQuery{
...
@@ -36,12 +33,7 @@ class ProductPriceLimitedQuery extends ProductQuery{
parent
::
_init
();
parent
::
_init
();
// create a filterquery
// create a filterquery
$fq
=
$this
->
createFilterQuery
();
$this
->
createFilterQuery
(
'maxprice'
)
->
setQuery
(
'price:[1 TO 300]'
);
$fq
->
setKey
(
'maxprice'
);
$fq
->
setQuery
(
'price:[1 TO 300]'
);
// and add it
$this
->
addFilterQuery
(
$fq
);
}
}
}
}
...
...
library/Solarium/Client/Adapter/ZendHttp.php
View file @
a90167e1
...
@@ -154,6 +154,7 @@ class Solarium_Client_Adapter_ZendHttp extends Solarium_Client_Adapter
...
@@ -154,6 +154,7 @@ class Solarium_Client_Adapter_ZendHttp extends Solarium_Client_Adapter
$client
->
setMethod
(
$request
->
getMethod
());
$client
->
setMethod
(
$request
->
getMethod
());
$client
->
setUri
(
$this
->
getBaseUri
()
.
$request
->
getUri
());
$client
->
setUri
(
$this
->
getBaseUri
()
.
$request
->
getUri
());
$client
->
setHeaders
(
$request
->
getHeaders
());
$client
->
setRawData
(
$request
->
getRawData
());
$client
->
setRawData
(
$request
->
getRawData
());
$response
=
$client
->
request
();
$response
=
$client
->
request
();
...
...
library/Solarium/Client/Request.php
View file @
a90167e1
...
@@ -48,17 +48,17 @@ class Solarium_Client_Request extends Solarium_Configurable
...
@@ -48,17 +48,17 @@ class Solarium_Client_Request extends Solarium_Configurable
/**
/**
* Request GET method
* Request GET method
*/
*/
const
METHOD_GET
=
'
get
'
;
const
METHOD_GET
=
'
GET
'
;
/**
/**
* Request POST method
* Request POST method
*/
*/
const
METHOD_POST
=
'
post
'
;
const
METHOD_POST
=
'
POST
'
;
/**
/**
* Request HEAD method
* Request HEAD method
*/
*/
const
METHOD_HEAD
=
'
head
'
;
const
METHOD_HEAD
=
'
HEAD
'
;
/**
/**
* Default options
* Default options
...
...
library/Solarium/Client/RequestBuilder/Ping.php
View file @
a90167e1
...
@@ -55,7 +55,8 @@ class Solarium_Client_RequestBuilder_Ping extends Solarium_Client_RequestBuilder
...
@@ -55,7 +55,8 @@ class Solarium_Client_RequestBuilder_Ping extends Solarium_Client_RequestBuilder
{
{
$request
=
new
Solarium_Client_Request
;
$request
=
new
Solarium_Client_Request
;
$request
->
setHandler
(
$query
->
getHandler
());
$request
->
setHandler
(
$query
->
getHandler
());
$request
->
setMethod
(
Solarium_Client_Request
::
METHOD_HEAD
);
$request
->
setMethod
(
Solarium_Client_Request
::
METHOD_GET
);
$request
->
addParam
(
'wt'
,
'json'
);
return
$request
;
return
$request
;
}
}
...
...
library/Solarium/Client/ResponseParser/Analysis/Field.php
View file @
a90167e1
...
@@ -100,7 +100,7 @@ class Solarium_Client_ResponseParser_Analysis_Field extends Solarium_Client_Resp
...
@@ -100,7 +100,7 @@ class Solarium_Client_ResponseParser_Analysis_Field extends Solarium_Client_Resp
foreach
(
$fieldData
as
$typeKey
=>
$typeData
)
{
foreach
(
$fieldData
as
$typeKey
=>
$typeData
)
{
// fix for extra level for key fields
// fix for extra level for key fields
if
(
count
(
$typeData
)
==
1
){
if
(
count
(
$typeData
)
==
1
)
{
$typeData
=
current
(
$typeData
);
$typeData
=
current
(
$typeData
);
}
}
...
...
library/Solarium/Client/ResponseParser/Select/Component/FacetSet.php
View file @
a90167e1
...
@@ -171,12 +171,18 @@ class Solarium_Client_ResponseParser_Select_Component_FacetSet
...
@@ -171,12 +171,18 @@ class Solarium_Client_ResponseParser_Select_Component_FacetSet
if
(
isset
(
$data
[
'facet_counts'
][
'facet_ranges'
][
$key
]))
{
if
(
isset
(
$data
[
'facet_counts'
][
'facet_ranges'
][
$key
]))
{
$data
=
$data
[
'facet_counts'
][
'facet_ranges'
][
$key
];
$data
=
$data
[
'facet_counts'
][
'facet_ranges'
][
$key
];
$before
=
(
isset
(
$data
[
'before'
]))
?
$data
[
'before'
]
:
null
;
$before
=
(
isset
(
$data
[
'before'
]))
?
$data
[
'before'
]
:
null
;
$after
=
(
isset
(
$data
[
'after'
]))
?
$data
[
'after'
]
:
null
;
$after
=
(
isset
(
$data
[
'after'
]))
?
$data
[
'after'
]
:
null
;
$between
=
(
isset
(
$data
[
'between'
]))
?
$data
[
'between'
]
:
null
;
$between
=
(
isset
(
$data
[
'between'
]))
?
$data
[
'between'
]
:
null
;
return
new
Solarium_Result_Select_Facet_Range
(
$data
[
'counts'
],
$before
,
$after
,
$between
);
$offset
=
0
;
$counts
=
array
();
while
(
isset
(
$data
[
'counts'
][
$offset
])
&&
isset
(
$data
[
'counts'
][
$offset
+
1
]))
{
$counts
[
$data
[
'counts'
][
$offset
]]
=
$data
[
'counts'
][
$offset
+
1
];
$offset
+=
2
;
}
return
new
Solarium_Result_Select_Facet_Range
(
$counts
,
$before
,
$after
,
$between
);
}
}
}
}
...
...
library/Solarium/Client/ResponseParser/Select/Component/Spellcheck.php
View file @
a90167e1
...
@@ -93,6 +93,12 @@ class Solarium_Client_ResponseParser_Select_Component_Spellcheck
...
@@ -93,6 +93,12 @@ class Solarium_Client_ResponseParser_Select_Component_Spellcheck
}
}
}
}
/**
* Parse collation data into a result object
*
* @param array $values
* @return Solarium_Result_Select_Spellcheck_Collation
*/
protected
function
_parseCollation
(
$values
)
protected
function
_parseCollation
(
$values
)
{
{
if
(
is_string
(
$values
))
{
if
(
is_string
(
$values
))
{
...
@@ -141,6 +147,13 @@ class Solarium_Client_ResponseParser_Select_Component_Spellcheck
...
@@ -141,6 +147,13 @@ class Solarium_Client_ResponseParser_Select_Component_Spellcheck
}
}
}
}
/**
* Parse suggestion data into a result object
*
* @param string $key
* @param array $value
* @return Solarium_Result_Select_Spellcheck_Suggestion
*/
protected
function
_parseSuggestion
(
$key
,
$value
)
protected
function
_parseSuggestion
(
$key
,
$value
)
{
{
$numFound
=
(
isset
(
$value
[
'numFound'
]))
?
$value
[
'numFound'
]
:
null
;
$numFound
=
(
isset
(
$value
[
'numFound'
]))
?
$value
[
'numFound'
]
:
null
;
...
...
library/Solarium/Query/Select.php
View file @
a90167e1
...
@@ -853,7 +853,7 @@ class Solarium_Query_Select extends Solarium_Query
...
@@ -853,7 +853,7 @@ class Solarium_Query_Select extends Solarium_Query
return
$this
->
getComponent
(
Solarium_Query_Select
::
COMPONENT_GROUPING
,
true
);
return
$this
->
getComponent
(
Solarium_Query_Select
::
COMPONENT_GROUPING
,
true
);
}
}
/*
/*
*
* Get a spellcheck component instance
* Get a spellcheck component instance
*
*
* This is a convenience method that maps presets to getComponent
* This is a convenience method that maps presets to getComponent
...
@@ -865,7 +865,7 @@ class Solarium_Query_Select extends Solarium_Query
...
@@ -865,7 +865,7 @@ class Solarium_Query_Select extends Solarium_Query
return
$this
->
getComponent
(
Solarium_Query_Select
::
COMPONENT_SPELLCHECK
,
true
);
return
$this
->
getComponent
(
Solarium_Query_Select
::
COMPONENT_SPELLCHECK
,
true
);
}
}
/*
/*
*
* Get a DistributedSearch component instance
* Get a DistributedSearch component instance
*
*
* This is a convenience method that maps presets to getComponent
* This is a convenience method that maps presets to getComponent
...
...
library/Solarium/Result/Analysis/Item.php
View file @
a90167e1
...
@@ -80,6 +80,10 @@ class Solarium_Result_Analysis_Item
...
@@ -80,6 +80,10 @@ class Solarium_Result_Analysis_Item
*/
*/
protected
$_type
;
protected
$_type
;
/**
* @var boolean
*/
protected
$_match
=
false
;
/**
/**
* Constructor
* Constructor
...
@@ -98,6 +102,10 @@ class Solarium_Result_Analysis_Item
...
@@ -98,6 +102,10 @@ class Solarium_Result_Analysis_Item
if
(
isset
(
$analysis
[
'raw_text'
]))
{
if
(
isset
(
$analysis
[
'raw_text'
]))
{
$this
->
_rawText
=
$analysis
[
'raw_text'
];
$this
->
_rawText
=
$analysis
[
'raw_text'
];
}
}
if
(
isset
(
$analysis
[
'match'
]))
{
$this
->
_match
=
$analysis
[
'match'
];
}
}
}
/**
/**
...
@@ -172,4 +180,14 @@ class Solarium_Result_Analysis_Item
...
@@ -172,4 +180,14 @@ class Solarium_Result_Analysis_Item
return
$this
->
_type
;
return
$this
->
_type
;
}
}
/**
* Get match value
*
* @return boolean
*/
public
function
getMatch
()
{
return
$this
->
_match
;
}
}
}
\ No newline at end of file
library/Solarium/Result/Ping.php
View file @
a90167e1
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
* @package Solarium
* @package Solarium
* @subpackage Result
* @subpackage Result
*/
*/
class
Solarium_Result_Ping
class
Solarium_Result_Ping
extends
Solarium_Result
{
{
/**
/**
...
...
tests/Solarium/Client/Adapter/ZendHttpTest.php
View file @
a90167e1
...
@@ -88,10 +88,14 @@ class Solarium_Client_Adapter_ZendHttpTest extends PHPUnit_Framework_TestCase
...
@@ -88,10 +88,14 @@ class Solarium_Client_Adapter_ZendHttpTest extends PHPUnit_Framework_TestCase
$rawData
=
'xyz'
;
$rawData
=
'xyz'
;
$responseData
=
'abc'
;
$responseData
=
'abc'
;
$handler
=
'myhandler'
;
$handler
=
'myhandler'
;
$headers
=
array
(
'Content-Type: application/x-www-form-urlencoded'
);
$request
=
new
Solarium_Client_Request
();
$request
=
new
Solarium_Client_Request
();
$request
->
setMethod
(
$method
);
$request
->
setMethod
(
$method
);
$request
->
setHandler
(
$handler
);
$request
->
setHandler
(
$handler
);
$request
->
setHeaders
(
$headers
);
$request
->
setRawData
(
$rawData
);
$request
->
setRawData
(
$rawData
);
$response
=
new
Zend_Http_Response
(
200
,
array
(
'status'
=>
'HTTP 1.1 200 OK'
),
$responseData
);
$response
=
new
Zend_Http_Response
(
200
,
array
(
'status'
=>
'HTTP 1.1 200 OK'
),
$responseData
);
...
@@ -103,6 +107,9 @@ class Solarium_Client_Adapter_ZendHttpTest extends PHPUnit_Framework_TestCase
...
@@ -103,6 +107,9 @@ class Solarium_Client_Adapter_ZendHttpTest extends PHPUnit_Framework_TestCase
$mock
->
expects
(
$this
->
once
())
$mock
->
expects
(
$this
->
once
())
->
method
(
'setUri'
)
->
method
(
'setUri'
)
->
with
(
$this
->
equalTo
(
'http://127.0.0.1:8983/solr/myhandler?'
));
->
with
(
$this
->
equalTo
(
'http://127.0.0.1:8983/solr/myhandler?'
));
$mock
->
expects
(
$this
->
once
())
->
method
(
'setHeaders'
)
->
with
(
$this
->
equalTo
(
$headers
));
$mock
->
expects
(
$this
->
once
())
$mock
->
expects
(
$this
->
once
())
->
method
(
'setRawData'
)
->
method
(
'setRawData'
)
->
with
(
$this
->
equalTo
(
$rawData
));
->
with
(
$this
->
equalTo
(
$rawData
));
...
...
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