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
4e71fc88
Commit
4e71fc88
authored
Dec 19, 2011
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated examples for namespacing
parent
cd4dc257
Changes
48
Hide whitespace changes
Inline
Side-by-side
Showing
48 changed files
with
78 additions
and
78 deletions
+78
-78
examples/1.1-check-solarium-and-ping.php
examples/1.1-check-solarium-and-ping.php
+1
-1
examples/1.2-basic-select.php
examples/1.2-basic-select.php
+2
-2
examples/1.3-basic-update.php
examples/1.3-basic-update.php
+2
-2
examples/2.1.1-query-params.php
examples/2.1.1-query-params.php
+3
-3
examples/2.1.2-custom-result-document.php
examples/2.1.2-custom-result-document.php
+1
-1
examples/2.1.3-filterquery.php
examples/2.1.3-filterquery.php
+1
-1
examples/2.1.5.1.1-facet-field.php
examples/2.1.5.1.1-facet-field.php
+1
-1
examples/2.1.5.1.2-facet-query.php
examples/2.1.5.1.2-facet-query.php
+1
-1
examples/2.1.5.1.3-facet-multiquery.php
examples/2.1.5.1.3-facet-multiquery.php
+1
-1
examples/2.1.5.1.4-facet-range.php
examples/2.1.5.1.4-facet-range.php
+1
-1
examples/2.1.5.10-stats.php
examples/2.1.5.10-stats.php
+1
-1
examples/2.1.5.11-debug.php
examples/2.1.5.11-debug.php
+1
-1
examples/2.1.5.2-morelikethis.php
examples/2.1.5.2-morelikethis.php
+2
-2
examples/2.1.5.3-highlighting.php
examples/2.1.5.3-highlighting.php
+2
-2
examples/2.1.5.3.1-per-field-highlighting.php
examples/2.1.5.3.1-per-field-highlighting.php
+1
-1
examples/2.1.5.4-dismax.php
examples/2.1.5.4-dismax.php
+2
-2
examples/2.1.5.5-edismax.php
examples/2.1.5.5-edismax.php
+2
-2
examples/2.1.5.6-grouping-by-field.php
examples/2.1.5.6-grouping-by-field.php
+2
-2
examples/2.1.5.7-grouping-by-query.php
examples/2.1.5.7-grouping-by-query.php
+1
-1
examples/2.1.5.8-distributed-search.php
examples/2.1.5.8-distributed-search.php
+1
-1
examples/2.1.5.9-spellcheck.php
examples/2.1.5.9-spellcheck.php
+1
-1
examples/2.1.6-helper-functions.php
examples/2.1.6-helper-functions.php
+1
-1
examples/2.1.7-query-reuse.php
examples/2.1.7-query-reuse.php
+2
-2
examples/2.2.1-add-docs.php
examples/2.2.1-add-docs.php
+1
-1
examples/2.2.2-delete-by-query.php
examples/2.2.2-delete-by-query.php
+1
-1
examples/2.2.3-delete-by-id.php
examples/2.2.3-delete-by-id.php
+1
-1
examples/2.2.4-optimize.php
examples/2.2.4-optimize.php
+1
-1
examples/2.2.5-rollback.php
examples/2.2.5-rollback.php
+1
-1
examples/2.3.1-mlt-query.php
examples/2.3.1-mlt-query.php
+2
-2
examples/2.3.2-mlt-stream.php
examples/2.3.2-mlt-stream.php
+2
-2
examples/2.4.1-analysis-document.php
examples/2.4.1-analysis-document.php
+1
-1
examples/2.4.2-analysis-field.php
examples/2.4.2-analysis-field.php
+1
-1
examples/2.5-terms-query.php
examples/2.5-terms-query.php
+1
-1
examples/4.1-api-usage.php
examples/4.1-api-usage.php
+2
-2
examples/4.2-configuration-usage.php
examples/4.2-configuration-usage.php
+1
-1
examples/4.3-extending-usage.php
examples/4.3-extending-usage.php
+1
-1
examples/5.1-partial-usage.php
examples/5.1-partial-usage.php
+2
-2
examples/5.2-extending.php
examples/5.2-extending.php
+5
-5
examples/5.3.1-plugin-event-hooks.php
examples/5.3.1-plugin-event-hooks.php
+2
-2
examples/5.3.2-plugin-solarium-presets.php
examples/5.3.2-plugin-solarium-presets.php
+7
-7
examples/6.1.1-zend-http-adapter.php
examples/6.1.1-zend-http-adapter.php
+2
-2
examples/6.1.2-pecl-http-adapter.php
examples/6.1.2-pecl-http-adapter.php
+2
-2
examples/6.1.3-curl-adapter.php
examples/6.1.3-curl-adapter.php
+1
-1
examples/6.2-escaping.php
examples/6.2-escaping.php
+2
-2
examples/6.3-placeholder-syntax.php
examples/6.3-placeholder-syntax.php
+2
-2
examples/7.1-plugin-loadbalancer.php
examples/7.1-plugin-loadbalancer.php
+2
-2
examples/7.2-plugin-postbigrequest.php
examples/7.2-plugin-postbigrequest.php
+1
-1
examples/7.3-plugin-customizerequest.php
examples/7.3-plugin-customizerequest.php
+1
-1
No files found.
examples/1.1-check-solarium-and-ping.php
View file @
4e71fc88
...
@@ -7,7 +7,7 @@ htmlHeader();
...
@@ -7,7 +7,7 @@ htmlHeader();
echo
'Solarium library version: '
.
Solarium\Version
::
VERSION
.
' - '
;
echo
'Solarium library version: '
.
Solarium\Version
::
VERSION
.
' - '
;
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// create a ping query
// create a ping query
$ping
=
$client
->
createPing
();
$ping
=
$client
->
createPing
();
...
...
examples/1.2-basic-select.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
@@ -25,7 +25,7 @@ foreach ($resultset as $document) {
...
@@ -25,7 +25,7 @@ foreach ($resultset as $document) {
{
{
// this converts multivalue fields to a comma-separated string
// this converts multivalue fields to a comma-separated string
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
}
}
...
...
examples/1.3-basic-update.php
View file @
4e71fc88
...
@@ -7,7 +7,7 @@ if ($_POST) {
...
@@ -7,7 +7,7 @@ if ($_POST) {
// if data is posted add it to solr
// if data is posted add it to solr
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get an update query instance
// get an update query instance
$update
=
$client
->
createUpdate
();
$update
=
$client
->
createUpdate
();
...
@@ -18,7 +18,7 @@ if ($_POST) {
...
@@ -18,7 +18,7 @@ if ($_POST) {
$doc
->
id
=
$_POST
[
'id'
];
$doc
->
id
=
$_POST
[
'id'
];
$doc
->
name
=
$_POST
[
'name'
];
$doc
->
name
=
$_POST
[
'name'
];
$doc
->
price
=
$_POST
[
'price'
];
$doc
->
price
=
$_POST
[
'price'
];
// add the document and a commit command to the update query
// add the document and a commit command to the update query
$update
->
addDocument
(
$doc
);
$update
->
addDocument
(
$doc
);
$update
->
addCommit
();
$update
->
addCommit
();
...
...
examples/2.1.1-query-params.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
@@ -19,7 +19,7 @@ $query->setStart(2)->setRows(20);
...
@@ -19,7 +19,7 @@ $query->setStart(2)->setRows(20);
$query
->
setFields
(
array
(
'id'
,
'name'
,
'price'
));
$query
->
setFields
(
array
(
'id'
,
'name'
,
'price'
));
// sort the results by price ascending
// sort the results by price ascending
$query
->
addSort
(
'price'
,
Solarium\Query\Select
::
SORT_ASC
);
$query
->
addSort
(
'price'
,
Solarium\Query\Select
\Select
::
SORT_ASC
);
// this executes the query and returns the result
// this executes the query and returns the result
$resultset
=
$client
->
select
(
$query
);
$resultset
=
$client
->
select
(
$query
);
...
@@ -37,7 +37,7 @@ foreach ($resultset as $document) {
...
@@ -37,7 +37,7 @@ foreach ($resultset as $document) {
{
{
// this converts multivalue fields to a comma-separated string
// this converts multivalue fields to a comma-separated string
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
}
}
...
...
examples/2.1.2-custom-result-document.php
View file @
4e71fc88
...
@@ -16,7 +16,7 @@ class myDoc extends Solarium\Document\ReadOnly{
...
@@ -16,7 +16,7 @@ class myDoc extends Solarium\Document\ReadOnly{
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
...
examples/2.1.3-filterquery.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
...
examples/2.1.5.1.1-facet-field.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
...
examples/2.1.5.1.2-facet-query.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
...
examples/2.1.5.1.3-facet-multiquery.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
...
examples/2.1.5.1.4-facet-range.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
...
examples/2.1.5.10-stats.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
...
examples/2.1.5.11-debug.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
...
examples/2.1.5.2-morelikethis.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
@@ -33,7 +33,7 @@ foreach ($resultset as $document) {
...
@@ -33,7 +33,7 @@ foreach ($resultset as $document) {
{
{
// this converts multivalue fields to a comma-separated string
// this converts multivalue fields to a comma-separated string
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
}
}
...
...
examples/2.1.5.3-highlighting.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
@@ -32,7 +32,7 @@ foreach ($resultset as $document) {
...
@@ -32,7 +32,7 @@ foreach ($resultset as $document) {
{
{
// this converts multivalue fields to a comma-separated string
// this converts multivalue fields to a comma-separated string
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
}
}
...
...
examples/2.1.5.3.1-per-field-highlighting.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
...
examples/2.1.5.4-dismax.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
@@ -32,7 +32,7 @@ foreach ($resultset as $document) {
...
@@ -32,7 +32,7 @@ foreach ($resultset as $document) {
{
{
// this converts multivalue fields to a comma-separated string
// this converts multivalue fields to a comma-separated string
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
}
}
...
...
examples/2.1.5.5-edismax.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
@@ -34,7 +34,7 @@ foreach ($resultset as $document) {
...
@@ -34,7 +34,7 @@ foreach ($resultset as $document) {
{
{
// this converts multivalue fields to a comma-separated string
// this converts multivalue fields to a comma-separated string
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
}
}
...
...
examples/2.1.5.6-grouping-by-field.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
@@ -33,7 +33,7 @@ foreach($groups AS $groupKey => $fieldGroup) {
...
@@ -33,7 +33,7 @@ foreach($groups AS $groupKey => $fieldGroup) {
echo
'<h2>'
.
(
int
)
$valueGroup
->
getValue
()
.
'</h2>'
;
echo
'<h2>'
.
(
int
)
$valueGroup
->
getValue
()
.
'</h2>'
;
foreach
(
$valueGroup
AS
$document
)
{
foreach
(
$valueGroup
AS
$document
)
{
echo
'<hr/><table>'
;
echo
'<hr/><table>'
;
// the documents are also iterable, to get all fields
// the documents are also iterable, to get all fields
...
...
examples/2.1.5.7-grouping-by-query.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
...
examples/2.1.5.8-distributed-search.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
...
examples/2.1.5.9-spellcheck.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
...
examples/2.1.6-helper-functions.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance and a query helper instance
// get a select query instance and a query helper instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
...
examples/2.1.7-query-reuse.php
View file @
4e71fc88
...
@@ -4,11 +4,11 @@ require('init.php');
...
@@ -4,11 +4,11 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// first create a base query as a query class
// first create a base query as a query class
class
PriceQuery
extends
Solarium\Query\Select
class
PriceQuery
extends
Solarium\Query\Select
\Select
{
{
protected
function
_init
()
protected
function
_init
()
{
{
...
...
examples/2.2.1-add-docs.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get an update query instance
// get an update query instance
$update
=
$client
->
createUpdate
();
$update
=
$client
->
createUpdate
();
...
...
examples/2.2.2-delete-by-query.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get an update query instance
// get an update query instance
$update
=
$client
->
createUpdate
();
$update
=
$client
->
createUpdate
();
...
...
examples/2.2.3-delete-by-id.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get an update query instance
// get an update query instance
$update
=
$client
->
createUpdate
();
$update
=
$client
->
createUpdate
();
...
...
examples/2.2.4-optimize.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get an update query instance
// get an update query instance
$update
=
$client
->
createUpdate
();
$update
=
$client
->
createUpdate
();
...
...
examples/2.2.5-rollback.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get an update query instance
// get an update query instance
$update
=
$client
->
createUpdate
();
$update
=
$client
->
createUpdate
();
...
...
examples/2.3.1-mlt-query.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a morelikethis query instance
// get a morelikethis query instance
$query
=
$client
->
createMoreLikeThis
();
$query
=
$client
->
createMoreLikeThis
();
...
@@ -44,7 +44,7 @@ foreach ($resultset as $document) {
...
@@ -44,7 +44,7 @@ foreach ($resultset as $document) {
{
{
// this converts multivalue fields to a comma-separated string
// this converts multivalue fields to a comma-separated string
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
}
}
...
...
examples/2.3.2-mlt-stream.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a morelikethis query instance
// get a morelikethis query instance
$query
=
$client
->
createMoreLikeThis
();
$query
=
$client
->
createMoreLikeThis
();
...
@@ -45,7 +45,7 @@ foreach ($resultset as $document) {
...
@@ -45,7 +45,7 @@ foreach ($resultset as $document) {
{
{
// this converts multivalue fields to a comma-separated string
// this converts multivalue fields to a comma-separated string
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
}
}
...
...
examples/2.4.1-analysis-document.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get an analysis document query
// get an analysis document query
$query
=
$client
->
createAnalysisDocument
();
$query
=
$client
->
createAnalysisDocument
();
...
...
examples/2.4.2-analysis-field.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get an analysis document query
// get an analysis document query
$query
=
$client
->
createAnalysisField
();
$query
=
$client
->
createAnalysisField
();
...
...
examples/2.5-terms-query.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a terms query instance
// get a terms query instance
$query
=
$client
->
createTerms
();
$query
=
$client
->
createTerms
();
...
...
examples/4.1-api-usage.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
@@ -13,7 +13,7 @@ $query = $client->createSelect();
...
@@ -13,7 +13,7 @@ $query = $client->createSelect();
$query
->
setQuery
(
'*:*'
);
$query
->
setQuery
(
'*:*'
);
$query
->
setStart
(
2
)
->
setRows
(
20
);
$query
->
setStart
(
2
)
->
setRows
(
20
);
$query
->
setFields
(
array
(
'id'
,
'name'
,
'price'
));
$query
->
setFields
(
array
(
'id'
,
'name'
,
'price'
));
$query
->
addSort
(
'price'
,
Solarium\Query\Select
::
SORT_ASC
);
$query
->
addSort
(
'price'
,
Solarium\Query\Select
\Select
::
SORT_ASC
);
// create a filterquery using the API
// create a filterquery using the API
$fq
=
$query
->
createFilterQuery
(
'maxprice'
)
->
setQuery
(
'price:[1 TO 300]'
);
$fq
=
$query
->
createFilterQuery
(
'maxprice'
)
->
setQuery
(
'price:[1 TO 300]'
);
...
...
examples/4.2-configuration-usage.php
View file @
4e71fc88
...
@@ -29,7 +29,7 @@ $select = array(
...
@@ -29,7 +29,7 @@ $select = array(
);
);
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance based on the config
// get a select query instance based on the config
$query
=
$client
->
createSelect
(
$select
);
$query
=
$client
->
createSelect
(
$select
);
...
...
examples/4.3-extending-usage.php
View file @
4e71fc88
...
@@ -39,7 +39,7 @@ class ProductPriceLimitedQuery extends ProductQuery{
...
@@ -39,7 +39,7 @@ class ProductPriceLimitedQuery extends ProductQuery{
}
}
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// create a query instance
// create a query instance
$query
=
new
ProductPriceLimitedQuery
;
$query
=
new
ProductPriceLimitedQuery
;
...
...
examples/5.1-partial-usage.php
View file @
4e71fc88
...
@@ -10,7 +10,7 @@ htmlHeader();
...
@@ -10,7 +10,7 @@ htmlHeader();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// create a select query instance
// create a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
@@ -41,7 +41,7 @@ foreach ($result as $document) {
...
@@ -41,7 +41,7 @@ foreach ($result as $document) {
{
{
// this converts multivalue fields to a comma-separated string
// this converts multivalue fields to a comma-separated string
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
}
}
...
...
examples/5.2-extending.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// This is a custom query class that could have some customized logic
// This is a custom query class that could have some customized logic
class
MyQuery
extends
Solarium\Query\Select
class
MyQuery
extends
Solarium\Query\Select
\Select
{
{
// ...customization here...
// ...customization here...
}
}
...
@@ -12,7 +12,7 @@ class MyQuery extends Solarium\Query\Select
...
@@ -12,7 +12,7 @@ class MyQuery extends Solarium\Query\Select
// And this is the extended client, that modifies the default query mapping
// And this is the extended client, that modifies the default query mapping
// for select queries to our custom query class.
// for select queries to our custom query class.
// BTW, the same could also be done using a plugin, see example 5.3.2
// BTW, the same could also be done using a plugin, see example 5.3.2
class
MyClient
extends
Solarium\Client
class
MyClient
extends
Solarium\Client
\Client
{
{
/**
/**
* Querytype mappings
* Querytype mappings
...
@@ -20,8 +20,8 @@ class MyClient extends Solarium\Client
...
@@ -20,8 +20,8 @@ class MyClient extends Solarium\Client
protected
$_queryTypes
=
array
(
protected
$_queryTypes
=
array
(
self
::
QUERYTYPE_SELECT
=>
array
(
self
::
QUERYTYPE_SELECT
=>
array
(
'query'
=>
'MyQuery'
,
'query'
=>
'MyQuery'
,
'requestbuilder'
=>
'Solarium\Client\RequestBuilder\Select'
,
'requestbuilder'
=>
'Solarium\Client\RequestBuilder\Select
\Select
'
,
'responseparser'
=>
'Solarium\Client\ResponseParser\Select'
'responseparser'
=>
'Solarium\Client\ResponseParser\Select
\Select
'
),
),
self
::
QUERYTYPE_UPDATE
=>
array
(
self
::
QUERYTYPE_UPDATE
=>
array
(
'query'
=>
'Solarium\Query\Update'
,
'query'
=>
'Solarium\Query\Update'
,
...
@@ -62,7 +62,7 @@ foreach ($result as $document) {
...
@@ -62,7 +62,7 @@ foreach ($result as $document) {
{
{
// this converts multivalue fields to a comma-separated string
// this converts multivalue fields to a comma-separated string
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
}
}
...
...
examples/5.3.1-plugin-event-hooks.php
View file @
4e71fc88
...
@@ -3,7 +3,7 @@ require('init.php');
...
@@ -3,7 +3,7 @@ require('init.php');
// this very simple plugin shows a timing for each event and display some request debug info
// this very simple plugin shows a timing for each event and display some request debug info
class
basicDebug
extends
Solarium\PluginAbstractPlugin
class
basicDebug
extends
Solarium\Plugin
\
AbstractPlugin
{
{
protected
$_start
;
protected
$_start
;
...
@@ -90,7 +90,7 @@ htmlHeader();
...
@@ -90,7 +90,7 @@ htmlHeader();
// create a client instance and register the plugin
// create a client instance and register the plugin
$plugin
=
new
basicDebug
();
$plugin
=
new
basicDebug
();
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
$client
->
registerPlugin
(
'debugger'
,
$plugin
);
$client
->
registerPlugin
(
'debugger'
,
$plugin
);
// execute a select query and display the results
// execute a select query and display the results
...
...
examples/5.3.2-plugin-solarium-presets.php
View file @
4e71fc88
...
@@ -2,32 +2,32 @@
...
@@ -2,32 +2,32 @@
require
(
'init.php'
);
require
(
'init.php'
);
// This is a custom query class that could have some customized logic
// This is a custom query class that could have some customized logic
class
MyQuery
extends
Solarium\Query\Select
class
MyQuery
extends
Solarium\Query\Select
\Select
{
{
// ...customization here...
// ...customization here...
}
}
// this very simple plugin that modifies the default querytype mapping
// this very simple plugin that modifies the default querytype mapping
class
queryCustomizer
extends
Solarium\PluginAbstractPlugin
class
queryCustomizer
extends
Solarium\Plugin
\
AbstractPlugin
{
{
protected
function
_initPlugin
()
protected
function
_initPlugin
()
{
{
$this
->
_client
->
registerQueryType
(
$this
->
_client
->
registerQueryType
(
Solarium\Client
::
QUERYTYPE_SELECT
,
Solarium\Client
\Client
::
QUERYTYPE_SELECT
,
'MyQuery'
,
'MyQuery'
,
'Solarium\Client\RequestBuilder\Select'
,
'Solarium\Client\RequestBuilder\Select
\Select
'
,
'Solarium\Client\ResponseParser\Select'
'Solarium\Client\ResponseParser\Select
\Select
'
);
);
}
}
}
}
htmlHeader
();
htmlHeader
();
// create a client instance and register the plugin
// create a client instance and register the plugin
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
$client
->
registerPlugin
(
'querycustomizer'
,
'queryCustomizer'
);
$client
->
registerPlugin
(
'querycustomizer'
,
'queryCustomizer'
);
// create a select query instance
// create a select query instance
...
...
examples/6.1.1-zend-http-adapter.php
View file @
4e71fc88
...
@@ -7,7 +7,7 @@ require('init.php');
...
@@ -7,7 +7,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// set the adapter to zendhttp and get a zendhttp client instance reference
// set the adapter to zendhttp and get a zendhttp client instance reference
$client
->
setAdapter
(
'Solarium\Client\Adapter\ZendHttp'
);
$client
->
setAdapter
(
'Solarium\Client\Adapter\ZendHttp'
);
...
@@ -35,7 +35,7 @@ foreach ($resultset as $document) {
...
@@ -35,7 +35,7 @@ foreach ($resultset as $document) {
{
{
// this converts multivalue fields to a comma-separated string
// this converts multivalue fields to a comma-separated string
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
}
}
...
...
examples/6.1.2-pecl-http-adapter.php
View file @
4e71fc88
...
@@ -7,7 +7,7 @@ require('init.php');
...
@@ -7,7 +7,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// set the adapter to peclhttp
// set the adapter to peclhttp
$client
->
setAdapter
(
'Solarium\Client\Adapter\PeclHttp'
);
$client
->
setAdapter
(
'Solarium\Client\Adapter\PeclHttp'
);
...
@@ -31,7 +31,7 @@ foreach ($resultset as $document) {
...
@@ -31,7 +31,7 @@ foreach ($resultset as $document) {
{
{
// this converts multivalue fields to a comma-separated string
// this converts multivalue fields to a comma-separated string
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
}
}
...
...
examples/6.1.3-curl-adapter.php
View file @
4e71fc88
...
@@ -7,7 +7,7 @@ require('init.php');
...
@@ -7,7 +7,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// set the adapter to curl
// set the adapter to curl
$client
->
setAdapter
(
'Solarium\Client\Adapter\Curl'
);
$client
->
setAdapter
(
'Solarium\Client\Adapter\Curl'
);
...
...
examples/6.2-escaping.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
@@ -33,7 +33,7 @@ foreach ($resultset as $document) {
...
@@ -33,7 +33,7 @@ foreach ($resultset as $document) {
{
{
// this converts multivalue fields to a comma-separated string
// this converts multivalue fields to a comma-separated string
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
}
}
...
...
examples/6.3-placeholder-syntax.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance
// create a client instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
// get a select query instance
// get a select query instance
$query
=
$client
->
createSelect
();
$query
=
$client
->
createSelect
();
...
@@ -35,7 +35,7 @@ foreach ($resultset as $document) {
...
@@ -35,7 +35,7 @@ foreach ($resultset as $document) {
{
{
// this converts multivalue fields to a comma-separated string
// this converts multivalue fields to a comma-separated string
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
if
(
is_array
(
$value
))
$value
=
implode
(
', '
,
$value
);
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
echo
'<tr><th>'
.
$field
.
'</th><td>'
.
$value
.
'</td></tr>'
;
}
}
...
...
examples/7.1-plugin-loadbalancer.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance and get loadbalancer plugin instance
// create a client instance and get loadbalancer plugin instance
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
$loadbalancer
=
$client
->
getPlugin
(
'loadbalancer'
);
$loadbalancer
=
$client
->
getPlugin
(
'loadbalancer'
);
// apply loadbalancer settings
// apply loadbalancer settings
...
@@ -39,7 +39,7 @@ echo 'Loadbalanced ping query, should display a loadbalancing server:<br/>';
...
@@ -39,7 +39,7 @@ echo 'Loadbalanced ping query, should display a loadbalancing server:<br/>';
echo
'Ping server: '
.
$loadbalancer
->
getLastServerKey
()
.
'<hr/>'
;
echo
'Ping server: '
.
$loadbalancer
->
getLastServerKey
()
.
'<hr/>'
;
// exclude ping query from loadbalancing
// exclude ping query from loadbalancing
$loadbalancer
->
addBlockedQueryType
(
Solarium\Client
::
QUERYTYPE_PING
);
$loadbalancer
->
addBlockedQueryType
(
Solarium\Client
\Client
::
QUERYTYPE_PING
);
$client
->
ping
(
$query
);
$client
->
ping
(
$query
);
echo
'Non-loadbalanced ping query, should not display a loadbalancing server:<br/>'
;
echo
'Non-loadbalanced ping query, should not display a loadbalancing server:<br/>'
;
echo
'Ping server: '
.
$loadbalancer
->
getLastServerKey
()
.
'<hr/>'
;
echo
'Ping server: '
.
$loadbalancer
->
getLastServerKey
()
.
'<hr/>'
;
...
...
examples/7.2-plugin-postbigrequest.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance and autoload the postbigrequest plugin
// create a client instance and autoload the postbigrequest plugin
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
$client
->
getPlugin
(
'postbigrequest'
);
$client
->
getPlugin
(
'postbigrequest'
);
// create a basic query to execute
// create a basic query to execute
...
...
examples/7.3-plugin-customizerequest.php
View file @
4e71fc88
...
@@ -4,7 +4,7 @@ require('init.php');
...
@@ -4,7 +4,7 @@ require('init.php');
htmlHeader
();
htmlHeader
();
// create a client instance and autoload the customize request plugin
// create a client instance and autoload the customize request plugin
$client
=
new
Solarium\Client
(
$config
);
$client
=
new
Solarium\Client
\Client
(
$config
);
$customizer
=
$client
->
getPlugin
(
'customizerequest'
);
$customizer
=
$client
->
getPlugin
(
'customizerequest'
);
// add a persistent HTTP header (using array input values)
// add a persistent HTTP header (using array input values)
...
...
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