diff --git a/.styleci.yml b/.styleci.yml
index 9e4bfcdb1..2a9ab7c93 100644
--- a/.styleci.yml
+++ b/.styleci.yml
@@ -2,6 +2,7 @@ preset: symfony
finder:
path:
+ - "examples"
- "src"
- "tests"
diff --git a/docs/client-and-adapters.md b/docs/client-and-adapters.md
index 51defaaff..37644d70d 100644
--- a/docs/client-and-adapters.md
+++ b/docs/client-and-adapters.md
@@ -52,7 +52,8 @@ Since Solarium 5.2 any [PSR-14](https://www.php-fig.org/psr/psr-14/) compatible
```php
createRequest($query);
// you can now use the request object for getting an uri (e.g. to use in your own code)
// or you could modify the request object
-echo 'Request URI: ' . $request->getUri() . '
';
+echo 'Request URI: '.$request->getUri().'
';
// you can still execute the request using the client and get a 'raw' response object
$response = $client->executeRequest($request);
@@ -61,7 +61,6 @@ echo 'NumFound: '.$result->getNumFound();
// show documents using the resultset iterator
foreach ($result as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -71,7 +70,7 @@ foreach ($result as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
@@ -100,15 +99,16 @@ This example shows all available events and how to use the events to create a ve
```php
start = microtime(true);
$dispatcher = $this->client->getEventDispatcher();
- $dispatcher->addListener(Events::PRE_CREATE_REQUEST, array($this, 'preCreateRequest'));
- $dispatcher->addListener(Events::POST_CREATE_REQUEST, array($this, 'postCreateRequest'));
- $dispatcher->addListener(Events::PRE_EXECUTE_REQUEST, array($this, 'preExecuteRequest'));
- $dispatcher->addListener(Events::POST_EXECUTE_REQUEST, array($this, 'postExecuteRequest'));
- $dispatcher->addListener(Events::PRE_CREATE_RESULT, array($this, 'preCreateResult'));
- $dispatcher->addListener(Events::POST_CREATE_RESULT, array($this, 'postCreateResult'));
- $dispatcher->addListener(Events::PRE_EXECUTE, array($this, 'preExecute'));
- $dispatcher->addListener(Events::POST_EXECUTE, array($this, 'postExecute'));
- $dispatcher->addListener(Events::PRE_CREATE_QUERY, array($this, 'preCreateQuery'));
- $dispatcher->addListener(Events::POST_CREATE_QUERY, array($this, 'postCreateQuery'));
+ $dispatcher->addListener(Events::PRE_CREATE_REQUEST, [$this, 'preCreateRequest']);
+ $dispatcher->addListener(Events::POST_CREATE_REQUEST, [$this, 'postCreateRequest']);
+ $dispatcher->addListener(Events::PRE_EXECUTE_REQUEST, [$this, 'preExecuteRequest']);
+ $dispatcher->addListener(Events::POST_EXECUTE_REQUEST, [$this, 'postExecuteRequest']);
+ $dispatcher->addListener(Events::PRE_CREATE_RESULT, [$this, 'preCreateResult']);
+ $dispatcher->addListener(Events::POST_CREATE_RESULT, [$this, 'postCreateResult']);
+ $dispatcher->addListener(Events::PRE_EXECUTE, [$this, 'preExecute']);
+ $dispatcher->addListener(Events::POST_EXECUTE, [$this, 'postExecute']);
+ $dispatcher->addListener(Events::PRE_CREATE_QUERY, [$this, 'preCreateQuery']);
+ $dispatcher->addListener(Events::POST_CREATE_QUERY, [$this, 'postCreateQuery']);
}
// This method is called if the plugin is removed from the client.
public function deinitPlugin(): void
{
$dispatcher = $this->client->getEventDispatcher();
- $dispatcher->removeListener(Events::PRE_CREATE_REQUEST, array($this, 'preCreateRequest'));
- $dispatcher->removeListener(Events::POST_CREATE_REQUEST, array($this, 'postCreateRequest'));
- $dispatcher->removeListener(Events::PRE_EXECUTE_REQUEST, array($this, 'preExecuteRequest'));
- $dispatcher->removeListener(Events::POST_EXECUTE_REQUEST, array($this, 'postExecuteRequest'));
- $dispatcher->removeListener(Events::PRE_CREATE_RESULT, array($this, 'preCreateResult'));
- $dispatcher->removeListener(Events::POST_CREATE_RESULT, array($this, 'postCreateResult'));
- $dispatcher->removeListener(Events::PRE_EXECUTE, array($this, 'preExecute'));
- $dispatcher->removeListener(Events::POST_EXECUTE, array($this, 'postExecute'));
- $dispatcher->removeListener(Events::PRE_CREATE_QUERY, array($this, 'preCreateQuery'));
- $dispatcher->removeListener(Events::POST_CREATE_QUERY, array($this, 'postCreateQuery'));
+ $dispatcher->removeListener(Events::PRE_CREATE_REQUEST, [$this, 'preCreateRequest']);
+ $dispatcher->removeListener(Events::POST_CREATE_REQUEST, [$this, 'postCreateRequest']);
+ $dispatcher->removeListener(Events::PRE_EXECUTE_REQUEST, [$this, 'preExecuteRequest']);
+ $dispatcher->removeListener(Events::POST_EXECUTE_REQUEST, [$this, 'postExecuteRequest']);
+ $dispatcher->removeListener(Events::PRE_CREATE_RESULT, [$this, 'preCreateResult']);
+ $dispatcher->removeListener(Events::POST_CREATE_RESULT, [$this, 'postCreateResult']);
+ $dispatcher->removeListener(Events::PRE_EXECUTE, [$this, 'preExecute']);
+ $dispatcher->removeListener(Events::POST_EXECUTE, [$this, 'postExecute']);
+ $dispatcher->removeListener(Events::PRE_CREATE_QUERY, [$this, 'preCreateQuery']);
+ $dispatcher->removeListener(Events::POST_CREATE_QUERY, [$this, 'postCreateQuery']);
}
protected function timer(string $event): void
{
$time = round(microtime(true) - $this->start, 5);
- $this->output[] = '['.$time.'] ' . $event;
+ $this->output[] = '['.$time.'] '.$event;
}
public function display(): void
@@ -174,7 +174,7 @@ class BasicDebug extends Solarium\Core\Plugin\AbstractPlugin
// this dummy param will be visible in the debug output but will also be used in the actual Solr request
$event->getRequest()->addParam('dummyparam', 'dummyvalue');
- $this->output[] = 'Request URI: ' . $event->getRequest()->getUri();
+ $this->output[] = 'Request URI: '.$event->getRequest()->getUri();
}
public function postExecuteRequest(): void
@@ -213,7 +213,6 @@ class BasicDebug extends Solarium\Core\Plugin\AbstractPlugin
}
}
-
htmlHeader();
// create a client instance and register the plugin
@@ -227,7 +226,6 @@ $resultset = $client->select($query);
echo 'NumFound: '.$resultset->getNumFound();
foreach ($resultset as $document) {
-
echo '
';
foreach ($document as $field => $value) {
@@ -235,7 +233,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
@@ -253,11 +251,12 @@ The second example shows how to replace the built-in select querytype with a cus
```php
registerPlugin('querycustomizer', 'QueryCustomizer');
$query = $client->createSelect();
// check the query class, it should be our custom query class
-echo 'Query class: ' . get_class($query) . '
';
+echo 'Query class: '.get_class($query).'
';
// execute the query and display the results
$resultset = $client->select($query);
echo 'NumFound: '.$resultset->getNumFound();
foreach ($resultset as $document) {
-
echo '
';
foreach ($document as $field => $value) {
@@ -301,7 +298,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/docs/documents.md b/docs/documents.md
index 47cd85edf..d4832df37 100644
--- a/docs/documents.md
+++ b/docs/documents.md
@@ -32,24 +32,24 @@ Solarium uses this document type as default for select queries for two reasons:
```php
createQuery($client::QUERY_SELECT);
+$query = $client->createSelect();
// this executes the query and returns the result
-$resultset = $client->execute($query);
+$resultset = $client->select($query);
// display the total number of documents found by Solr
echo 'NumFound: '.$resultset->getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -59,7 +59,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
@@ -90,7 +90,8 @@ See the API docs for details and the example code below for examples.
```php
name = 'testdoc-2';
$doc2->price = 340;
// add the documents and a commit command to the update query
-$update->addDocuments(array($doc1, $doc2));
+$update->addDocuments([$doc1, $doc2]);
$update->addCommit();
// this executes the query and returns the result
$result = $client->update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
@@ -145,7 +146,8 @@ Your schema has to meet certain criteria for this to work. For more info on inde
```php
createUpdate();
$doc1 = $update->createDocument();
$doc1->id = 123;
$doc1->name = 'testdoc-1';
-$doc1->childdocs = array(
- array(
+$doc1->childdocs = [
+ [
'id' => 1230,
'name' => 'childdoc-1-1',
'price' => 465,
- ),
- array(
+ ],
+ [
'id' => 1231,
'name' => 'childdoc-1-2',
'price' => 545,
- ),
-);
+ ],
+];
// and a second one where child documents are added one by one
$doc2 = $update->createDocument();
$doc2->setField('id', 124);
$doc2->setField('name', 'testdoc-2');
-$doc2->addField('childdocs', array(
+$doc2->addField('childdocs', [
'id' => 1240,
'name' => 'childdoc-2-1',
'price' => 360,
-));
-$doc2->addField('childdocs', array(
+]);
+$doc2->addField('childdocs', [
'id' => 1241,
'name' => 'childdoc-2-2',
'price' => 398,
-));
+]);
// add the documents and a commit command to the update query
-$update->addDocuments(array($doc1, $doc2));
+$update->addDocuments([$doc1, $doc2]);
$update->addCommit();
// this executes the query and returns the result
$result = $client->update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
```
@@ -264,7 +266,8 @@ A document with atomic updates can be added to an update query just like any oth
```php
addCommit();
$result = $client->update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
// get a select query instance
$query = $client->createSelect();
@@ -319,11 +322,10 @@ echo '
NumFound: '.$resultset->getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/docs/exceptions.md b/docs/exceptions.md
index e88d2d49a..3628513c5 100644
--- a/docs/exceptions.md
+++ b/docs/exceptions.md
@@ -11,7 +11,8 @@ An unreachable endpoint can be emulated to run the following examples "successfu
```php
createPing();
// execute the ping query—it'll fail!
-$client->execute($ping);
+$client->ping($ping);
```
@@ -34,7 +35,7 @@ Every exception thrown by Solarium is a descendant of the PHP base class `Except
```php
try {
- $client->execute($ping);
+ $client->ping($ping);
} catch (Exception $e) {
echo 'Something went wrong:
';
echo $e->getMessage();
@@ -48,7 +49,7 @@ Exceptions thrown by Solarium implement a marker interface. This empty interface
```php
try {
- $client->execute($ping);
+ $client->ping($ping);
} catch (Solarium\Exception\ExceptionInterface $e) {
echo 'Solarium ran into a problem:
';
echo $e->getMessage();
@@ -65,7 +66,7 @@ An exception can be singled out by catching it separately.
```php
try {
- $client->execute($ping);
+ $client->ping($ping);
} catch (Solarium\Exception\HttpException $e) {
echo 'Solarium can\'t reach your Solr server:
';
echo $e->getMessage();
@@ -79,7 +80,7 @@ The distinction can also be made inside the catch block for a generic `Exception
```php
try {
- $client->execute($ping);
+ $client->ping($ping);
} catch (Exception $e) {
echo 'Something went wrong:
';
echo $e->getMessage();
diff --git a/docs/getting-started.md b/docs/getting-started.md
index dcc95b330..0f9128b13 100644
--- a/docs/getting-started.md
+++ b/docs/getting-started.md
@@ -57,11 +57,12 @@ To check your installation you can do a Solarium version check with the followin
```php
ping($ping);
echo 'Ping query successful
';
- echo 'Ping status: ' . $result->getPingStatus() . '
';
- echo 'Query time: ' . $result->getQueryTime() . ' ms';
+ echo 'Ping status: '.$result->getPingStatus().'
';
+ echo 'Query time: '.$result->getQueryTime().' ms';
} catch (Exception $e) {
echo 'Ping query failed';
}
@@ -308,9 +309,10 @@ The `$config` array has the following contents:
```php
array(
- 'localhost' => array(
+$config = [
+ 'endpoint' => [
+ 'localhost' => [
+ 'scheme' => 'http',
'host' => '127.0.0.1',
'port' => 8983,
'path' => '/',
@@ -319,9 +321,9 @@ $config = array(
// 'collection' => 'techproducts',
// Set the `hostContext` for the Solr web application if it's not the default 'solr':
// 'context' => 'solr',
- )
- )
-);
+ ],
+ ],
+];
```
### Selecting documents
@@ -331,24 +333,24 @@ This is the basic example of executing a select query and displaying the results
```php
createQuery($client::QUERY_SELECT);
+$query = $client->createSelect();
// this executes the query and returns the result
-$resultset = $client->execute($query);
+$resultset = $client->select($query);
// display the total number of documents found by Solr
echo 'NumFound: '.$resultset->getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -358,7 +360,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
@@ -377,7 +379,8 @@ This example demonstrates a facet field.
```php
getNumFound();
echo '
Facet counts for field "inStock":
';
$facet = $resultset->getFacetSet()->getFacet('stock');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
@@ -426,7 +428,8 @@ Documents can be deleted with a query:
```php
addCommit();
$result = $client->update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
@@ -455,7 +458,8 @@ Or by id:
```php
addCommit();
$result = $client->update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
@@ -488,7 +492,8 @@ This example adds some documents to the index:
```php
name = 'testdoc-2';
$doc2->price = 340;
// add the documents and a commit command to the update query
-$update->addDocuments(array($doc1, $doc2));
+$update->addDocuments([$doc1, $doc2]);
$update->addCommit();
// this executes the query and returns the result
$result = $client->update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
@@ -541,8 +546,8 @@ $query = $client->createSelect();
$query->setOmitHeader(false);
$result = $client->select($query);
-echo 'Query status: ' . $result->getStatus();
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
```
diff --git a/docs/index.md b/docs/index.md
index 52b1d8e95..6f2ca50f7 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -1,6 +1,5 @@
Solarium documentation
-=================
-
+======================
Solarium is a Solr client library for PHP. It is developed with these goals in mind:
@@ -26,15 +25,15 @@ $facetSet = $query->getFacetSet();
$facetSet->createFacetField('stock')->setField('inStock');
$resultset = $client->select($query);
-echo 'NumFound: '.$resultset->getNumFound() . PHP_EOL;
+echo 'NumFound: '.$resultset->getNumFound().PHP_EOL;
$facet = $resultset->getFacetSet()->getFacet('stock');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']' . PHP_EOL;
+ echo $value.' ['.$count.']'.PHP_EOL;
}
foreach ($resultset as $document) {
- echo $document->id . PHP_EOL;
- echo $document->name . PHP_EOL;
+ echo $document->id.PHP_EOL;
+ echo $document->name.PHP_EOL;
}
```
diff --git a/docs/plugins.md b/docs/plugins.md
index cc3eb239f..6ed38c373 100644
--- a/docs/plugins.md
+++ b/docs/plugins.md
@@ -50,11 +50,11 @@ Triggered just after a commit. Has access to the commit (update query) result.
```php
setBufferSize(10); // this is quite low, in most cases you can use a mu
$client->getEventDispatcher()->addListener(
Events::PRE_FLUSH,
function (PreFlush $event): void {
- echo 'Flushing buffer (' . count($event->getBuffer()) . ' docs)
';
+ echo 'Flushing buffer ('.count($event->getBuffer()).' docs)
';
}
);
// let's insert 25 docs
-for ($i=1; $i<=25; $i++) {
-
+for ($i = 1; $i <= 25; ++$i) {
// create a new document with dummy data and add it to the buffer
- $data = array(
+ $data = [
'id' => 'test_'.$i,
'name' => 'test for buffered add',
'price' => $i,
- );
+ ];
$buffer->createDocument($data);
// alternatively you could create document instances yourself and use the addDocument(s) method
@@ -145,11 +144,11 @@ Triggered just after a commit. Has access to the commit (update query) result.
```php
setBufferSize(10); // this is quite low, in most cases you can use a mu
$client->getEventDispatcher()->addListener(
Events::PRE_FLUSH,
function (PreFlush $event): void {
- echo 'Flushing buffer (' . count($event->getBuffer()) . ' deletes)
';
+ echo 'Flushing buffer ('.count($event->getBuffer()).' deletes)
';
}
);
// let's delete 25 docs
-for ($i=1; $i<=25; $i++) {
+for ($i = 1; $i <= 25; ++$i) {
$buffer->addDeleteById($i);
}
@@ -210,7 +209,7 @@ GET params and headers by default are only applied to the next request, but opti
```php
getPlugin('customizerequest');
// add a persistent HTTP header (using array input values)
$customizer->createCustomization(
- array(
+ [
'key' => 'auth',
'type' => 'header',
'name' => 'X-my-auth',
'value' => 'mypassword',
- 'persistent' => true
- )
+ 'persistent' => true,
+ ]
);
// add a persistent GET param (using fluent interface)
@@ -249,7 +248,7 @@ $query = $client->createSelect();
$resultset = $client->select($query);
// display the total number of documents found by Solr
-echo 'NumFound: '.$resultset->getNumFound() . '
';
+echo 'NumFound: '.$resultset->getNumFound().'
';
// execute the same query again (this time the 'id' param should no longer show up in the logs)
$resultset = $client->select($query);
@@ -313,13 +312,13 @@ $event->getResponse()->getStatusMessage();
```php
createEndpoint('local1'); //normally you would add endpoint specific settings...
+$endpoint1 = $client->createEndpoint('local1'); // normally you would add endpoint specific settings...
$endpoint2 = $client->createEndpoint('local2');
$endpoint3 = $client->createEndpoint('local3');
@@ -338,11 +337,11 @@ $loadbalancer->addFailoverStatusCode(504);
$query = $client->createSelect();
// execute the query multiple times, displaying the server for each execution
-for ($i = 1; $i <= 8; $i++) {
+for ($i = 1; $i <= 8; ++$i) {
$resultset = $client->select($query);
- echo 'Query execution #' . $i . '
';
- echo 'NumFound: ' . $resultset->getNumFound(). '
';
- echo 'Server: ' . $loadbalancer->getLastEndpoint() .'
';
+ echo 'Query execution #'.$i.'
';
+ echo 'NumFound: '.$resultset->getNumFound().'
';
+ echo 'Server: '.$loadbalancer->getLastEndpoint().'
';
}
// force a server for a query (normally 'local3' is extremely unlikely based on its weight)
@@ -350,20 +349,20 @@ $loadbalancer->setForcedEndpointForNextQuery('local3');
$resultset = $client->select($query);
echo 'Query execution with server forced to local3
';
-echo 'NumFound: ' . $resultset->getNumFound(). '
';
-echo 'Server: ' . $loadbalancer->getLastEndpoint() .'
';
+echo 'NumFound: '.$resultset->getNumFound().'
';
+echo 'Server: '.$loadbalancer->getLastEndpoint().'
';
// test a ping query
$query = $client->createPing();
$client->ping($query);
echo 'Loadbalanced ping query, should display a loadbalancing server:
';
-echo 'Ping server: ' . $loadbalancer->getLastEndpoint() .'
';
+echo 'Ping server: '.$loadbalancer->getLastEndpoint().'
';
// exclude ping query from loadbalancing
$loadbalancer->addBlockedQueryType(Solarium\Client::QUERY_PING);
$client->ping($query);
echo 'Non-loadbalanced ping query, should not display a loadbalancing server:
';
-echo 'Ping server: ' . $loadbalancer->getLastEndpoint() .'
';
+echo 'Ping server: '.$loadbalancer->getLastEndpoint().'
';
htmlFooter();
@@ -389,7 +388,7 @@ There are two modes of filtering, removing or just marking. In the example below
```php
getPlugin('minimumscorefilter');
$query = $client->createQuery($filter::QUERY_TYPE);
$query->setQuery('a');
-$query->setFields(array('id'));
+$query->setFields(['id']);
$query->setFilterRatio(.5);
$query->setFilterMode($query::FILTER_MODE_MARK);
@@ -413,7 +412,6 @@ echo '
MaxScore: '.$resultset->getMaxScore();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
// by setting the FILTER_MARK option we get a special method to test each document
if ($document->markedAsLowScore()) {
echo '
MARKED AS LOW SCORE';
@@ -428,7 +426,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
@@ -447,6 +445,7 @@ Long-running requests like suggest.buildAll might exceed timeouts. This plugin "
getPlugin('parallelexecution');
// If you don't have to plugin the example still works, just without the delay.
$customizer = $client->getPlugin('customizerequest');
$customizer->createCustomization(
- array(
+ [
'key' => 'delay',
'type' => 'param',
'name' => 'delay',
'value' => '500',
- 'persistent' => true
- )
+ 'persistent' => true,
+ ]
);
// create two queries to execute
@@ -522,12 +521,12 @@ $queryLowPrice = $client->createSelect()->setQuery('price:[1 TO 30]');
// first execute the queries the normal way and time it
echo 'Serial execution
';
$start = microtime(true);
-$resultInStock = $client->execute($queryInStock);
-$resultLowPrice = $client->execute($queryLowPrice);
-echo 'Execution time for normal "serial" execution of two queries: ' . round(microtime(true)-$start, 3) . ' s';
+$resultInStock = $client->select($queryInStock);
+$resultLowPrice = $client->select($queryLowPrice);
+echo 'Execution time for normal "serial" execution of two queries: '.round(microtime(true) - $start, 3).' s';
echo '
';
-echo 'In stock: ' . $resultInStock->getNumFound() . '
';
-echo 'Low price: ' . $resultLowPrice->getNumFound() . '
';
+echo 'In stock: '.$resultInStock->getNumFound().'
';
+echo 'Low price: '.$resultLowPrice->getNumFound().'
';
echo '
';
@@ -538,10 +537,10 @@ $start = microtime(true);
$parallel->addQuery('instock', $queryInStock);
$parallel->addQuery('lowprice', $queryLowPrice);
$results = $parallel->execute();
-echo 'Execution time for parallel execution of two queries: ' . round(microtime(true)-$start, 3) . ' s';
+echo 'Execution time for parallel execution of two queries: '.round(microtime(true) - $start, 3).' s';
echo '
';
-echo 'In stock: ' . $results['instock']->getNumFound() . '
';
-echo 'Low price: ' . $results['lowprice']->getNumFound() . '
';
+echo 'In stock: '.$results['instock']->getNumFound().'
';
+echo 'Low price: '.$results['lowprice']->getNumFound().'
';
htmlFooter();
@@ -568,7 +567,7 @@ The plugin only uses the length of the querystring to determine the switch to a
```php
getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -601,7 +599,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
@@ -686,7 +684,7 @@ $prefetch->setPrefetch($num)->setQuery($query);
```php
createSelect();
-$query->setFields(array('id'));
+$query->setFields(['id']);
// cursor functionality can be used for efficient deep paging (since Solr 4.7)
$query->setCursorMark('*');
@@ -708,11 +706,11 @@ $prefetch->setPrefetch(2); // fetch 2 rows per request (for real world use this
$prefetch->setQuery($query);
// display the total number of documents found by Solr
-echo 'NumFound: ' . count($prefetch);
+echo 'NumFound: '.count($prefetch);
// show document IDs using the resultset iterator
foreach ($prefetch as $document) {
- echo '
ID: '. $document->id;
+ echo '
ID: '.$document->id;
}
htmlFooter();
@@ -827,6 +825,7 @@ The plugin only uses the length of the querystring to determine the parameters r
setShowMatch(true);
$query->setQuery('ipod');
$doc = new Solarium\QueryType\Update\Query\Document(
- array(
+ [
'id' => 'MA147LL',
'name' => 'Apple 60 GB iPod with Video Playback Black',
'manu' => 'Apple Computer Inc.',
@@ -63,7 +64,7 @@ $doc = new Solarium\QueryType\Update\Query\Document(
'price' => 399.00,
'popularity' => 10,
'inStock' => true,
- )
+ ]
);
$query->addDocument($doc);
@@ -73,29 +74,27 @@ $result = $client->analyze($query);
// show the results
foreach ($result as $document) {
-
- echo '
Document: ' . $document->getName() . '
';
+ echo '
Document: '.$document->getName().'
';
foreach ($document as $field) {
-
- echo 'Field: ' . $field->getName() . '
';
+ echo 'Field: '.$field->getName().'
';
$indexAnalysis = $field->getIndexAnalysis();
if (!empty($indexAnalysis)) {
echo 'Index Analysis
';
- foreach ($indexAnalysis as $classes) {
+ foreach ($indexAnalysis as $classes) {
echo ''.$classes->getName().'
';
foreach ($classes as $result) {
- echo 'Text: ' . $result->getText() . '
';
- echo 'Raw text: ' . $result->getRawText() . '
';
- echo 'Start: ' . $result->getStart() . '
';
- echo 'End: ' . $result->getEnd() . '
';
- echo 'Position: ' . $result->getPosition() . '
';
- echo 'Position history: ' . implode(', ', $result->getPositionHistory()) . '
';
- echo 'Type: ' . htmlspecialchars($result->getType()) . '
';
- echo 'Match: ' . var_export($result->getMatch(), true) . '
';
+ echo 'Text: '.$result->getText().'
';
+ echo 'Raw text: '.$result->getRawText().'
';
+ echo 'Start: '.$result->getStart().'
';
+ echo 'End: '.$result->getEnd().'
';
+ echo 'Position: '.$result->getPosition().'
';
+ echo 'Position history: '.implode(', ', $result->getPositionHistory()).'
';
+ echo 'Type: '.htmlspecialchars($result->getType()).'
';
+ echo 'Match: '.var_export($result->getMatch(), true).'
';
echo '-----------
';
}
}
@@ -104,19 +103,19 @@ foreach ($result as $document) {
$queryAnalysis = $field->getQueryAnalysis();
if (!empty($queryAnalysis)) {
echo 'Query Analysis
';
- foreach ($queryAnalysis as $classes) {
+ foreach ($queryAnalysis as $classes) {
echo ''.$classes->getName().'
';
foreach ($classes as $result) {
- echo 'Text: ' . $result->getText() . '
';
- echo 'Raw text: ' . $result->getRawText() . '
';
- echo 'Start: ' . $result->getStart() . '
';
- echo 'End: ' . $result->getEnd() . '
';
- echo 'Position: ' . $result->getPosition() . '
';
- echo 'Position history: ' . implode(', ', $result->getPositionHistory()) . '
';
- echo 'Type: ' . htmlspecialchars($result->getType()) . '
';
- echo 'Match: ' . var_export($result->getMatch(), true) . '
';
+ echo 'Text: '.$result->getText().'
';
+ echo 'Raw text: '.$result->getRawText().'
';
+ echo 'Start: '.$result->getStart().'
';
+ echo 'End: '.$result->getEnd().'
';
+ echo 'Position: '.$result->getPosition().'
';
+ echo 'Position history: '.implode(', ', $result->getPositionHistory()).'
';
+ echo 'Type: '.htmlspecialchars($result->getType()).'
';
+ echo 'Match: '.var_export($result->getMatch(), true).'
';
echo '-----------
';
}
}
diff --git a/docs/queries/analysis-query/analysis-field.md b/docs/queries/analysis-query/analysis-field.md
index 527828998..3c85f9950 100644
--- a/docs/queries/analysis-query/analysis-field.md
+++ b/docs/queries/analysis-query/analysis-field.md
@@ -34,7 +34,8 @@ Example
```php
analyze($query);
// show the results
foreach ($results as $result) {
-
- echo '
Result list: ' . $result->getName() . '
';
+ echo '
Result list: '.$result->getName().'
';
foreach ($result as $item) {
-
- echo 'Item: ' . $item->getName() . '
';
+ echo 'Item: '.$item->getName().'
';
$indexAnalysis = $item->getIndexAnalysis();
if (!empty($indexAnalysis)) {
echo 'Index Analysis
';
- foreach ($indexAnalysis as $classes) {
+ foreach ($indexAnalysis as $classes) {
echo ''.$classes->getName().'
';
foreach ($classes as $result) {
- echo 'Text: ' . $result->getText() . '
';
- echo 'Raw text: ' . $result->getRawText() . '
';
- echo 'Start: ' . $result->getStart() . '
';
- echo 'End: ' . $result->getEnd() . '
';
- echo 'Position: ' . $result->getPosition() . '
';
- echo 'Position history: ' . implode(', ', $result->getPositionHistory()) . '
';
- echo 'Type: ' . htmlspecialchars($result->getType()) . '
';
- echo 'Match: ' . var_export($result->getMatch(), true) . '
';
+ echo 'Text: '.$result->getText().'
';
+ echo 'Raw text: '.$result->getRawText().'
';
+ echo 'Start: '.$result->getStart().'
';
+ echo 'End: '.$result->getEnd().'
';
+ echo 'Position: '.$result->getPosition().'
';
+ echo 'Position history: '.implode(', ', $result->getPositionHistory()).'
';
+ echo 'Type: '.htmlspecialchars($result->getType()).'
';
+ echo 'Match: '.var_export($result->getMatch(), true).'
';
echo '-----------
';
}
}
@@ -85,19 +84,19 @@ foreach ($results as $result) {
$queryAnalysis = $item->getQueryAnalysis();
if (!empty($queryAnalysis)) {
echo 'Query Analysis
';
- foreach ($queryAnalysis as $classes) {
+ foreach ($queryAnalysis as $classes) {
echo ''.$classes->getName().'
';
foreach ($classes as $result) {
- echo 'Text: ' . $result->getText() . '
';
- echo 'Raw text: ' . $result->getRawText() . '
';
- echo 'Start: ' . $result->getStart() . '
';
- echo 'End: ' . $result->getEnd() . '
';
- echo 'Position: ' . $result->getPosition() . '
';
- echo 'Position history: ' . implode(', ', $result->getPositionHistory()) . '
';
- echo 'Type: ' . htmlspecialchars($result->getType()) . '
';
- echo 'Match: ' . var_export($result->getMatch(), true) . '
';
+ echo 'Text: '.$result->getText().'
';
+ echo 'Raw text: '.$result->getRawText().'
';
+ echo 'Start: '.$result->getStart().'
';
+ echo 'End: '.$result->getEnd().'
';
+ echo 'Position: '.$result->getPosition().'
';
+ echo 'Position history: '.implode(', ', $result->getPositionHistory()).'
';
+ echo 'Type: '.htmlspecialchars($result->getType()).'
';
+ echo 'Match: '.var_export($result->getMatch(), true).'
';
echo '-----------
';
}
}
diff --git a/docs/queries/extract-query.md b/docs/queries/extract-query.md
index 0516769c2..146fdf39f 100644
--- a/docs/queries/extract-query.md
+++ b/docs/queries/extract-query.md
@@ -71,7 +71,7 @@ If your content is stored in a database, you can fetch it as [PDO Large Objects
```php
$db = new PDO(...);
-$select = $db->prepare("SELECT content FROM table WHERE id = ?");
+$select = $db->prepare('SELECT content FROM table WHERE id = ?');
$select->execute($id);
$select->bindColumn(1, $content, PDO::PARAM_LOB);
$select->fetch(PDO::FETCH_BOUND);
@@ -105,7 +105,8 @@ Examples
```php
setDocument($doc);
$result = $client->extract($query);
echo 'Extract query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
@@ -141,7 +142,8 @@ htmlFooter();
```php
getFileMetadata() as $field => $value) {
$value = implode('
', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '';
@@ -183,7 +185,8 @@ htmlFooter();
```php
setDocument($doc);
$result = $client->extract($query);
echo 'Extract query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
// don't forget to close your file pointer!
fclose($file);
@@ -228,14 +231,15 @@ htmlFooter();
### Extract from PDO Large Objects (LOBs)
+**Note:** This example doesn't work in PHP < 8.1.0!
+**Note:** This example requires the PDO_SQLITE PDO driver (enabled by default in PHP).
+
```php
Note: This example doesn't work in PHP < 8.1.0!";
-echo "Note: This example requires the PDO_SQLITE PDO driver (enabled by default in PHP)
";
+htmlHeader();
// create a client instance
$client = new Solarium\Client($adapter, $eventDispatcher, $config);
@@ -249,12 +253,12 @@ $query->setOmitHeader(false);
// create a database & store content as an example
$db = new PDO('sqlite::memory:');
-$db->exec("CREATE TABLE test (id INT, content TEXT)");
-$insert = $db->prepare("INSERT INTO test (id, content) VALUES (:id, :content)");
+$db->exec('CREATE TABLE test (id INT, content TEXT)');
+$insert = $db->prepare('INSERT INTO test (id, content) VALUES (:id, :content)');
$insert->execute(['id' => 1, 'content' => file_get_contents(__DIR__.'/index.html')]);
// get content from the database and map it as a stream
-$select = $db->prepare("SELECT content FROM test WHERE id = :id");
+$select = $db->prepare('SELECT content FROM test WHERE id = :id');
$select->execute(['id' => 1]);
$select->bindColumn(1, $content, PDO::PARAM_LOB);
$select->fetch(PDO::FETCH_BOUND);
@@ -272,8 +276,8 @@ $query->setDocument($doc);
$result = $client->extract($query);
echo 'Extract query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
diff --git a/docs/queries/luke-query/luke-query.md b/docs/queries/luke-query/luke-query.md
index aa628458c..0b55213aa 100644
--- a/docs/queries/luke-query/luke-query.md
+++ b/docs/queries/luke-query/luke-query.md
@@ -60,7 +60,7 @@ $lukeQuery = $client->createLuke();
$lukeQuery->setShow($lukeQuery::SHOW_ALL);
// omitting index flags for each field can speed up Luke requests
-//$lukeQuery->setIncludeIndexFieldFlags(false);
+// $lukeQuery->setIncludeIndexFieldFlags(false);
$result = $client->luke($lukeQuery);
@@ -86,10 +86,10 @@ $lukeQuery = $client->createLuke();
$lukeQuery->setFields('text,cat,price_c');
// you can also get detailed information for all fields
-//$lukeQuery->setFields('*');
+// $lukeQuery->setFields('*');
// omitting index flags for each field can speed up Luke requests
-//$lukeQuery->setIncludeIndexFieldFlags(false);
+// $lukeQuery->setIncludeIndexFieldFlags(false);
// set the number of top terms for each field (Solr's default is 10)
$lukeQuery->setNumTerms(5);
@@ -136,7 +136,7 @@ $lukeQuery->setShow($lukeQuery::SHOW_DOC);
$lukeQuery->setId('9885A004');
// alternatively, you can use a Lucene documentID
-//$lukeQuery->setDocId(27);
+// $lukeQuery->setDocId(27);
$result = $client->luke($lukeQuery);
diff --git a/docs/queries/luke-query/result-of-a-luke-query/all-fields.md b/docs/queries/luke-query/result-of-a-luke-query/all-fields.md
index 331e30f96..530080cb5 100644
--- a/docs/queries/luke-query/result-of-a-luke-query/all-fields.md
+++ b/docs/queries/luke-query/result-of-a-luke-query/all-fields.md
@@ -14,7 +14,8 @@ Example usage
```php
createLuke();
$lukeQuery->setShow($lukeQuery::SHOW_ALL);
// omitting index flags for each field can speed up Luke requests
-//$lukeQuery->setIncludeIndexFieldFlags(false);
+// $lukeQuery->setIncludeIndexFieldFlags(false);
$result = $client->luke($lukeQuery);
@@ -36,30 +37,30 @@ $info = $result->getInfo();
echo 'index
';
echo '';
-echo '| numDocs | ' . $index->getNumDocs() . ' |
';
-echo '| maxDoc | ' . $index->getMaxDoc() . ' |
';
-echo '| deletedDocs | ' . $index->getDeletedDocs() . ' |
';
-echo '| indexHeapUsageBytes | ' . ($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)') . ' |
';
-echo '| version | ' . $index->getVersion() . ' |
';
-echo '| segmentCount | ' . $index->getSegmentCount() . ' |
';
-echo '| current | ' . ($index->getCurrent() ? 'true' : 'false') . ' |
';
-echo '| hasDeletions | ' . ($index->getHasDeletions() ? 'true' : 'false') . ' |
';
-echo '| directory | ' . $index->getDirectory() . ' |
';
-echo '| segmentsFile | ' . $index->getSegmentsFile() . ' |
';
-echo '| segmentsFileSizeInBytes | ' . $index->getSegmentsFileSizeInBytes() . ' |
';
+echo '| numDocs | '.$index->getNumDocs().' |
';
+echo '| maxDoc | '.$index->getMaxDoc().' |
';
+echo '| deletedDocs | '.$index->getDeletedDocs().' |
';
+echo '| indexHeapUsageBytes | '.($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)').' |
';
+echo '| version | '.$index->getVersion().' |
';
+echo '| segmentCount | '.$index->getSegmentCount().' |
';
+echo '| current | '.($index->getCurrent() ? 'true' : 'false').' |
';
+echo '| hasDeletions | '.($index->getHasDeletions() ? 'true' : 'false').' |
';
+echo '| directory | '.$index->getDirectory().' |
';
+echo '| segmentsFile | '.$index->getSegmentsFile().' |
';
+echo '| segmentsFileSizeInBytes | '.$index->getSegmentsFileSizeInBytes().' |
';
$userData = $index->getUserData();
echo '| userData | ';
if (null !== $userData->getCommitCommandVer()) {
- echo 'commitCommandVer: ' . $userData->getCommitCommandVer() . ' ';
+ echo 'commitCommandVer: '.$userData->getCommitCommandVer().' ';
}
if (null !== $userData->getCommitTimeMSec()) {
- echo 'commitTimeMSec: ' . $userData->getCommitTimeMSec() . ' ';
+ echo 'commitTimeMSec: '.$userData->getCommitTimeMSec().' ';
}
echo ' |
';
if (null !== $index->getLastModified()) {
- echo '| lastModified | ' . $index->getLastModified()->format(DATE_RFC3339_EXTENDED) . ' |
';
+ echo '| lastModified | '.$index->getLastModified()->format(DATE_RFC3339_EXTENDED).' |
';
}
echo '
';
@@ -77,17 +78,17 @@ echo 'docs | ';
echo '';
foreach ($fields as $field) {
echo '';
- echo '| ' . $field->getName() . ' | ' . $field->getType() . ' | ' . $field->getSchema() . ' | ';
- echo '' . ($field->getSchema()->isIndexed() ? '⚐' : '') . ' | ' . ($field->getSchema()->isTokenized() ? '⚐' : '') . ' | ' . ($field->getSchema()->isStored() ? '⚐' : '') . ' | ' . ($field->getSchema()->isDocValues() ? '⚐' : '') . ' | ';
- echo '' . $field->getDynamicBase() . ' | ' . $field->getIndex() . ' | ';
+ echo ''.$field->getName().' | '.$field->getType().' | '.$field->getSchema().' | ';
+ echo ''.($field->getSchema()->isIndexed() ? '⚐' : '').' | '.($field->getSchema()->isTokenized() ? '⚐' : '').' | '.($field->getSchema()->isStored() ? '⚐' : '').' | '.($field->getSchema()->isDocValues() ? '⚐' : '').' | ';
+ echo ''.$field->getDynamicBase().' | '.$field->getIndex().' | ';
// some fields have '(unstored field)' or no index flags at all in the result
// and with $lukeQuery->setIncludeIndexFieldFlags(false), index flags are omitted for each field
if (is_object($field->getIndex())) {
- echo '' . ($field->getIndex()->isTokenized() ? '⚐' : '') . ' | ' . ($field->getIndex()->isTermVectors() ? '⚐' : '') . ' | ' . ($field->getIndex()->isOmitNorms() ? '⚐' : '') . ' | ';
+ echo ''.($field->getIndex()->isTokenized() ? '⚐' : '').' | '.($field->getIndex()->isTermVectors() ? '⚐' : '').' | '.($field->getIndex()->isOmitNorms() ? '⚐' : '').' | ';
} else {
echo ' | | | ';
}
- echo '' . $field->getDocs() . ' | ';
+ echo ''.$field->getDocs().' | ';
echo '
';
}
echo '';
@@ -99,10 +100,10 @@ echo 'info
';
echo '';
echo '| key | ';
foreach ($info->getKey() as $abbreviation => $flag) {
- echo $abbreviation . ': ' . $flag . ' ';
+ echo $abbreviation.': '.$flag.' ';
}
echo ' |
';
-echo '| NOTE | ' . $info->getNote() . ' |
';
+echo '| NOTE | '.$info->getNote().' |
';
echo '
';
htmlFooter();
diff --git a/docs/queries/luke-query/result-of-a-luke-query/document.md b/docs/queries/luke-query/result-of-a-luke-query/document.md
index 02be7d8b1..49df76e04 100644
--- a/docs/queries/luke-query/result-of-a-luke-query/document.md
+++ b/docs/queries/luke-query/result-of-a-luke-query/document.md
@@ -51,7 +51,8 @@ Example usage
```php
setShow($lukeQuery::SHOW_DOC);
$lukeQuery->setId('9885A004');
// alternatively, you can use a Lucene documentID
-//$lukeQuery->setDocId(27);
+// $lukeQuery->setDocId(27);
$result = $client->luke($lukeQuery);
@@ -76,30 +77,30 @@ $info = $result->getInfo();
echo 'index
';
echo '';
-echo '| numDocs | ' . $index->getNumDocs() . ' |
';
-echo '| maxDoc | ' . $index->getMaxDoc() . ' |
';
-echo '| deletedDocs | ' . $index->getDeletedDocs() . ' |
';
-echo '| indexHeapUsageBytes | ' . ($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)') . ' |
';
-echo '| version | ' . $index->getVersion() . ' |
';
-echo '| segmentCount | ' . $index->getSegmentCount() . ' |
';
-echo '| current | ' . ($index->getCurrent() ? 'true' : 'false') . ' |
';
-echo '| hasDeletions | ' . ($index->getHasDeletions() ? 'true' : 'false') . ' |
';
-echo '| directory | ' . $index->getDirectory() . ' |
';
-echo '| segmentsFile | ' . $index->getSegmentsFile() . ' |
';
-echo '| segmentsFileSizeInBytes | ' . $index->getSegmentsFileSizeInBytes() . ' |
';
+echo '| numDocs | '.$index->getNumDocs().' |
';
+echo '| maxDoc | '.$index->getMaxDoc().' |
';
+echo '| deletedDocs | '.$index->getDeletedDocs().' |
';
+echo '| indexHeapUsageBytes | '.($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)').' |
';
+echo '| version | '.$index->getVersion().' |
';
+echo '| segmentCount | '.$index->getSegmentCount().' |
';
+echo '| current | '.($index->getCurrent() ? 'true' : 'false').' |
';
+echo '| hasDeletions | '.($index->getHasDeletions() ? 'true' : 'false').' |
';
+echo '| directory | '.$index->getDirectory().' |
';
+echo '| segmentsFile | '.$index->getSegmentsFile().' |
';
+echo '| segmentsFileSizeInBytes | '.$index->getSegmentsFileSizeInBytes().' |
';
$userData = $index->getUserData();
echo '| userData | ';
if (null !== $userData->getCommitCommandVer()) {
- echo 'commitCommandVer: ' . $userData->getCommitCommandVer() . ' ';
+ echo 'commitCommandVer: '.$userData->getCommitCommandVer().' ';
}
if (null !== $userData->getCommitTimeMSec()) {
- echo 'commitTimeMSec: ' . $userData->getCommitTimeMSec() . ' ';
+ echo 'commitTimeMSec: '.$userData->getCommitTimeMSec().' ';
}
echo ' |
';
if (null !== $index->getLastModified()) {
- echo '| lastModified | ' . $index->getLastModified()->format(DATE_RFC3339_EXTENDED) . ' |
';
+ echo '| lastModified | '.$index->getLastModified()->format(DATE_RFC3339_EXTENDED).' |
';
}
echo '
';
@@ -110,7 +111,7 @@ echo 'doc
';
echo 'docId
';
echo '';
-echo '| Lucene documentID | ' . $docInfo->getDocId() . ' |
';
+echo '| Lucene documentID | '.$docInfo->getDocId().' |
';
echo '
';
echo 'lucene
';
@@ -125,14 +126,14 @@ echo 'value | docFreq | termVector | ';
echo '';
foreach ($docInfo->getLucene() as $field) {
echo '';
- echo '| ' . $field->getName() . ' | ' . $field->getType() . ' | ' . $field->getSchema() . ' | ';
- echo '' . ($field->getSchema()->isIndexed() ? '⚐' : '') . ' | ' . ($field->getSchema()->isTokenized() ? '⚐' : '') . ' | ' . ($field->getSchema()->isStored() ? '⚐' : '') . ' | ' . ($field->getSchema()->isDocValues() ? '⚐' : '') . ' | ';
- echo '' . $field->getFlags() . ' | ';
- echo '' . ($field->getFlags()->isIndexed() ? '⚐' : '') . ' | ' . ($field->getFlags()->isOmitNorms() ? '⚐' : '') . ' | ' . ($field->getFlags()->isOmitTermFreqAndPositions() ? '⚐' : '') . ' | ';
- echo '' . $field->getValue() . ' | ' . $field->getDocFreq() . ' | ';
+ echo ' | '.$field->getName().' | '.$field->getType().' | '.$field->getSchema().' | ';
+ echo ''.($field->getSchema()->isIndexed() ? '⚐' : '').' | '.($field->getSchema()->isTokenized() ? '⚐' : '').' | '.($field->getSchema()->isStored() ? '⚐' : '').' | '.($field->getSchema()->isDocValues() ? '⚐' : '').' | ';
+ echo ''.$field->getFlags().' | ';
+ echo ''.($field->getFlags()->isIndexed() ? '⚐' : '').' | '.($field->getFlags()->isOmitNorms() ? '⚐' : '').' | '.($field->getFlags()->isOmitTermFreqAndPositions() ? '⚐' : '').' | ';
+ echo ''.$field->getValue().' | '.$field->getDocFreq().' | ';
if (null !== $termVector = $field->getTermVector()) {
foreach ($termVector as $term => $frequency) {
- echo $term . ': ' . $frequency . ' ';
+ echo $term.': '.$frequency.' ';
}
}
echo ' | ';
@@ -148,7 +149,7 @@ foreach ($docInfo->getSolr() as $field => $value) {
$value = implode(', ', $value);
}
- echo '
| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '';
@@ -159,10 +160,10 @@ echo 'info
';
echo '';
echo '| key | ';
foreach ($info->getKey() as $abbreviation => $flag) {
- echo $abbreviation . ': ' . $flag . ' ';
+ echo $abbreviation.': '.$flag.' ';
}
echo ' |
';
-echo '| NOTE | ' . $info->getNote() . ' |
';
+echo '| NOTE | '.$info->getNote().' |
';
echo '
';
htmlFooter();
diff --git a/docs/queries/luke-query/result-of-a-luke-query/field-details.md b/docs/queries/luke-query/result-of-a-luke-query/field-details.md
index a5fe3d706..07f82ae76 100644
--- a/docs/queries/luke-query/result-of-a-luke-query/field-details.md
+++ b/docs/queries/luke-query/result-of-a-luke-query/field-details.md
@@ -14,7 +14,8 @@ Example usage
```php
Note: Use with caution especially on large indexes!';
@@ -29,10 +30,10 @@ $lukeQuery = $client->createLuke();
$lukeQuery->setFields('text,cat,price_c');
// you can also get detailed information for all fields
-//$lukeQuery->setFields('*');
+// $lukeQuery->setFields('*');
// omitting index flags for each field can speed up Luke requests
-//$lukeQuery->setIncludeIndexFieldFlags(false);
+// $lukeQuery->setIncludeIndexFieldFlags(false);
// set the number of top terms for each field (Solr's default is 10)
$lukeQuery->setNumTerms(5);
@@ -46,30 +47,30 @@ $info = $result->getInfo();
echo 'index
';
echo '';
-echo '| numDocs | ' . $index->getNumDocs() . ' |
';
-echo '| maxDoc | ' . $index->getMaxDoc() . ' |
';
-echo '| deletedDocs | ' . $index->getDeletedDocs() . ' |
';
-echo '| indexHeapUsageBytes | ' . ($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)') . ' |
';
-echo '| version | ' . $index->getVersion() . ' |
';
-echo '| segmentCount | ' . $index->getSegmentCount() . ' |
';
-echo '| current | ' . ($index->getCurrent() ? 'true' : 'false') . ' |
';
-echo '| hasDeletions | ' . ($index->getHasDeletions() ? 'true' : 'false') . ' |
';
-echo '| directory | ' . $index->getDirectory() . ' |
';
-echo '| segmentsFile | ' . $index->getSegmentsFile() . ' |
';
-echo '| segmentsFileSizeInBytes | ' . $index->getSegmentsFileSizeInBytes() . ' |
';
+echo '| numDocs | '.$index->getNumDocs().' |
';
+echo '| maxDoc | '.$index->getMaxDoc().' |
';
+echo '| deletedDocs | '.$index->getDeletedDocs().' |
';
+echo '| indexHeapUsageBytes | '.($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)').' |
';
+echo '| version | '.$index->getVersion().' |
';
+echo '| segmentCount | '.$index->getSegmentCount().' |
';
+echo '| current | '.($index->getCurrent() ? 'true' : 'false').' |
';
+echo '| hasDeletions | '.($index->getHasDeletions() ? 'true' : 'false').' |
';
+echo '| directory | '.$index->getDirectory().' |
';
+echo '| segmentsFile | '.$index->getSegmentsFile().' |
';
+echo '| segmentsFileSizeInBytes | '.$index->getSegmentsFileSizeInBytes().' |
';
$userData = $index->getUserData();
echo '| userData | ';
if (null !== $userData->getCommitCommandVer()) {
- echo 'commitCommandVer: ' . $userData->getCommitCommandVer() . ' ';
+ echo 'commitCommandVer: '.$userData->getCommitCommandVer().' ';
}
if (null !== $userData->getCommitTimeMSec()) {
- echo 'commitTimeMSec: ' . $userData->getCommitTimeMSec() . ' ';
+ echo 'commitTimeMSec: '.$userData->getCommitTimeMSec().' ';
}
echo ' |
';
if (null !== $index->getLastModified()) {
- echo '| lastModified | ' . $index->getLastModified()->format(DATE_RFC3339_EXTENDED) . ' |
';
+ echo '| lastModified | '.$index->getLastModified()->format(DATE_RFC3339_EXTENDED).' |
';
}
echo '
';
@@ -78,17 +79,17 @@ echo '
';
echo 'fields
';
foreach ($fields as $field) {
- echo '' . $field . '
';
+ echo ''.$field.'
';
echo '';
- echo '| type | ' . $field->getType() . ' |
';
+ echo '| type | '.$field->getType().' |
';
echo '| schema | ';
foreach ($field->getSchema() as $flag) {
- echo $flag . ' ';
+ echo $flag.' ';
}
echo ' |
';
if (null !== $field->getDynamicBase()) {
- echo '| dynamicBase | ' . $field->getDynamicBase() . ' |
';
+ echo '| dynamicBase | '.$field->getDynamicBase().' |
';
}
// some fields don't have index flags in the result (with $lukeQuery->setIncludeIndexFieldFlags(false), none of the fields have)
if (null !== $field->getIndex()) {
@@ -96,7 +97,7 @@ foreach ($fields as $field) {
// some fields have '(unstored field)' in the result instead of flags
if (is_object($field->getIndex())) {
foreach ($field->getIndex() as $flag) {
- echo $flag . '
';
+ echo $flag.'
';
}
} else {
echo $field->getIndex();
@@ -104,22 +105,22 @@ foreach ($fields as $field) {
echo '';
}
if (null !== $field->getDocs()) {
- echo '| docs | ' . $field->getDocs() . ' |
';
+ echo '| docs | '.$field->getDocs().' |
';
}
if (null !== $field->getDistinct()) {
- echo '| distinct | ' . $field->getDistinct() . ' |
';
+ echo '| distinct | '.$field->getDistinct().' |
';
}
if (null !== $field->getTopTerms()) {
echo '| topTerms | ';
foreach ($field->getTopTerms() as $term => $frequency) {
- echo $term . ': ' . $frequency . ' ';
+ echo $term.': '.$frequency.' ';
}
echo ' |
';
}
if (null !== $field->getHistogram()) {
echo '| histogram | ';
foreach ($field->getHistogram() as $bucket => $frequency) {
- echo $bucket . ': ' . $frequency . ' ';
+ echo $bucket.': '.$frequency.' ';
}
echo ' |
';
}
@@ -133,10 +134,10 @@ echo 'info
';
echo '';
echo '| key | ';
foreach ($info->getKey() as $abbreviation => $flag) {
- echo $abbreviation . ': ' . $flag . ' ';
+ echo $abbreviation.': '.$flag.' ';
}
echo ' |
';
-echo '| NOTE | ' . $info->getNote() . ' |
';
+echo '| NOTE | '.$info->getNote().' |
';
echo '
';
htmlFooter();
diff --git a/docs/queries/luke-query/result-of-a-luke-query/index-details.md b/docs/queries/luke-query/result-of-a-luke-query/index-details.md
index cfb5833d8..f3cf7422c 100644
--- a/docs/queries/luke-query/result-of-a-luke-query/index-details.md
+++ b/docs/queries/luke-query/result-of-a-luke-query/index-details.md
@@ -14,7 +14,8 @@ Example usage
```php
getIndex();
echo 'index
';
echo '';
-echo '| numDocs | ' . $index->getNumDocs() . ' |
';
-echo '| maxDoc | ' . $index->getMaxDoc() . ' |
';
-echo '| deletedDocs | ' . $index->getDeletedDocs() . ' |
';
-echo '| indexHeapUsageBytes | ' . ($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)') . ' |
';
-echo '| version | ' . $index->getVersion() . ' |
';
-echo '| segmentCount | ' . $index->getSegmentCount() . ' |
';
-echo '| current | ' . ($index->getCurrent() ? 'true' : 'false') . ' |
';
-echo '| hasDeletions | ' . ($index->getHasDeletions() ? 'true' : 'false') . ' |
';
-echo '| directory | ' . $index->getDirectory() . ' |
';
-echo '| segmentsFile | ' . $index->getSegmentsFile() . ' |
';
-echo '| segmentsFileSizeInBytes | ' . $index->getSegmentsFileSizeInBytes() . ' |
';
+echo '| numDocs | '.$index->getNumDocs().' |
';
+echo '| maxDoc | '.$index->getMaxDoc().' |
';
+echo '| deletedDocs | '.$index->getDeletedDocs().' |
';
+echo '| indexHeapUsageBytes | '.($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)').' |
';
+echo '| version | '.$index->getVersion().' |
';
+echo '| segmentCount | '.$index->getSegmentCount().' |
';
+echo '| current | '.($index->getCurrent() ? 'true' : 'false').' |
';
+echo '| hasDeletions | '.($index->getHasDeletions() ? 'true' : 'false').' |
';
+echo '| directory | '.$index->getDirectory().' |
';
+echo '| segmentsFile | '.$index->getSegmentsFile().' |
';
+echo '| segmentsFileSizeInBytes | '.$index->getSegmentsFileSizeInBytes().' |
';
$userData = $index->getUserData();
echo '| userData | ';
if (null !== $userData->getCommitCommandVer()) {
- echo 'commitCommandVer: ' . $userData->getCommitCommandVer() . ' ';
+ echo 'commitCommandVer: '.$userData->getCommitCommandVer().' ';
}
if (null !== $userData->getCommitTimeMSec()) {
- echo 'commitTimeMSec: ' . $userData->getCommitTimeMSec() . ' ';
+ echo 'commitTimeMSec: '.$userData->getCommitTimeMSec().' ';
}
echo ' |
';
if (null !== $index->getLastModified()) {
- echo '| lastModified | ' . $index->getLastModified()->format(DATE_RFC3339_EXTENDED) . ' |
';
+ echo '| lastModified | '.$index->getLastModified()->format(DATE_RFC3339_EXTENDED).' |
';
}
echo '
';
diff --git a/docs/queries/luke-query/result-of-a-luke-query/info.md b/docs/queries/luke-query/result-of-a-luke-query/info.md
index 6a284a84e..24cd7d6c1 100644
--- a/docs/queries/luke-query/result-of-a-luke-query/info.md
+++ b/docs/queries/luke-query/result-of-a-luke-query/info.md
@@ -15,7 +15,8 @@ Example usage
```php
info';
echo '';
echo '| key | ';
foreach ($info->getKey() as $abbreviation => $flag) {
- echo $abbreviation . ': ' . $flag . ' ';
+ echo $abbreviation.': '.$flag.' ';
}
echo ' |
';
-echo '| NOTE | ' . $info->getNote() . ' |
';
+echo '| NOTE | '.$info->getNote().' |
';
echo '
';
htmlFooter();
diff --git a/docs/queries/luke-query/result-of-a-luke-query/schema.md b/docs/queries/luke-query/result-of-a-luke-query/schema.md
index 2e41c0ef9..a5bfd30bd 100644
--- a/docs/queries/luke-query/result-of-a-luke-query/schema.md
+++ b/docs/queries/luke-query/result-of-a-luke-query/schema.md
@@ -122,7 +122,8 @@ Example usage
use Solarium\Support\Utility;
-require_once(__DIR__.'/init.php');
+require_once __DIR__.'/init.php';
+
htmlHeader();
// create a client instance
@@ -141,30 +142,30 @@ $info = $result->getInfo();
echo 'index
';
echo '';
-echo '| numDocs | ' . $index->getNumDocs() . ' |
';
-echo '| maxDoc | ' . $index->getMaxDoc() . ' |
';
-echo '| deletedDocs | ' . $index->getDeletedDocs() . ' |
';
-echo '| indexHeapUsageBytes | ' . ($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)') . ' |
';
-echo '| version | ' . $index->getVersion() . ' |
';
-echo '| segmentCount | ' . $index->getSegmentCount() . ' |
';
-echo '| current | ' . ($index->getCurrent() ? 'true' : 'false') . ' |
';
-echo '| hasDeletions | ' . ($index->getHasDeletions() ? 'true' : 'false') . ' |
';
-echo '| directory | ' . $index->getDirectory() . ' |
';
-echo '| segmentsFile | ' . $index->getSegmentsFile() . ' |
';
-echo '| segmentsFileSizeInBytes | ' . $index->getSegmentsFileSizeInBytes() . ' |
';
+echo '| numDocs | '.$index->getNumDocs().' |
';
+echo '| maxDoc | '.$index->getMaxDoc().' |
';
+echo '| deletedDocs | '.$index->getDeletedDocs().' |
';
+echo '| indexHeapUsageBytes | '.($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)').' |
';
+echo '| version | '.$index->getVersion().' |
';
+echo '| segmentCount | '.$index->getSegmentCount().' |
';
+echo '| current | '.($index->getCurrent() ? 'true' : 'false').' |
';
+echo '| hasDeletions | '.($index->getHasDeletions() ? 'true' : 'false').' |
';
+echo '| directory | '.$index->getDirectory().' |
';
+echo '| segmentsFile | '.$index->getSegmentsFile().' |
';
+echo '| segmentsFileSizeInBytes | '.$index->getSegmentsFileSizeInBytes().' |
';
$userData = $index->getUserData();
echo '| userData | ';
if (null !== $userData->getCommitCommandVer()) {
- echo 'commitCommandVer: ' . $userData->getCommitCommandVer() . ' ';
+ echo 'commitCommandVer: '.$userData->getCommitCommandVer().' ';
}
if (null !== $userData->getCommitTimeMSec()) {
- echo 'commitTimeMSec: ' . $userData->getCommitTimeMSec() . ' ';
+ echo 'commitTimeMSec: '.$userData->getCommitTimeMSec().' ';
}
echo ' |
';
if (null !== $index->getLastModified()) {
- echo '| lastModified | ' . $index->getLastModified()->format(DATE_RFC3339_EXTENDED) . ' |
';
+ echo '| lastModified | '.$index->getLastModified()->format(DATE_RFC3339_EXTENDED).' |
';
}
echo '
';
@@ -183,10 +184,10 @@ echo 'copyDests | copySources | ';
echo '';
foreach ($schema->getFields() as $field) {
echo '';
- echo '| ' . $field->getName() . ' | ' . $field->getType() . ' | ' . $field->getFlags() . ' | ';
- echo '' . ($field->getFlags()->isIndexed() ? '⚐' : '') . ' | ' . ($field->getFlags()->isTokenized() ? '⚐' : '') . ' | ' . ($field->getFlags()->isStored() ? '⚐' : '') . ' | ' . ($field->getFlags()->isDocValues() ? '⚐' : '') . ' | ';
- echo '' . ($field->isRequired() ? '✓' : '') . ' | ' . $field->getDefault() . ' | ' . ($field->isUniqueKey() ? '✓' : '') . ' | ' . $field->getPositionIncrementGap() . ' | ';
- echo '' . implode(', ', $field->getCopyDests()) . ' | ' . implode(', ', $field->getCopySources()) . ' | ';
+ echo ''.$field->getName().' | '.$field->getType().' | '.$field->getFlags().' | ';
+ echo ''.($field->getFlags()->isIndexed() ? '⚐' : '').' | '.($field->getFlags()->isTokenized() ? '⚐' : '').' | '.($field->getFlags()->isStored() ? '⚐' : '').' | '.($field->getFlags()->isDocValues() ? '⚐' : '').' | ';
+ echo ''.($field->isRequired() ? '✓' : '').' | '.$field->getDefault().' | '.($field->isUniqueKey() ? '✓' : '').' | '.$field->getPositionIncrementGap().' | ';
+ echo ''.implode(', ', $field->getCopyDests()).' | '.implode(', ', $field->getCopySources()).' | ';
echo '
';
}
echo '
';
@@ -202,10 +203,10 @@ echo 'copyDests | copySources | ';
echo '';
foreach ($schema->getDynamicFields() as $field) {
echo '';
- echo '| ' . $field->getName() . ' | ' . $field->getType() . ' | ' . $field->getFlags() . ' | ';
- echo '' . ($field->getFlags()->isMultiValued() ? '⚐' : '') . ' | ' . ($field->getFlags()->isOmitNorms() ? '⚐' : '') . ' | ' . ($field->getFlags()->isSortMissingFirst() ? '⚐' : '') . ' | ' . ($field->getFlags()->isSortMissingLast() ? '⚐' : '') . ' | ';
- echo '' . $field->getPositionIncrementGap() . ' | ';
- echo '' . implode(', ', $field->getCopyDests()) . ' | ' . implode(', ', $field->getCopySources()) . ' | ';
+ echo ''.$field->getName().' | '.$field->getType().' | '.$field->getFlags().' | ';
+ echo ''.($field->getFlags()->isMultiValued() ? '⚐' : '').' | '.($field->getFlags()->isOmitNorms() ? '⚐' : '').' | '.($field->getFlags()->isSortMissingFirst() ? '⚐' : '').' | '.($field->getFlags()->isSortMissingLast() ? '⚐' : '').' | ';
+ echo ''.$field->getPositionIncrementGap().' | ';
+ echo ''.implode(', ', $field->getCopyDests()).' | '.implode(', ', $field->getCopySources()).' | ';
echo '
';
}
echo '';
@@ -223,8 +224,8 @@ echo 'similarity
';
$similarity = $schema->getSimilarity();
echo '';
-echo '| className | ' . $similarity->getClassName() . ' |
';
-echo '| details | ' . $similarity->getDetails() . ' |
';
+echo '| className | '.$similarity->getClassName().' |
';
+echo '| details | '.$similarity->getDetails().' |
';
echo '
';
echo 'types
';
@@ -236,8 +237,8 @@ echo 'indexAnalyzer | queryAnalyzer | similarity | ';
echo '';
foreach ($schema->getTypes() as $type) {
echo '';
- echo '| ' . $type->getName() . ' | ' . implode(', ', $type->getFields()) . ' | ' . ($type->isTokenized() ? '✓' : '') . ' | ' . Utility::compactSolrClassName($type->getClassName()) . ' | ';
- echo '' . Utility::compactSolrClassName($type->getIndexAnalyzer()) . ' | ' . Utility::compactSolrClassName($type->getQueryAnalyzer()) . ' | ' . Utility::compactSolrClassName($type->getSimilarity()) . ' | ';
+ echo ''.$type->getName().' | '.implode(', ', $type->getFields()).' | '.($type->isTokenized() ? '✓' : '').' | '.Utility::compactSolrClassName($type->getClassName()).' | ';
+ echo ''.Utility::compactSolrClassName($type->getIndexAnalyzer()).' | '.Utility::compactSolrClassName($type->getQueryAnalyzer()).' | '.Utility::compactSolrClassName($type->getSimilarity()).' | ';
echo '
';
}
echo '';
@@ -249,10 +250,10 @@ echo 'info
';
echo '';
echo '| key | ';
foreach ($info->getKey() as $abbreviation => $flag) {
- echo $abbreviation . ': ' . $flag . ' ';
+ echo $abbreviation.': '.$flag.' ';
}
echo ' |
';
-echo '| NOTE | ' . $info->getNote() . ' |
';
+echo '| NOTE | '.$info->getNote().' |
';
echo '
';
htmlFooter();
diff --git a/docs/queries/managedresources-query/managed-resources.md b/docs/queries/managedresources-query/managed-resources.md
index 43b1a82b1..fc0445e8e 100644
--- a/docs/queries/managedresources-query/managed-resources.md
+++ b/docs/queries/managedresources-query/managed-resources.md
@@ -10,7 +10,8 @@ Example
```php
execute($managedResourcesQuery);
// display resources
foreach ($result as $resource) {
echo '';
- echo '| Resource ID | ' . $resource->getResourceId() . ' |
';
- echo '| Number of Observers | ' . $resource->getNumObservers() . ' |
';
- echo '| Class | ' . $resource->getClass() . ' |
';
+ echo '| Resource ID | '.$resource->getResourceId().' |
';
+ echo '| Number of Observers | '.$resource->getNumObservers().' |
';
+ echo '| Class | '.$resource->getClass().' |
';
echo '
';
}
diff --git a/docs/queries/managedresources-query/managed-stopwords.md b/docs/queries/managedresources-query/managed-stopwords.md
index 29fe63cd0..263c018ca 100644
--- a/docs/queries/managedresources-query/managed-stopwords.md
+++ b/docs/queries/managedresources-query/managed-stopwords.md
@@ -15,7 +15,8 @@ Examples
```php
setName('english');
$result = $client->execute($query);
// display list properties
-echo 'Case sensitive: ' . ($result->isIgnoreCase() ? 'no' : 'yes') . '
';
-echo 'Initialized on: ' . $result->getInitializedOn() . '
';
-echo 'Updated since init: ' . $result->getUpdatedSinceInit() . '
';
+echo 'Case sensitive: '.($result->isIgnoreCase() ? 'no' : 'yes').'
';
+echo 'Initialized on: '.$result->getInitializedOn().'
';
+echo 'Updated since init: '.$result->getUpdatedSinceInit().'
';
// display stopwords
-echo 'Number of stopwords: ' . count($result) . '
';
+echo 'Number of stopwords: '.count($result).'
';
echo 'Stopwords:
';
echo implode(', ', $result->getItems());
echo '
';
@@ -62,7 +63,7 @@ foreach (['english', 'dutch'] as $name) {
$result = $client->execute($query);
// display the result
- echo '' . $name . ': ' . ($result->getWasSuccessful() ? 'exists' : 'doesn\'t exist') . '
';
+ echo ''.$name.': '.($result->getWasSuccessful() ? 'exists' : 'doesn\'t exist').'
';
}
echo 'Create list
';
@@ -171,7 +172,7 @@ foreach (['stopwordb', 'stopwordc'] as $term) {
$result = $client->execute($query);
// display the result
- echo '' . $term . ': ' . ($result->getWasSuccessful() ? 'exists' : 'doesn\'t exist') . '
';
+ echo ''.$term.': '.($result->getWasSuccessful() ? 'exists' : 'doesn\'t exist').'
';
}
echo 'Add stopwords
';
diff --git a/docs/queries/managedresources-query/managed-synonyms.md b/docs/queries/managedresources-query/managed-synonyms.md
index 19217a88a..79c9d35d4 100644
--- a/docs/queries/managedresources-query/managed-synonyms.md
+++ b/docs/queries/managedresources-query/managed-synonyms.md
@@ -17,7 +17,8 @@ Examples
use Solarium\QueryType\ManagedResources\Query\Synonyms\Synonyms;
-require_once(__DIR__.'/init.php');
+require_once __DIR__.'/init.php';
+
htmlHeader();
// create a client instance
@@ -37,18 +38,18 @@ $query->setName('english');
$result = $client->execute($query);
// display list properties
-echo 'Case sensitive: ' . ($result->isIgnoreCase() ? 'no' : 'yes') . '
';
-echo 'Format: ' . $result->getFormat() . '
';
-echo 'Initialized on: ' . $result->getInitializedOn() . '
';
-echo 'Updated since init: ' . $result->getUpdatedSinceInit() . '
';
+echo 'Case sensitive: '.($result->isIgnoreCase() ? 'no' : 'yes').'
';
+echo 'Format: '.$result->getFormat().'
';
+echo 'Initialized on: '.$result->getInitializedOn().'
';
+echo 'Updated since init: '.$result->getUpdatedSinceInit().'
';
// display synonyms
-echo 'Number of synonym mappings: ' . count($result) . '
';
+echo 'Number of synonym mappings: '.count($result).'
';
echo 'Synonym mappings:
';
echo '';
foreach ($result as $synonym) {
- echo '| ' . $synonym->getTerm() . ' | ' . implode(', ', $synonym->getSynonyms()) . ' |
';
+ echo '| '.$synonym->getTerm().' | '.implode(', ', $synonym->getSynonyms()).' |
';
}
echo '
';
@@ -70,7 +71,7 @@ foreach (['english', 'dutch'] as $name) {
$result = $client->execute($query);
// display the result
- echo '' . $name . ': ' . ($result->getWasSuccessful() ? 'exists' : 'doesn\'t exist') . '
';
+ echo ''.$name.': '.($result->getWasSuccessful() ? 'exists' : 'doesn\'t exist').'
';
}
echo 'Create list
';
@@ -157,7 +158,7 @@ $result = $client->execute($query);
// display synonym, there will be only one
foreach ($result as $synonym) {
- echo '' . $synonym->getTerm() . ': ' . implode(', ', $synonym->getSynonyms());
+ echo ''.$synonym->getTerm().': '.implode(', ', $synonym->getSynonyms()).'
';
}
echo 'Check synonym mapping existence
';
@@ -180,7 +181,7 @@ foreach (['tv', 'radio'] as $term) {
$result = $client->execute($query);
// display the result
- echo '' . $term . ': ' . ($result->getWasSuccessful() ? 'exists' : 'doesn\'t exist') . '
';
+ echo ''.$term.': '.($result->getWasSuccessful() ? 'exists' : 'doesn\'t exist').'
';
}
echo 'Add single synonym mapping
';
diff --git a/docs/queries/morelikethis-query.md b/docs/queries/morelikethis-query.md
index 051148e54..2b5d9f788 100644
--- a/docs/queries/morelikethis-query.md
+++ b/docs/queries/morelikethis-query.md
@@ -18,7 +18,7 @@ See the example code below.
| start | int | 0 | Start position (offset) in the complete Solr query resultset, to paginate big resultsets. |
| rows | int | 10 | Number of rows to fetch, starting from the 'start' (offset) position. It's a limit, you might get less. |
| fields | string | \*,score | Comma separated list of fields to fetch from Solr. There are two special values: '\*' meaning 'all fields' and 'score' to also fetch the Solr document score value. |
-| sort | array | empty array | Array with sort field as key and sort order as values. Multiple entries possible, they are used in the order of the array. Example: array('price' => 'asc') |
+| sort | array | [] | Array with sort field as key and sort order as values. Multiple entries possible, they are used in the order of the array. Example: ['price' => 'asc'] |
| stream | boolean | false | Set to true to post query content instead of using the URL param |
| matchinclude | boolean | false | Specifies whether or not the response should include the matched document. If set to false, the response will look like a normal select response. |
| matchoffset | int | 0 | Specifies an offset into the main query search results to locate the document on which the MoreLikeThis query should operate. |
@@ -77,7 +77,7 @@ The examples below assume an MLT handler is set up at `/mlt`. Solr's example con
```php
getMatch() as $field => $value) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
@@ -151,7 +152,6 @@ echo 'Listing of matched docs:';
// show MLT documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -161,7 +161,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
@@ -186,7 +186,8 @@ This example assumes the `/mlt` handler is already set up ([see above](#setting-
```php
Listing of matched docs:';
// show MLT documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -238,7 +238,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/docs/queries/ping-query.md b/docs/queries/ping-query.md
index 946b7133e..01b734671 100644
--- a/docs/queries/ping-query.md
+++ b/docs/queries/ping-query.md
@@ -35,11 +35,12 @@ Example
```php
ping($ping);
echo 'Ping query successful
';
- echo 'Ping status: ' . $result->getPingStatus() . '
';
- echo 'Query time: ' . $result->getQueryTime() . ' ms
';
+ echo 'Ping status: '.$result->getPingStatus().'
';
+ echo 'Query time: '.$result->getQueryTime().' ms
';
// only relevant for distributed requests
if (null !== $zkConnected = $result->getZkConnected()) {
- echo 'ZooKeeper connected: ' . ($zkConnected ? 'yes' : 'no');
+ echo 'ZooKeeper connected: '.($zkConnected ? 'yes' : 'no');
}
} catch (Exception $e) {
echo 'Ping query failed';
diff --git a/docs/queries/query-helper/escaping.md b/docs/queries/query-helper/escaping.md
index ca9938f87..e341586fc 100644
--- a/docs/queries/query-helper/escaping.md
+++ b/docs/queries/query-helper/escaping.md
@@ -5,7 +5,8 @@ An example of term escaping in use for a query that would fail without escaping:
```php
getHelper();
-$query->setQuery('features:' . $helper->escapePhrase($input));
+$query->setQuery('features:'.$helper->escapePhrase($input));
// this executes the query and returns the result
$resultset = $client->select($query);
@@ -30,7 +31,6 @@ echo 'NumFound: '.$resultset->getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -40,7 +40,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/docs/queries/query-helper/function-builder.md b/docs/queries/query-helper/function-builder.md
index 4e5d6fbc4..4bec5e42b 100644
--- a/docs/queries/query-helper/function-builder.md
+++ b/docs/queries/query-helper/function-builder.md
@@ -39,5 +39,6 @@ $analytics
// which would be equal to
$analytics
->addFunction('sale()', 'div(sum(a,fill_missing(b,0)),add(10.5,count(mult(a,c))))')
-;
-```
\ No newline at end of file
+;
+
+```
diff --git a/docs/queries/query-helper/placeholders.md b/docs/queries/query-helper/placeholders.md
index d647543f6..ec05fac3a 100644
--- a/docs/queries/query-helper/placeholders.md
+++ b/docs/queries/query-helper/placeholders.md
@@ -35,7 +35,8 @@ Example
```php
setQuery('features: %p1% AND inStock:%2%', array($input, 1));
+$query->setQuery('features: %p1% AND inStock:%2%', [$input, 1]);
// show the result after replacing the placeholders with values
-echo $query->getQuery() . '
';
+echo $query->getQuery().'
';
// this executes the query and returns the result
$resultset = $client->select($query);
@@ -62,7 +63,6 @@ echo 'NumFound: '.$resultset->getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -72,7 +72,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/docs/queries/query-helper/query-helper.md b/docs/queries/query-helper/query-helper.md
index 7f12d7f12..b2fab9724 100644
--- a/docs/queries/query-helper/query-helper.md
+++ b/docs/queries/query-helper/query-helper.md
@@ -8,11 +8,10 @@ Helper methods for general use
------------------------------
- rangeQuery($field, $from, $to, $inclusive = true)
-- qparser($name, $params = array())
-- functionCall($name, $params = array())
+- qparser($name, $params = [])
+- functionCall($name, $params = [])
- join($from, $to, $dereferenced = false)
- formatDate($input)
-- cacheControl($useCache, $cost)
- qparserTerm($field, $weight)
See the API docs (linked at the bottom of this page) for more details.
@@ -35,7 +34,8 @@ Example
```php
getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -69,7 +68,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/docs/queries/realtimeget-query.md b/docs/queries/realtimeget-query.md
index e7b6de48b..2a5d214c4 100644
--- a/docs/queries/realtimeget-query.md
+++ b/docs/queries/realtimeget-query.md
@@ -32,7 +32,8 @@ Example
```php
update($update);
// try to get the document using a normal select, this should return 0 results
$query = $client->createSelect();
-$query->setQuery('id:%1%', array($id));
+$query->setQuery('id:%1%', [$id]);
$resultset = $client->select($query);
echo 'NumFound with standard select: '.$resultset->getNumFound().'
';
@@ -66,11 +67,10 @@ echo 'NumFound with realtime get: '.$result->getNumFound().'
';
// Display the document
echo '
';
foreach ($result->getDocument() as $field => $value) {
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
-
htmlFooter();
```
diff --git a/docs/queries/select-query/building-a-select-query/adding-filterqueries.md b/docs/queries/select-query/building-a-select-query/adding-filterqueries.md
index 9a00ce54a..527b26f1f 100644
--- a/docs/queries/select-query/building-a-select-query/adding-filterqueries.md
+++ b/docs/queries/select-query/building-a-select-query/adding-filterqueries.md
@@ -8,7 +8,7 @@ The options below can be set as query option values, but also by using the set/g
| Name | Type | Default value | Description |
|-------|----------------|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
| key | string | null | This value is used as the key for the filterquery in the select query object. Kind of a unique-id for filterqueries. |
-| tag | string / array | empty array | Tags for excluding filterqueries in facets. A single filterquery may have multiple tags and a single tag may be used for multiple filterqueries. |
+| tag | string / array | [] | Tags for excluding filterqueries in facets. A single filterquery may have multiple tags and a single tag may be used for multiple filterqueries. |
| query | string | null | The query to use as filter on the set of documents. |
||
@@ -18,7 +18,8 @@ Examples
```php
getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/docs/queries/select-query/building-a-select-query/building-a-select-query.md b/docs/queries/select-query/building-a-select-query/building-a-select-query.md
index 42cae699a..ee9ea9137 100644
--- a/docs/queries/select-query/building-a-select-query/building-a-select-query.md
+++ b/docs/queries/select-query/building-a-select-query/building-a-select-query.md
@@ -16,7 +16,7 @@ The options below can be set as query option values, but also by using the set/g
| cancancel | bool | null | Is this a cancellable query? |
| queryuuid | string | null | Custom UUID to identify a cancellable query with |
| fields | string | \*,score | Comma separated list of fields to fetch from Solr. There are two special values: '\*' meaning 'all fields' and 'score' to also fetch the Solr document score value. |
-| sort | array | empty array | Array with sort field as key and sort order as values. Multiple entries possible, they are used in the order of the array. Example: array('price' => 'asc') |
+| sort | array | [] | Array with sort field as key and sort order as values. Multiple entries possible, they are used in the order of the array. Example: ['price' => 'asc'] |
| querydefaultoperator | string | null | With a null value the default of your Solr config will be used. If you want to override this supply 'AND' or 'OR' as the value. |
| querydefaultfield | string | null | With a null value the default of your Solr config will be used. If you want to override this supply a field name as the value. |
| responsewriter | string | json | You can set this to 'phps' for improved response parsing performance, at the cost of a (possible) security risk. Only use 'phps' for trusted Solr instances. |
@@ -39,7 +39,7 @@ A simple select with some params, using the API mode:
```php
setQuery('price:[12 TO *]');
$query->setStart(2)->setRows(20);
// set fields to fetch (this overrides the default setting 'all fields')
-$query->setFields(array('id','name','price', 'score'));
+$query->setFields(['id', 'name', 'price', 'score']);
// sort the results by price ascending
$query->addSort('price', $query::SORT_ASC);
@@ -72,7 +72,6 @@ echo '
MaxScore: '.$resultset->getMaxScore();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -82,7 +81,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
@@ -97,31 +96,32 @@ An example using the select query in config mode: (filterqueries and components
```php
'*:*',
- 'start' => 2,
- 'rows' => 20,
- 'fields' => array('id','name','price'),
- 'sort' => array('price' => 'asc'),
- 'filterquery' => array(
- 'maxprice' => array(
- 'query' => 'price:[1 TO 300]'
- ),
- ),
- 'component' => array(
- 'facetset' => array(
- 'facet' => array(
+$select = [
+ 'query' => '*:*',
+ 'start' => 2,
+ 'rows' => 20,
+ 'fields' => ['id', 'name', 'price'],
+ 'sort' => ['price' => 'asc'],
+ 'filterquery' => [
+ 'maxprice' => [
+ 'query' => 'price:[1 TO 300]',
+ ],
+ ],
+ 'component' => [
+ 'facetset' => [
+ 'facet' => [
// notice this config uses an inline key value under 'local_key', instead of array key like the filterquery
- array('type' => 'field', 'local_key' => 'stock', 'field' => 'inStock'),
- )
- ),
- ),
-);
+ ['type' => 'field', 'local_key' => 'stock', 'field' => 'inStock'],
+ ],
+ ],
+ ],
+];
// create a client instance
$client = new Solarium\Client($adapter, $eventDispatcher, $config);
@@ -139,16 +139,15 @@ echo 'NumFound: '.$resultset->getNumFound();
echo '
Facet counts for field "inStock":
';
$facet = $resultset->getFacetSet()->getFacet('stock');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/docs/queries/select-query/building-a-select-query/components/analytics-component.md b/docs/queries/select-query/building-a-select-query/components/analytics-component.md
index 858b69468..e7a3dcc20 100644
--- a/docs/queries/select-query/building-a-select-query/components/analytics-component.md
+++ b/docs/queries/select-query/building-a-select-query/components/analytics-component.md
@@ -5,9 +5,9 @@ Options
| Name | Type | Default value | Description |
|-------------|---------|---------------|-------------------------------------------------------------------------------|
-| functions | array | [ ] | One or more Variable Functions to be used throughout the rest of the request. |
-| expressions | array | [ ] | A list of calculations to perform over the entire result set. |
-| groupings | array | [ ] | The list of Groupings to calculate in addition to the expressions. |
+| functions | array | [] | One or more Variable Functions to be used throughout the rest of the request. |
+| expressions | array | [] | A list of calculations to perform over the entire result set. |
+| groupings | array | [] | The list of Groupings to calculate in addition to the expressions. |
||
Example
@@ -16,7 +16,8 @@ Example
```php
getDebug();
// display the debug results
echo 'Debug data
';
-echo 'Querystring: ' . $debugResult->getQueryString() . '
';
-echo 'Parsed query: ' . $debugResult->getParsedQuery() . '
';
-echo 'Query parser: ' . $debugResult->getQueryParser() . '
';
-echo 'Other query: ' . $debugResult->getOtherQuery() . '
';
+echo 'Querystring: '.$debugResult->getQueryString().'
';
+echo 'Parsed query: '.$debugResult->getParsedQuery().'
';
+echo 'Query parser: '.$debugResult->getQueryParser().'
';
+echo 'Other query: '.$debugResult->getOtherQuery().'
';
echo 'Explain data
';
foreach ($debugResult->getExplain() as $key => $explanation) {
- echo 'Document key: ' . $key . '
';
- echo 'Value: ' . $explanation->getValue() . '
';
- echo 'Match: ' . (($explanation->getMatch() == true) ? 'true' : 'false') . '
';
- echo 'Description: ' . $explanation->getDescription() . '
';
+ echo 'Document key: '.$key.'
';
+ echo 'Value: '.$explanation->getValue().'
';
+ echo 'Match: '.($explanation->getMatch() ? 'true' : 'false').'
';
+ echo 'Description: '.$explanation->getDescription().'
';
echo 'Details
';
foreach ($explanation as $detail) {
- echo 'Value: ' . $detail->getValue() . '
';
- echo 'Match: ' . (($detail->getMatch() == true) ? 'true' : 'false') . '
';
- echo 'Description: ' . $detail->getDescription() . '
';
+ echo 'Value: '.$detail->getValue().'
';
+ echo 'Match: '.($detail->getMatch() ? 'true' : 'false').'
';
+ echo 'Description: '.$detail->getDescription().'
';
echo '
';
}
}
echo 'ExplainOther data
';
foreach ($debugResult->getExplainOther() as $key => $explanation) {
- echo 'Document key: ' . $key . '
';
- echo 'Value: ' . $explanation->getValue() . '
';
- echo 'Match: ' . (($explanation->getMatch() == true) ? 'true' : 'false') . '
';
- echo 'Description: ' . $explanation->getDescription() . '
';
+ echo 'Document key: '.$key.'
';
+ echo 'Value: '.$explanation->getValue().'
';
+ echo 'Match: '.($explanation->getMatch() ? 'true' : 'false').'
';
+ echo 'Description: '.$explanation->getDescription().'
';
echo 'Details
';
foreach ($explanation as $detail) {
- echo 'Value: ' . $detail->getValue() . '
';
- echo 'Match: ' . (($detail->getMatch() == true) ? 'true' : 'false') . '
';
- echo 'Description: ' . $detail->getDescription() . '
';
+ echo 'Value: '.$detail->getValue().'
';
+ echo 'Match: '.($detail->getMatch() ? 'true' : 'false').'
';
+ echo 'Description: '.$detail->getDescription().'
';
echo '
';
}
}
echo 'Timings (in ms)
';
-echo 'Total time: ' . $debugResult->getTiming()->getTime() . '
';
+echo 'Total time: '.$debugResult->getTiming()->getTime().'
';
echo 'Phases
';
foreach ($debugResult->getTiming()->getPhases() as $phaseName => $phaseData) {
- echo '' . $phaseName . '
';
+ echo ''.$phaseName.'
';
foreach ($phaseData as $class => $time) {
- echo $class . ': ' . $time . '
';
+ echo $class.': '.$time.'
';
}
echo '
';
}
diff --git a/docs/queries/select-query/building-a-select-query/components/dismax-component.md b/docs/queries/select-query/building-a-select-query/components/dismax-component.md
index 620df4cd2..f92c0269a 100644
--- a/docs/queries/select-query/building-a-select-query/components/dismax-component.md
+++ b/docs/queries/select-query/building-a-select-query/components/dismax-component.md
@@ -29,7 +29,8 @@ Example
```php
getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -63,7 +63,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/docs/queries/select-query/building-a-select-query/components/distributed-search-component.md b/docs/queries/select-query/building-a-select-query/components/distributed-search-component.md
index 89c14c9c3..4e69417a9 100644
--- a/docs/queries/select-query/building-a-select-query/components/distributed-search-component.md
+++ b/docs/queries/select-query/building-a-select-query/components/distributed-search-component.md
@@ -17,7 +17,8 @@ Example
```php
getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -50,7 +50,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/docs/queries/select-query/building-a-select-query/components/edismax-component.md b/docs/queries/select-query/building-a-select-query/components/edismax-component.md
index ebfe32d51..7129fe6ab 100644
--- a/docs/queries/select-query/building-a-select-query/components/edismax-component.md
+++ b/docs/queries/select-query/building-a-select-query/components/edismax-component.md
@@ -28,7 +28,8 @@ Example
```php
getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -61,7 +61,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-field.md b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-field.md
index baefe24d2..03b224683 100644
--- a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-field.md
+++ b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-field.md
@@ -19,7 +19,8 @@ Example
```php
getNumFound();
echo '
Facet counts for field "inStock":
';
$facet = $resultset->getFacetSet()->getFacet('stock');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-multiquery.md b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-multiquery.md
index ccf7be39d..75cbb86c4 100644
--- a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-multiquery.md
+++ b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-multiquery.md
@@ -12,7 +12,8 @@ Example
```php
getNumFound();
echo '
Multiquery facet counts:
';
$facet = $resultset->getFacetSet()->getFacet('stock');
foreach ($facet as $key => $count) {
- echo $key . ' [' . $count . ']
';
+ echo $key.' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-pivot.md b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-pivot.md
index ed7ca8e39..c0fe54e6e 100644
--- a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-pivot.md
+++ b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-pivot.md
@@ -22,7 +22,8 @@ Example
```php
getFacetSet();
// create two facet pivot instances
$facet = $facetSet->createFacetPivot('cat-popularity-instock');
$facet->addFields('cat,popularity,inStock');
-$facet->setMinCount(0);
+$facet->setPivotMinCount(0);
$facet = $facetSet->createFacetPivot('popularity-cat');
$facet->addFields('popularity,cat');
@@ -63,9 +64,8 @@ foreach ($facetResult as $pivot) {
htmlFooter();
-
/**
- * Recursively render pivot facets
+ * Recursively render pivot facets.
*
* @param $pivot
*/
diff --git a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-query.md b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-query.md
index 005331cdc..3d01f3b1f 100644
--- a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-query.md
+++ b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-query.md
@@ -18,7 +18,8 @@ Example
```php
getNumFound();
// display facet query count
$count = $resultset->getFacetSet()->getFacet('stock')->getValue();
-echo '
Facet query count : ' . $count;
+echo '
Facet query count : '.$count;
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-range.md b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-range.md
index c8d988a14..f013bfcfb 100644
--- a/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-range.md
+++ b/docs/queries/select-query/building-a-select-query/components/facetset-component/facet-range.md
@@ -26,7 +26,8 @@ Examples
```php
getNumFound();
echo '
Facet ranges:
';
$facet = $resultset->getFacetSet()->getFacet('priceranges');
foreach ($facet as $range => $count) {
- echo $range . ' to ' . ($range + 100) . ' [' . $count . ']
';
+ echo $range.' to '.($range + 100).' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
@@ -76,7 +76,8 @@ or when specifying pivot fields:
```php
getFacetSet()->getFacet('manufacturedate_dt');
foreach ($facets as $facet) {
foreach ($facet->getRanges() as $range) {
foreach ($range->getValues() as $date => $count) {
- echo $date . ' [' . $count . ']
';
+ echo $date.' ['.$count.']
';
}
}
}
diff --git a/docs/queries/select-query/building-a-select-query/components/grouping-component.md b/docs/queries/select-query/building-a-select-query/components/grouping-component.md
index e2d8a2131..211441a47 100644
--- a/docs/queries/select-query/building-a-select-query/components/grouping-component.md
+++ b/docs/queries/select-query/building-a-select-query/components/grouping-component.md
@@ -29,7 +29,8 @@ Grouping by field:
```php
select($query);
$groups = $resultset->getGrouping();
foreach ($groups as $groupKey => $fieldGroup) {
-
echo ''.$groupKey.'
';
echo 'Matches: '.$fieldGroup->getMatches().'
';
echo 'Number of groups: '.$fieldGroup->getNumberOfGroups();
foreach ($fieldGroup as $valueGroup) {
-
echo ''.(int)$valueGroup->getValue().'
';
foreach ($valueGroup as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -72,7 +70,7 @@ foreach ($groups as $groupKey => $fieldGroup) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
@@ -89,7 +87,8 @@ Grouping by query:
```php
select($query);
$groups = $resultset->getGrouping();
foreach ($groups as $groupKey => $group) {
-
echo ''.$groupKey.'
';
foreach ($group as $document) {
@@ -125,7 +123,7 @@ foreach ($groups as $groupKey => $group) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '';
diff --git a/docs/queries/select-query/building-a-select-query/components/highlighting-component.md b/docs/queries/select-query/building-a-select-query/components/highlighting-component.md
index 70146480f..8a2f1d978 100644
--- a/docs/queries/select-query/building-a-select-query/components/highlighting-component.md
+++ b/docs/queries/select-query/building-a-select-query/components/highlighting-component.md
@@ -95,7 +95,8 @@ Example
```php
getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -129,7 +129,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
Highlighting results:
';
@@ -138,10 +138,9 @@ foreach ($resultset as $document) {
$highlightedDoc = $highlighting->getResult($document->id);
if ($highlightedDoc) {
foreach ($highlightedDoc as $field => $highlight) {
- echo implode(' (...) ', $highlight) . '
';
+ echo implode(' (...) ', $highlight).'
';
}
}
-
}
htmlFooter();
@@ -153,7 +152,8 @@ Per-field settings:
```php
getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -189,7 +188,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
Highlighting results:
';
@@ -198,10 +197,9 @@ foreach ($resultset as $document) {
$highlightedDoc = $highlighting->getResult($document->id);
if ($highlightedDoc) {
foreach ($highlightedDoc as $field => $highlight) {
- echo implode(' (...) ', $highlight) . '
';
+ echo implode(' (...) ', $highlight).'
';
}
}
-
}
htmlFooter();
diff --git a/docs/queries/select-query/building-a-select-query/components/morelikethis-component.md b/docs/queries/select-query/building-a-select-query/components/morelikethis-component.md
index 159859df6..b98949f3f 100644
--- a/docs/queries/select-query/building-a-select-query/components/morelikethis-component.md
+++ b/docs/queries/select-query/building-a-select-query/components/morelikethis-component.md
@@ -26,7 +26,8 @@ Example
```php
getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -62,7 +62,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
MLT results:
';
@@ -74,7 +74,7 @@ foreach ($resultset as $document) {
echo 'NumFound: '.$mltResult->getNumFound().'
';
echo 'Num. fetched: '.count($mltResult).'
';
foreach ($mltResult as $mltDoc) {
- echo 'MLT result doc: '. $mltDoc->name . ' (id='. $mltDoc->id . ')
';
+ echo 'MLT result doc: '.$mltDoc->name.' (id='.$mltDoc->id.')
';
}
// available since Solr 8.2 if the query wasn't distributed
if (null !== $interestingTerms = $mlt->getInterestingTerm($document->id)) {
@@ -83,7 +83,6 @@ foreach ($resultset as $document) {
} else {
echo 'No MLT results';
}
-
}
htmlFooter();
diff --git a/docs/queries/select-query/building-a-select-query/components/query-elevation-component.md b/docs/queries/select-query/building-a-select-query/components/query-elevation-component.md
index 80a14771d..a942ca804 100644
--- a/docs/queries/select-query/building-a-select-query/components/query-elevation-component.md
+++ b/docs/queries/select-query/building-a-select-query/components/query-elevation-component.md
@@ -22,7 +22,8 @@ Example
```php
getQueryElevation();
$elevate->setForceElevation(true);
// specify documents to elevate and/or exclude if you don't use an elevation file or want to override it at request time
-$elevate->setElevateIds(array('VS1GB400C3', 'VDBDB1A16'));
-$elevate->setExcludeIds(array('SP2514N', '6H500F0'));
+$elevate->setElevateIds(['VS1GB400C3', 'VDBDB1A16']);
+$elevate->setExcludeIds(['SP2514N', '6H500F0']);
// document transformers can be omitted from the results
-//$elevate->clearTransformers();
+// $elevate->clearTransformers();
// this executes the query and returns the result
$resultset = $client->select($query);
@@ -52,7 +53,6 @@ echo 'NumFound: '.$resultset->getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -62,7 +62,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
}
diff --git a/docs/queries/select-query/building-a-select-query/components/query-rerankquery-component.md b/docs/queries/select-query/building-a-select-query/components/query-rerankquery-component.md
index 4d154a718..cea7b9b4e 100644
--- a/docs/queries/select-query/building-a-select-query/components/query-rerankquery-component.md
+++ b/docs/queries/select-query/building-a-select-query/components/query-rerankquery-component.md
@@ -23,7 +23,8 @@ Example
```php
getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -68,7 +68,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/docs/queries/select-query/building-a-select-query/components/spellcheck-component.md b/docs/queries/select-query/building-a-select-query/components/spellcheck-component.md
index c40fed049..f5f6ecba9 100644
--- a/docs/queries/select-query/building-a-select-query/components/spellcheck-component.md
+++ b/docs/queries/select-query/building-a-select-query/components/spellcheck-component.md
@@ -34,7 +34,8 @@ Example
```php
getHits().'
';
echo 'Corrections:
';
foreach ($collation->getCorrections() as $input => $correction) {
- echo $input . ' => ' . $correction .'
';
+ echo $input.' => '.$correction.'
';
}
echo '
';
}
diff --git a/docs/queries/select-query/building-a-select-query/components/stats-component.md b/docs/queries/select-query/building-a-select-query/components/stats-component.md
index 7c9bb3859..8261c240b 100644
--- a/docs/queries/select-query/building-a-select-query/components/stats-component.md
+++ b/docs/queries/select-query/building-a-select-query/components/stats-component.md
@@ -15,7 +15,8 @@ Example
```php
getStats();
// display the stats results
foreach ($statsResult as $field) {
- echo '' . $field->getName() . '
';
- echo 'Min: ' . $field->getMin() . '
';
- echo 'Max: ' . $field->getMax() . '
';
- echo 'Sum: ' . $field->getSum() . '
';
- echo 'Count: ' . $field->getCount() . '
';
- echo 'Missing: ' . $field->getMissing() . '
';
- echo 'SumOfSquares: ' . $field->getSumOfSquares() . '
';
- echo 'Mean: ' . $field->getMean() . '
';
- echo 'Stddev: ' . $field->getStddev() . '
';
+ echo ''.$field->getName().'
';
+ echo 'Min: '.$field->getMin().'
';
+ echo 'Max: '.$field->getMax().'
';
+ echo 'Sum: '.$field->getSum().'
';
+ echo 'Count: '.$field->getCount().'
';
+ echo 'Missing: '.$field->getMissing().'
';
+ echo 'SumOfSquares: '.$field->getSumOfSquares().'
';
+ echo 'Mean: '.$field->getMean().'
';
+ echo 'Stddev: '.$field->getStddev().'
';
echo 'Field facets
';
- foreach ($field->getFacets() as $field => $facet) {
- echo 'Facet ' . $field . '
';
+ foreach ($field->getFacets() as $facetName => $facet) {
+ echo 'Facet '.$facetName.'
';
foreach ($facet as $facetStats) {
- echo 'Value: ' . $facetStats->getValue() . '
';
- echo 'Min: ' . $facetStats->getMin() . '
';
- echo 'Max: ' . $facetStats->getMax() . '
';
- echo 'Sum: ' . $facetStats->getSum() . '
';
- echo 'Count: ' . $facetStats->getCount() . '
';
- echo 'Missing: ' . $facetStats->getMissing() . '
';
- echo 'SumOfSquares: ' . $facetStats->getSumOfSquares() . '
';
- echo 'Mean: ' . $facetStats->getMean() . '
';
- echo 'Stddev: ' . $facetStats->getStddev() . '
';
+ echo 'Value: '.$facetStats->getValue().'
';
+ echo 'Min: '.$facetStats->getMin().'
';
+ echo 'Max: '.$facetStats->getMax().'
';
+ echo 'Sum: '.$facetStats->getSum().'
';
+ echo 'Count: '.$facetStats->getCount().'
';
+ echo 'Missing: '.$facetStats->getMissing().'
';
+ echo 'SumOfSquares: '.$facetStats->getSumOfSquares().'
';
+ echo 'Mean: '.$facetStats->getMean().'
';
+ echo 'Stddev: '.$facetStats->getStddev().'
';
}
}
diff --git a/docs/queries/select-query/building-a-select-query/components/termvector-component.md b/docs/queries/select-query/building-a-select-query/components/termvector-component.md
index feb2c8398..c5ad03f92 100644
--- a/docs/queries/select-query/building-a-select-query/components/termvector-component.md
+++ b/docs/queries/select-query/building-a-select-query/components/termvector-component.md
@@ -22,7 +22,8 @@ Example
```php
select($query);
$termVector = $resultset->getTermVector();
foreach ($termVector as $key => $document) {
-
echo ''.$key.'
';
foreach ($document as $fieldName => $field) {
-
echo ''.$fieldName.'
';
foreach ($field as $term => $termInfo) {
-
echo '
'.$term.'
';
- echo '| Term frequency | ' . $termInfo['tf'] ?? '' . ' |
';
- echo '| Document frequency | ' . $termInfo['df'] ?? '' . ' |
';
- echo '| TF * IDF | ' . $termInfo['tf-idf'] ?? '' . ' |
';
+ echo '| Term frequency | '.$termInfo['tf'] ?? ''.' |
';
+ echo '| Document frequency | '.$termInfo['df'] ?? ''.' |
';
+ echo '| TF * IDF | '.$termInfo['tf-idf'] ?? ''.' |
';
echo '| Positions | ';
foreach ($termInfo['positions'] ?? [] as $position) {
- echo $position . ' ';
+ echo $position.' ';
}
echo ' |
';
echo '| Offsets | ';
foreach ($termInfo['offsets'] ?? [] as $offset) {
- echo 'start: '.$offset['start'] . ' ';
- echo 'end: '.$offset['end'] . ' ';
+ echo 'start: '.$offset['start'].' ';
+ echo 'end: '.$offset['end'].' ';
}
echo ' |
';
echo '| Payloads | ';
foreach ($termInfo['payloads'] ?? [] as $payload) {
- echo $payload . ' ';
+ echo $payload.' ';
}
echo ' |
';
diff --git a/docs/queries/select-query/executing-a-select-query.md b/docs/queries/select-query/executing-a-select-query.md
index 9e1b0c640..c1a89becd 100644
--- a/docs/queries/select-query/executing-a-select-query.md
+++ b/docs/queries/select-query/executing-a-select-query.md
@@ -5,24 +5,24 @@ See the example code below.
```php
createQuery($client::QUERY_SELECT);
+$query = $client->createSelect();
// this executes the query and returns the result
-$resultset = $client->execute($query);
+$resultset = $client->select($query);
// display the total number of documents found by Solr
echo 'NumFound: '.$resultset->getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -32,7 +32,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/docs/queries/select-query/re-use-of-queries.md b/docs/queries/select-query/re-use-of-queries.md
index 397c401ba..69446363c 100644
--- a/docs/queries/select-query/re-use-of-queries.md
+++ b/docs/queries/select-query/re-use-of-queries.md
@@ -5,16 +5,16 @@ There are multiple ways to do this, depending on your use case and personal pref
```php
setStart(2)->setRows(20);
// set fields to fetch (this overrides the default setting 'all fields')
- $this->setFields(array('id','name','price'));
+ $this->setFields(['id', 'name', 'price']);
// sort the results by price ascending
$this->addSort('price', self::SORT_ASC);
@@ -65,7 +65,6 @@ echo 'NumFound: '.$resultset->getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -75,7 +74,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/docs/queries/select-query/result-of-a-select-query/component-results/facetset-result.md b/docs/queries/select-query/result-of-a-select-query/component-results/facetset-result.md
index aed2b59e6..a702b4180 100644
--- a/docs/queries/select-query/result-of-a-select-query/component-results/facetset-result.md
+++ b/docs/queries/select-query/result-of-a-select-query/component-results/facetset-result.md
@@ -14,7 +14,8 @@ You can also use the `Countable` interface to get the number of counts.
```php
getNumFound();
echo '
Facet counts for field "inStock":
';
$facet = $resultset->getFacetSet()->getFacet('stock');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
@@ -66,7 +66,8 @@ A facet query result is really simple. It has just one value: the count. You can
```php
getNumFound();
// display facet query count
$count = $resultset->getFacetSet()->getFacet('stock')->getValue();
-echo '
Facet query count : ' . $count;
+echo '
Facet query count : '.$count;
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
@@ -115,7 +115,8 @@ A multiquery facet is basically a combination of multiple facet query instances.
```php
getNumFound();
echo '
Multiquery facet counts:
';
$facet = $resultset->getFacetSet()->getFacet('stock');
foreach ($facet as $key => $count) {
- echo $key . ' [' . $count . ']
';
+ echo $key.' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
@@ -171,7 +171,8 @@ A range facet is also similar to a facet field, but instead of field value count
```php
getNumFound();
echo '
Facet ranges:
';
$facet = $resultset->getFacetSet()->getFacet('priceranges');
foreach ($facet as $range => $count) {
- echo $range . ' to ' . ($range + 100) . ' [' . $count . ']
';
+ echo $range.' to '.($range + 100).' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/docs/queries/select-query/result-of-a-select-query/component-results/grouping-result.md b/docs/queries/select-query/result-of-a-select-query/component-results/grouping-result.md
index 516a32118..3b7a0e7e1 100644
--- a/docs/queries/select-query/result-of-a-select-query/component-results/grouping-result.md
+++ b/docs/queries/select-query/result-of-a-select-query/component-results/grouping-result.md
@@ -16,7 +16,8 @@ Grouped by field:
```php
select($query);
$groups = $resultset->getGrouping();
foreach ($groups as $groupKey => $fieldGroup) {
-
echo ''.$groupKey.'
';
echo 'Matches: '.$fieldGroup->getMatches().'
';
echo 'Number of groups: '.$fieldGroup->getNumberOfGroups();
foreach ($fieldGroup as $valueGroup) {
-
echo ''.(int)$valueGroup->getValue().'
';
foreach ($valueGroup as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -59,7 +57,7 @@ foreach ($groups as $groupKey => $fieldGroup) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
@@ -76,7 +74,8 @@ Grouped by query:
```php
select($query);
$groups = $resultset->getGrouping();
foreach ($groups as $groupKey => $group) {
-
echo ''.$groupKey.'
';
foreach ($group as $document) {
@@ -112,7 +110,7 @@ foreach ($groups as $groupKey => $group) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/docs/queries/select-query/result-of-a-select-query/component-results/highlighting-result.md b/docs/queries/select-query/result-of-a-select-query/component-results/highlighting-result.md
index 175401f51..d8faa0217 100644
--- a/docs/queries/select-query/result-of-a-select-query/component-results/highlighting-result.md
+++ b/docs/queries/select-query/result-of-a-select-query/component-results/highlighting-result.md
@@ -8,7 +8,8 @@ Example
```php
getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -42,7 +42,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
Highlighting results:
';
@@ -51,10 +51,9 @@ foreach ($resultset as $document) {
$highlightedDoc = $highlighting->getResult($document->id);
if ($highlightedDoc) {
foreach ($highlightedDoc as $field => $highlight) {
- echo implode(' (...) ', $highlight) . '
';
+ echo implode(' (...) ', $highlight).'
';
}
}
-
}
htmlFooter();
diff --git a/docs/queries/select-query/result-of-a-select-query/component-results/morelikethis-result.md b/docs/queries/select-query/result-of-a-select-query/component-results/morelikethis-result.md
index 4821ca39e..329396e57 100644
--- a/docs/queries/select-query/result-of-a-select-query/component-results/morelikethis-result.md
+++ b/docs/queries/select-query/result-of-a-select-query/component-results/morelikethis-result.md
@@ -25,7 +25,8 @@ Example
```php
getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -61,7 +61,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
MLT results:
';
@@ -73,7 +73,7 @@ foreach ($resultset as $document) {
echo 'NumFound: '.$mltResult->getNumFound().'
';
echo 'Num. fetched: '.count($mltResult).'
';
foreach ($mltResult as $mltDoc) {
- echo 'MLT result doc: '. $mltDoc->name . ' (id='. $mltDoc->id . ')
';
+ echo 'MLT result doc: '.$mltDoc->name.' (id='.$mltDoc->id.')
';
}
// available since Solr 8.2 if the query wasn't distributed
if (null !== $interestingTerms = $mlt->getInterestingTerm($document->id)) {
@@ -82,7 +82,6 @@ foreach ($resultset as $document) {
} else {
echo 'No MLT results';
}
-
}
htmlFooter();
diff --git a/docs/queries/select-query/result-of-a-select-query/result-of-a-select-query.md b/docs/queries/select-query/result-of-a-select-query/result-of-a-select-query.md
index 001278032..eb3752b40 100644
--- a/docs/queries/select-query/result-of-a-select-query/result-of-a-select-query.md
+++ b/docs/queries/select-query/result-of-a-select-query/result-of-a-select-query.md
@@ -47,24 +47,24 @@ A basic usage example:
```php
createQuery($client::QUERY_SELECT);
+$query = $client->createSelect();
// this executes the query and returns the result
-$resultset = $client->execute($query);
+$resultset = $client->select($query);
// display the total number of documents found by Solr
echo 'NumFound: '.$resultset->getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -74,7 +74,7 @@ foreach ($resultset as $document) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/docs/queries/server-query/core-admin-query.md b/docs/queries/server-query/core-admin-query.md
index 426b688bc..be67a1272 100644
--- a/docs/queries/server-query/core-admin-query.md
+++ b/docs/queries/server-query/core-admin-query.md
@@ -10,7 +10,8 @@ The following example shows how your can build a CoreAdmin query that executes t
```php
coreAdmin($coreAdminQuery);
$statusResult = $response->getStatusResult();
echo 'CoreAdmin status action execution:
';
-echo 'Uptime of the core ( ' .$statusResult->getCoreName(). ' ): ' . $statusResult->getUptime();
+echo 'Uptime of the core ( '.$statusResult->getCoreName().' ): '.$statusResult->getUptime();
htmlFooter();
```
diff --git a/docs/queries/suggester-query.md b/docs/queries/suggester-query.md
index e9a648c16..3f898e832 100644
--- a/docs/queries/suggester-query.md
+++ b/docs/queries/suggester-query.md
@@ -31,7 +31,8 @@ Example
```php
createSuggester();
-$query->setQuery('ap ip v'); //multiple terms
+$query->setQuery('ap ip v'); // multiple terms
$query->setDictionary('suggest');
$query->setOnlyMorePopular(true);
$query->setCount(10);
@@ -52,7 +53,7 @@ echo 'Query: '.$query->getQuery().'
';
// display results for each term
foreach ($resultset as $term => $termResult) {
- echo '' . $term . '
';
+ echo ''.$term.'
';
echo 'NumFound: '.$termResult->getNumFound().'
';
echo 'StartOffset: '.$termResult->getStartOffset().'
';
echo 'EndOffset: '.$termResult->getEndOffset().'
';
diff --git a/docs/queries/terms-query.md b/docs/queries/terms-query.md
index c8e0abe9c..94216fb28 100644
--- a/docs/queries/terms-query.md
+++ b/docs/queries/terms-query.md
@@ -40,7 +40,8 @@ Example
```php
terms($query);
// display terms
foreach ($resultset as $field => $terms) {
- echo '' . $field . '
';
+ echo ''.$field.'
';
foreach ($terms as $term => $count) {
- echo $term . ' (' . $count . ')
';
+ echo $term.' ('.$count.')
';
}
echo '
';
}
diff --git a/docs/queries/update-query/building-an-update-query/add-command.md b/docs/queries/update-query/building-an-update-query/add-command.md
index 74c217da0..ff21fa8a1 100644
--- a/docs/queries/update-query/building-an-update-query/add-command.md
+++ b/docs/queries/update-query/building-an-update-query/add-command.md
@@ -27,7 +27,8 @@ Examples
```php
name = 'testdoc-2';
$doc2->price = 340;
// add the documents and a commit command to the update query
-$update->addDocuments(array($doc1, $doc2));
+$update->addDocuments([$doc1, $doc2]);
$update->addCommit();
// this executes the query and returns the result
$result = $client->update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
diff --git a/docs/queries/update-query/building-an-update-query/building-an-update-query.md b/docs/queries/update-query/building-an-update-query/building-an-update-query.md
index e804e8036..a50955ff4 100644
--- a/docs/queries/update-query/building-an-update-query/building-an-update-query.md
+++ b/docs/queries/update-query/building-an-update-query/building-an-update-query.md
@@ -43,7 +43,8 @@ Add documents:
```php
name = 'testdoc-2';
$doc2->price = 340;
// add the documents and a commit command to the update query
-$update->addDocuments(array($doc1, $doc2));
+$update->addDocuments([$doc1, $doc2]);
$update->addCommit();
// this executes the query and returns the result
$result = $client->update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
@@ -84,7 +85,8 @@ Delete by query:
```php
addCommit();
$result = $client->update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
diff --git a/docs/queries/update-query/building-an-update-query/commit-command.md b/docs/queries/update-query/building-an-update-query/commit-command.md
index d28cf1375..a6c44e2df 100644
--- a/docs/queries/update-query/building-an-update-query/commit-command.md
+++ b/docs/queries/update-query/building-an-update-query/commit-command.md
@@ -25,7 +25,8 @@ Example
```php
addCommit();
$result = $client->update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
diff --git a/docs/queries/update-query/building-an-update-query/delete-command.md b/docs/queries/update-query/building-an-update-query/delete-command.md
index f24b49de5..147987d20 100644
--- a/docs/queries/update-query/building-an-update-query/delete-command.md
+++ b/docs/queries/update-query/building-an-update-query/delete-command.md
@@ -13,7 +13,8 @@ Examples
```php
addCommit();
$result = $client->update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
@@ -40,7 +41,8 @@ htmlFooter();
```php
addCommit();
$result = $client->update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
diff --git a/docs/queries/update-query/building-an-update-query/optimize-command.md b/docs/queries/update-query/building-an-update-query/optimize-command.md
index 608c14479..a79ea6530 100644
--- a/docs/queries/update-query/building-an-update-query/optimize-command.md
+++ b/docs/queries/update-query/building-an-update-query/optimize-command.md
@@ -25,7 +25,8 @@ Example
```php
addOptimize(true, false, 5);
$result = $client->update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
diff --git a/docs/queries/update-query/building-an-update-query/rawxml-command.md b/docs/queries/update-query/building-an-update-query/rawxml-command.md
index 0947c3da4..94e756349 100644
--- a/docs/queries/update-query/building-an-update-query/rawxml-command.md
+++ b/docs/queries/update-query/building-an-update-query/rawxml-command.md
@@ -15,7 +15,8 @@ Example
```php
addCommit();
$result = $client->update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
diff --git a/docs/queries/update-query/building-an-update-query/rollback-command.md b/docs/queries/update-query/building-an-update-query/rollback-command.md
index c7ea04eab..3e3b30b88 100644
--- a/docs/queries/update-query/building-an-update-query/rollback-command.md
+++ b/docs/queries/update-query/building-an-update-query/rollback-command.md
@@ -13,7 +13,8 @@ Example
```php
addRollback();
$result = $client->update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
diff --git a/docs/queries/update-query/executing-an-update-query.md b/docs/queries/update-query/executing-an-update-query.md
index db292873a..8972c7ab6 100644
--- a/docs/queries/update-query/executing-an-update-query.md
+++ b/docs/queries/update-query/executing-an-update-query.md
@@ -5,7 +5,8 @@ See the example code below.
```php
addCommit();
$result = $client->update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
diff --git a/docs/solarium-concepts.md b/docs/solarium-concepts.md
index 6587419e3..fa8f086aa 100644
--- a/docs/solarium-concepts.md
+++ b/docs/solarium-concepts.md
@@ -22,7 +22,7 @@ As an example the three modes are demonstrated, all creating an identical Solr c
```php
createSelect();
// apply settings using the API
$query->setQuery('*:*');
$query->setStart(2)->setRows(20);
-$query->setFields(array('id','name','price'));
+$query->setFields(['id', 'name', 'price']);
$query->addSort('price', $query::SORT_ASC);
// create a filterquery using the API
@@ -55,16 +55,15 @@ echo 'NumFound: '.$resultset->getNumFound();
echo '
Facet counts for field "inStock":
';
$facet = $resultset->getFacetSet()->getFacet('stock');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
@@ -77,29 +76,30 @@ htmlFooter();
```php
'*:*',
- 'start' => 2,
- 'rows' => 20,
- 'fields' => array('id','name','price'),
- 'sort' => array('price' => 'asc'),
- 'filterquery' => array(
- 'maxprice' => array(
- 'query' => 'price:[1 TO 300]'
- ),
- ),
- 'component' => array(
- 'facetset' => array(
- 'facet' => array(
+$select = [
+ 'query' => '*:*',
+ 'start' => 2,
+ 'rows' => 20,
+ 'fields' => ['id', 'name', 'price'],
+ 'sort' => ['price' => 'asc'],
+ 'filterquery' => [
+ 'maxprice' => [
+ 'query' => 'price:[1 TO 300]',
+ ],
+ ],
+ 'component' => [
+ 'facetset' => [
+ 'facet' => [
// notice this config uses an inline key value under 'local_key', instead of array key like the filterquery
- array('type' => 'field', 'local_key' => 'stock', 'field' => 'inStock'),
- )
- ),
- ),
-);
+ ['type' => 'field', 'local_key' => 'stock', 'field' => 'inStock'],
+ ],
+ ],
+ ],
+];
// create a client instance
$client = new Solarium\Client($adapter, $eventDispatcher, $config);
@@ -117,16 +117,15 @@ echo 'NumFound: '.$resultset->getNumFound();
echo '
Facet counts for field "inStock":
';
$facet = $resultset->getFacetSet()->getFacet('stock');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
@@ -139,10 +138,11 @@ htmlFooter();
```php
setQuery('*:*');
$this->setStart(2)->setRows(20);
- $this->setFields(array('id','name','price'));
+ $this->setFields(['id', 'name', 'price']);
$this->addSort('price', self::SORT_ASC);
// create a facet field instance and set options
@@ -182,7 +182,7 @@ class ProductPriceLimitedQuery extends ProductQuery
$client = new Client($adapter, $eventDispatcher, $config);
// create a query instance
-$query = new ProductPriceLimitedQuery;
+$query = new ProductPriceLimitedQuery();
// this executes the query and returns the result
$resultset = $client->select($query);
@@ -194,16 +194,15 @@ echo 'NumFound: '.$resultset->getNumFound();
echo '
Facet counts for field "inStock":
';
$facet = $resultset->getFacetSet()->getFacet('stock');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
@@ -253,4 +252,4 @@ However this comes at the cost of a possible security risk in PHP deserializatio
You can switch to the phps responseparser by setting a query option:
-`$query = $client->createQuery($client::QUERY_SELECT, array('responsewriter' => 'phps'));`
+`$query = $client->createSelect(['responsewriter' => 'phps']);`
diff --git a/examples/1.1-check-solarium-and-ping.php b/examples/1.1-check-solarium-and-ping.php
index 04cc90ce8..6e7f71e0d 100644
--- a/examples/1.1-check-solarium-and-ping.php
+++ b/examples/1.1-check-solarium-and-ping.php
@@ -1,10 +1,11 @@
ping($ping);
echo 'Ping query successful
';
- echo 'Ping status: ' . $result->getPingStatus() . '
';
- echo 'Query time: ' . $result->getQueryTime() . ' ms
';
+ echo 'Ping status: '.$result->getPingStatus().'
';
+ echo 'Query time: '.$result->getQueryTime().' ms
';
// only relevant for distributed requests
if (null !== $zkConnected = $result->getZkConnected()) {
- echo 'ZooKeeper connected: ' . ($zkConnected ? 'yes' : 'no');
+ echo 'ZooKeeper connected: '.($zkConnected ? 'yes' : 'no');
}
} catch (Exception $e) {
echo 'Ping query failed';
diff --git a/examples/1.2-basic-select.php b/examples/1.2-basic-select.php
index e7875425a..01a8d8ee1 100644
--- a/examples/1.2-basic-select.php
+++ b/examples/1.2-basic-select.php
@@ -1,13 +1,14 @@
createQuery($client::QUERY_SELECT);
+$query = $client->createSelect();
// Pagination example
$resultsPerPage = 15;
@@ -19,14 +20,13 @@
$query->setStart(($currentPage - 1) * $resultsPerPage);
// this executes the query and returns the result
-$resultset = $client->execute($query);
+$resultset = $client->select($query);
// display the total number of documents found by Solr
echo 'NumFound: '.$resultset->getNumFound();
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -36,7 +36,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/1.3-basic-update.php b/examples/1.3-basic-update.php
index 74d7802ec..cb45bcee9 100644
--- a/examples/1.3-basic-update.php
+++ b/examples/1.3-basic-update.php
@@ -1,6 +1,7 @@
update($update);
echo 'Update query executed
';
- echo 'Query status: ' . $result->getStatus(). '
';
- echo 'Query time: ' . $result->getQueryTime();
+ echo 'Query status: '.$result->getStatus().'
';
+ echo 'Query time: '.$result->getQueryTime();
} else {
// if no data is posted show a form
diff --git a/examples/2.1.1-query-params.php b/examples/2.1.1-query-params.php
index 7b4a1fd16..d4b02f335 100644
--- a/examples/2.1.1-query-params.php
+++ b/examples/2.1.1-query-params.php
@@ -1,6 +1,6 @@
setStart(2)->setRows(20);
// set fields to fetch (this overrides the default setting 'all fields')
-$query->setFields(array('id','name','price', 'score'));
+$query->setFields(['id', 'name', 'price', 'score']);
// sort the results by price ascending
$query->addSort('price', $query::SORT_ASC);
@@ -33,7 +33,6 @@
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -43,7 +42,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/2.1.2-custom-result-document.php b/examples/2.1.2-custom-result-document.php
index 402936b0f..8f9ed2d42 100644
--- a/examples/2.1.2-custom-result-document.php
+++ b/examples/2.1.2-custom-result-document.php
@@ -1,19 +1,18 @@
price * .95), 2);
+ return round($this->price * .95, 2);
}
}
-
// create a client instance
$client = new Solarium\Client($adapter, $eventDispatcher, $config);
@@ -31,14 +30,13 @@ public function getSpecialPrice(): float
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
// this method is added by the custom class
- echo '| offer price | ' . $document->getSpecialPrice() . ' |
';
+ echo '| offer price | '.$document->getSpecialPrice().' |
';
echo '
';
}
diff --git a/examples/2.1.3-filterquery.php b/examples/2.1.3-filterquery.php
index 2e48639cc..d105b6524 100644
--- a/examples/2.1.3-filterquery.php
+++ b/examples/2.1.3-filterquery.php
@@ -1,6 +1,7 @@
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/examples/2.1.5.1.1-facet-field.php b/examples/2.1.5.1.1-facet-field.php
index e812351d6..246868a74 100644
--- a/examples/2.1.5.1.1-facet-field.php
+++ b/examples/2.1.5.1.1-facet-field.php
@@ -1,6 +1,7 @@
Facet counts for field "inStock":
';
$facet = $resultset->getFacetSet()->getFacet('stock');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/examples/2.1.5.1.1.1-facet-field-filters.php b/examples/2.1.5.1.1.1-facet-field-filters.php
index 61f43c8b5..34c1c7845 100644
--- a/examples/2.1.5.1.1.1-facet-field-filters.php
+++ b/examples/2.1.5.1.1.1-facet-field-filters.php
@@ -1,6 +1,7 @@
Facet counts for field "cat":
';
$facet = $resultset->getFacetSet()->getFacet('category');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
// display facet counts
echo '
Facet counts for field "cat"; terms prefixed with "s":
';
$facet = $resultset->getFacetSet()->getFacet('prefixed');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
// display facet counts
echo '
Facet counts for field "cat"; terms containing "electronics":
';
$facet = $resultset->getFacetSet()->getFacet('electronics');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
// display facet counts
echo '
Facet counts for field "cat"; terms matching regex "electronics.+":
';
$facet = $resultset->getFacetSet()->getFacet('electronicsAndMore');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
// display facet counts
echo '
Facet counts for field "cat"; terms excluding "electronics" and "music":
';
$facet = $resultset->getFacetSet()->getFacet('electronicsExclude');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
// display facet counts
echo '
Facet counts for field "cat"; terms limited to "electronics" and "music":
';
$facet = $resultset->getFacetSet()->getFacet('electronicsTerms');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
htmlFooter();
diff --git a/examples/2.1.5.1.1.2-facet-field-excludes.php b/examples/2.1.5.1.1.2-facet-field-excludes.php
index 02d61914f..54a5fc256 100644
--- a/examples/2.1.5.1.1.2-facet-field-excludes.php
+++ b/examples/2.1.5.1.1.2-facet-field-excludes.php
@@ -1,6 +1,7 @@
Facet counts for field "cat"; limited to the filter "electronics":
';
$facet = $resultset->getFacetSet()->getFacet('category');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
// display facet counts
echo '
Facet counts for field "cat"; excluding the filter "electronics":
';
$facet = $resultset->getFacetSet()->getFacet('unfiltered');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
htmlFooter();
diff --git a/examples/2.1.5.1.2-facet-query.php b/examples/2.1.5.1.2-facet-query.php
index d693cb745..36084a04c 100644
--- a/examples/2.1.5.1.2-facet-query.php
+++ b/examples/2.1.5.1.2-facet-query.php
@@ -1,6 +1,7 @@
getFacetSet()->getFacet('stock')->getValue();
-echo '
Facet query count : ' . $count;
+echo '
Facet query count : '.$count;
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/examples/2.1.5.1.3-facet-multiquery.php b/examples/2.1.5.1.3-facet-multiquery.php
index 21cd8678e..b703df263 100644
--- a/examples/2.1.5.1.3-facet-multiquery.php
+++ b/examples/2.1.5.1.3-facet-multiquery.php
@@ -1,6 +1,7 @@
Multiquery facet counts:
';
$facet = $resultset->getFacetSet()->getFacet('stock');
foreach ($facet as $key => $count) {
- echo $key . ' [' . $count . ']
';
+ echo $key.' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/examples/2.1.5.1.4-facet-range.php b/examples/2.1.5.1.4-facet-range.php
index e2f1e5914..47af78cf8 100644
--- a/examples/2.1.5.1.4-facet-range.php
+++ b/examples/2.1.5.1.4-facet-range.php
@@ -1,6 +1,7 @@
Facet ranges:
';
$facet = $resultset->getFacetSet()->getFacet('priceranges');
foreach ($facet as $range => $count) {
- echo $range . ' to ' . ($range + 100) . ' [' . $count . ']
';
+ echo $range.' to '.($range + 100).' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/examples/2.1.5.1.4.1-facet-range-mincount.php b/examples/2.1.5.1.4.1-facet-range-mincount.php
index a2376b11a..406e7ed1c 100644
--- a/examples/2.1.5.1.4.1-facet-range-mincount.php
+++ b/examples/2.1.5.1.4.1-facet-range-mincount.php
@@ -1,6 +1,7 @@
Facet ranges:
';
$facet = $resultset->getFacetSet()->getFacet('priceranges');
foreach ($facet as $range => $count) {
- echo $range . ' to ' . ($range + 100) . ' [' . $count . ']
';
+ echo $range.' to '.($range + 100).' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/examples/2.1.5.1.4.2-facet-range-other.php b/examples/2.1.5.1.4.2-facet-range-other.php
index c60e628ff..51b96c912 100644
--- a/examples/2.1.5.1.4.2-facet-range-other.php
+++ b/examples/2.1.5.1.4.2-facet-range-other.php
@@ -1,6 +1,7 @@
Facet ranges:
';
$facet = $resultset->getFacetSet()->getFacet('priceranges');
foreach ($facet as $range => $count) {
- echo $range . ' to ' . ($range + 100) . ' [' . $count . ']
';
+ echo $range.' to '.($range + 100).' ['.$count.']
';
}
// display other facet counts
echo '
Other facet counts:
';
-echo 'before [' . $facet->getBefore() . ']
';
-echo 'between [' . $facet->getBetween() . ']
';
-echo 'after [' . $facet->getAfter() . ']
';
+echo 'before ['.$facet->getBefore().']
';
+echo 'between ['.$facet->getBetween().']
';
+echo 'after ['.$facet->getAfter().']
';
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/examples/2.1.5.1.4.3-facet-range-excludes.php b/examples/2.1.5.1.4.3-facet-range-excludes.php
index fe36ea8b2..686b3a51f 100644
--- a/examples/2.1.5.1.4.3-facet-range-excludes.php
+++ b/examples/2.1.5.1.4.3-facet-range-excludes.php
@@ -1,6 +1,7 @@
Facet ranges; limited to the filter "budget":
';
$facet = $resultset->getFacetSet()->getFacet('priceranges');
foreach ($facet as $range => $count) {
- echo $range . ' to ' . ($range + 100) . ' [' . $count . ']
';
+ echo $range.' to '.($range + 100).' ['.$count.']
';
}
// display facet counts
echo '
Facet ranges; excluding the filter "budget":
';
$facet = $resultset->getFacetSet()->getFacet('allpriceranges');
foreach ($facet as $range => $count) {
- echo $range . ' to ' . ($range + 100) . ' [' . $count . ']
';
+ echo $range.' to '.($range + 100).' ['.$count.']
';
}
htmlFooter();
diff --git a/examples/2.1.5.1.4.4-facet-range-multiple.php b/examples/2.1.5.1.4.4-facet-range-multiple.php
index e92e492b2..7e118cbf9 100644
--- a/examples/2.1.5.1.4.4-facet-range-multiple.php
+++ b/examples/2.1.5.1.4.4-facet-range-multiple.php
@@ -1,6 +1,7 @@
Facet ranges under 100:
';
$facet = $resultset->getFacetSet()->getFacet('under100');
foreach ($facet as $range => $count) {
- echo $range . ' to ' . ($range + 9.99) . ' [' . $count . ']
';
+ echo $range.' to '.($range + 9.99).' ['.$count.']
';
}
// display facet counts for second range
echo '
Facet ranges over 50:
';
$facet = $resultset->getFacetSet()->getFacet('over50');
foreach ($facet as $range => $count) {
- echo $range . ' to ' . ($range + 49.99) . ' [' . $count . ']
';
+ echo $range.' to '.($range + 49.99).' ['.$count.']
';
}
-echo '450.0+ [' . $facet->getAfter() . ']
';
+echo '450.0+ ['.$facet->getAfter().']
';
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/examples/2.1.5.1.5-facet-pivot.php b/examples/2.1.5.1.5-facet-pivot.php
index bae36e7af..d95c72b70 100644
--- a/examples/2.1.5.1.5-facet-pivot.php
+++ b/examples/2.1.5.1.5-facet-pivot.php
@@ -1,6 +1,7 @@
createFacetPivot('cat-popularity-instock');
$facet->addFields('cat,popularity,inStock');
-$facet->setMinCount(0);
+$facet->setPivotMinCount(0);
$facet = $facetSet->createFacetPivot('popularity-cat');
$facet->addFields('popularity,cat');
@@ -41,9 +42,8 @@
htmlFooter();
-
/**
- * Recursively render pivot facets
+ * Recursively render pivot facets.
*
* @param $pivot
*/
diff --git a/examples/2.1.5.1.6-facet-interval.php b/examples/2.1.5.1.6-facet-interval.php
index 3e71d5545..41c06afac 100644
--- a/examples/2.1.5.1.6-facet-interval.php
+++ b/examples/2.1.5.1.6-facet-interval.php
@@ -1,6 +1,7 @@
createFacetInterval('price');
$facet->setField('price');
-$facet->setSet(array('1-9' => '[1,10)', '10-49' => '[10,50)', '49>' => '[50,*)'));
+$facet->setSet(['1-9' => '[1,10)', '10-49' => '[10,50)', '49>' => '[50,*)']);
// this executes the query and returns the result
$resultset = $client->select($query);
@@ -27,16 +28,15 @@
echo '
Facet intervals:
';
$facet = $resultset->getFacetSet()->getFacet('price');
foreach ($facet as $interval => $count) {
- echo $interval . ' [' . $count . ']
';
+ echo $interval.' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/examples/2.1.5.1.7-facet-json-terms.php b/examples/2.1.5.1.7-facet-json-terms.php
index acf9d5779..35f430407 100644
--- a/examples/2.1.5.1.7-facet-json-terms.php
+++ b/examples/2.1.5.1.7-facet-json-terms.php
@@ -1,6 +1,7 @@
getFacetSet();
// create a json terms instance and set options
-$categoriesTerms = new Solarium\Component\Facet\JsonTerms(['local_key' => 'categories', 'field' => 'cat', 'limit'=>4,'numBuckets'=>true]);
+$categoriesTerms = new Solarium\Component\Facet\JsonTerms([
+ 'local_key' => 'categories',
+ 'field' => 'cat',
+ 'limit' => 4,
+ 'numBuckets' => true,
+]);
// add json terms instance to the facetSet
$facetSet->addFacet($categoriesTerms);
@@ -30,18 +36,17 @@
echo 'NumBuckets: '.$facet->getNumBuckets().' (total possible number of buckets, only available when \'numBuckets\'=>true in JsonTerms)
';
echo 'count(): '.$facet->count().' (number of buckets returned)
';
-// Note: use instanceof Solarium\Component\Result\Facet\Buckets to differentiate from standard field facets.
+// Note: use instanceof Solarium\Component\Result\Facet\Buckets to differentiate from standard field facets.
foreach ($facet as $bucket) {
- echo $bucket->getValue() . ' [' . $bucket->getCount() . ']
';
+ echo $bucket->getValue().' ['.$bucket->getCount().']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/examples/2.1.5.1.8-facet-json-query.php b/examples/2.1.5.1.8-facet-json-query.php
index 843c43026..e740cc26e 100644
--- a/examples/2.1.5.1.8-facet-json-query.php
+++ b/examples/2.1.5.1.8-facet-json-query.php
@@ -1,6 +1,7 @@
getFacet('count')->getValue();
-echo '
Facet "inStock" count : ' . $count;
+echo '
Facet "inStock" count : '.$count;
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/examples/2.1.5.1.9-facet-json-range.php b/examples/2.1.5.1.9-facet-json-range.php
index d1fa572a9..939501ea8 100644
--- a/examples/2.1.5.1.9-facet-json-range.php
+++ b/examples/2.1.5.1.9-facet-json-range.php
@@ -1,9 +1,10 @@
'priceranges', 'field' => 'price', 'start'=>1 ,'end'=>300,'gap'=>100, 'other'=>JsonRange::OTHER_ALL]);
+$priceranges = new JsonRange([
+ 'local_key' => 'priceranges',
+ 'field' => 'price',
+ 'start' => 1,
+ 'end' => 300,
+ 'gap' => 100,
+ 'other' => JsonRange::OTHER_ALL,
+]);
// add json range instance to the facetSet
$facetSet->addFacet($priceranges);
@@ -34,25 +42,23 @@
echo '
Facet ranges:
';
$facet = $resultset->getFacetSet()->getFacet('priceranges');
-// Note: use instanceof Solarium\Component\Result\Facet\JsonRange to differentiate from standard field facets.
-if($facet instanceof ResultFacetJsonRange) {
+// Note: use instanceof Solarium\Component\Result\Facet\JsonRange to differentiate from standard field facets.
+if ($facet instanceof ResultFacetJsonRange) {
echo 'Before ['.$facet->getBefore().']
';
echo 'After ['.$facet->getAfter().']
';
echo 'Between ['.$facet->getBetween().']
';
}
foreach ($facet as $bucket) {
- echo $bucket->getValue() . ' to ' . ($bucket->getValue() + 100) . ' [' . $bucket->getCount() . ']
';
+ echo $bucket->getValue().' to '.($bucket->getValue() + 100).' ['.$bucket->getCount().']
';
}
-
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/examples/2.1.5.10-stats.php b/examples/2.1.5.10-stats.php
index 45acd3494..2e2af4548 100644
--- a/examples/2.1.5.10-stats.php
+++ b/examples/2.1.5.10-stats.php
@@ -1,6 +1,7 @@
' . $field->getName() . '';
- echo 'Min: ' . $field->getMin() . '
';
- echo 'Max: ' . $field->getMax() . '
';
- echo 'Sum: ' . $field->getSum() . '
';
- echo 'Count: ' . $field->getCount() . '
';
- echo 'Missing: ' . $field->getMissing() . '
';
- echo 'SumOfSquares: ' . $field->getSumOfSquares() . '
';
- echo 'Mean: ' . $field->getMean() . '
';
- echo 'Stddev: ' . $field->getStddev() . '
';
+ echo ''.$field->getName().'
';
+ echo 'Min: '.$field->getMin().'
';
+ echo 'Max: '.$field->getMax().'
';
+ echo 'Sum: '.$field->getSum().'
';
+ echo 'Count: '.$field->getCount().'
';
+ echo 'Missing: '.$field->getMissing().'
';
+ echo 'SumOfSquares: '.$field->getSumOfSquares().'
';
+ echo 'Mean: '.$field->getMean().'
';
+ echo 'Stddev: '.$field->getStddev().'
';
echo 'Field facets
';
foreach ($field->getFacets() as $facetName => $facet) {
- echo 'Facet ' . $facetName . '
';
+ echo 'Facet '.$facetName.'
';
foreach ($facet as $facetStats) {
- echo 'Value: ' . $facetStats->getValue() . '
';
- echo 'Min: ' . $facetStats->getMin() . '
';
- echo 'Max: ' . $facetStats->getMax() . '
';
- echo 'Sum: ' . $facetStats->getSum() . '
';
- echo 'Count: ' . $facetStats->getCount() . '
';
- echo 'Missing: ' . $facetStats->getMissing() . '
';
- echo 'SumOfSquares: ' . $facetStats->getSumOfSquares() . '
';
- echo 'Mean: ' . $facetStats->getMean() . '
';
- echo 'Stddev: ' . $facetStats->getStddev() . '
';
+ echo 'Value: '.$facetStats->getValue().'
';
+ echo 'Min: '.$facetStats->getMin().'
';
+ echo 'Max: '.$facetStats->getMax().'
';
+ echo 'Sum: '.$facetStats->getSum().'
';
+ echo 'Count: '.$facetStats->getCount().'
';
+ echo 'Missing: '.$facetStats->getMissing().'
';
+ echo 'SumOfSquares: '.$facetStats->getSumOfSquares().'
';
+ echo 'Mean: '.$facetStats->getMean().'
';
+ echo 'Stddev: '.$facetStats->getStddev().'
';
}
}
diff --git a/examples/2.1.5.10.1-stats-percentiles.php b/examples/2.1.5.10.1-stats-percentiles.php
index 43b2f9ece..9da7d6afd 100644
--- a/examples/2.1.5.10.1-stats-percentiles.php
+++ b/examples/2.1.5.10.1-stats-percentiles.php
@@ -1,6 +1,7 @@
' . $field->getName() . '';
- echo 'Min: ' . $field->getMin() . '
';
- echo 'Max: ' . $field->getMax() . '
';
+ echo ''.$field->getName().'
';
+ echo 'Min: '.$field->getMin().'
';
+ echo 'Max: '.$field->getMax().'
';
echo 'Percentiles:
';
echo '';
foreach ($field->getPercentiles() as $percentile => $value) {
- echo '| ' . $percentile . ' | ' . $value . ' |
';
+ echo '| '.$percentile.' | '.$value.' |
';
}
echo '
';
echo '
';
diff --git a/examples/2.1.5.10.2-stats-distinct-values.php b/examples/2.1.5.10.2-stats-distinct-values.php
index 6a1466f23..266694c8b 100644
--- a/examples/2.1.5.10.2-stats-distinct-values.php
+++ b/examples/2.1.5.10.2-stats-distinct-values.php
@@ -1,6 +1,7 @@
' . $field->getName() . '';
- echo 'Min: ' . $field->getMin() . '
';
- echo 'Max: ' . $field->getMax() . '
';
- echo 'Number of distinct values: ' . $field->getCountDistinct() . '
';
+ echo ''.$field->getName().'
';
+ echo 'Min: '.$field->getMin().'
';
+ echo 'Max: '.$field->getMax().'
';
+ echo 'Number of distinct values: '.$field->getCountDistinct().'
';
echo 'Distinct values:
';
echo '';
foreach ($field->getDistinctValues() as $value) {
- echo '- ' . $value . '
';
+ echo '- '.$value.'
';
}
echo '
';
echo '
';
diff --git a/examples/2.1.5.10.3-stats-cardinality.php b/examples/2.1.5.10.3-stats-cardinality.php
index 2b6e6fb16..ddf4da5ec 100644
--- a/examples/2.1.5.10.3-stats-cardinality.php
+++ b/examples/2.1.5.10.3-stats-cardinality.php
@@ -1,6 +1,7 @@
' . $field->getName() . '';
- echo 'Min: ' . $field->getMin() . '
';
- echo 'Max: ' . $field->getMax() . '
';
- echo 'Exact number of distinct values: ' . $field->getCountDistinct() . '
';
- echo 'Approximate number of distinct values: ' . $field->getCardinality() . '
';
+ echo ''.$field->getName().'
';
+ echo 'Min: '.$field->getMin().'
';
+ echo 'Max: '.$field->getMax().'
';
+ echo 'Exact number of distinct values: '.$field->getCountDistinct().'
';
+ echo 'Approximate number of distinct values: '.$field->getCardinality().'
';
echo '
';
}
diff --git a/examples/2.1.5.11-debug.php b/examples/2.1.5.11-debug.php
index 3a7be9ad8..b199eb14f 100644
--- a/examples/2.1.5.11-debug.php
+++ b/examples/2.1.5.11-debug.php
@@ -1,6 +1,7 @@
Debug data';
-echo 'Querystring: ' . $debugResult->getQueryString() . '
';
-echo 'Parsed query: ' . $debugResult->getParsedQuery() . '
';
-echo 'Query parser: ' . $debugResult->getQueryParser() . '
';
-echo 'Other query: ' . $debugResult->getOtherQuery() . '
';
+echo 'Querystring: '.$debugResult->getQueryString().'
';
+echo 'Parsed query: '.$debugResult->getParsedQuery().'
';
+echo 'Query parser: '.$debugResult->getQueryParser().'
';
+echo 'Other query: '.$debugResult->getOtherQuery().'
';
echo 'Explain data
';
foreach ($debugResult->getExplain() as $key => $explanation) {
- echo 'Document key: ' . $key . '
';
- echo 'Value: ' . $explanation->getValue() . '
';
- echo 'Match: ' . (($explanation->getMatch() == true) ? 'true' : 'false') . '
';
- echo 'Description: ' . $explanation->getDescription() . '
';
+ echo 'Document key: '.$key.'
';
+ echo 'Value: '.$explanation->getValue().'
';
+ echo 'Match: '.($explanation->getMatch() ? 'true' : 'false').'
';
+ echo 'Description: '.$explanation->getDescription().'
';
echo 'Details
';
foreach ($explanation as $detail) {
- echo 'Value: ' . $detail->getValue() . '
';
- echo 'Match: ' . (($detail->getMatch() == true) ? 'true' : 'false') . '
';
- echo 'Description: ' . $detail->getDescription() . '
';
+ echo 'Value: '.$detail->getValue().'
';
+ echo 'Match: '.($detail->getMatch() ? 'true' : 'false').'
';
+ echo 'Description: '.$detail->getDescription().'
';
echo '
';
}
}
echo 'ExplainOther data
';
foreach ($debugResult->getExplainOther() as $key => $explanation) {
- echo 'Document key: ' . $key . '
';
- echo 'Value: ' . $explanation->getValue() . '
';
- echo 'Match: ' . (($explanation->getMatch() == true) ? 'true' : 'false') . '
';
- echo 'Description: ' . $explanation->getDescription() . '
';
+ echo 'Document key: '.$key.'
';
+ echo 'Value: '.$explanation->getValue().'
';
+ echo 'Match: '.($explanation->getMatch() ? 'true' : 'false').'
';
+ echo 'Description: '.$explanation->getDescription().'
';
echo 'Details
';
foreach ($explanation as $detail) {
- echo 'Value: ' . $detail->getValue() . '
';
- echo 'Match: ' . (($detail->getMatch() == true) ? 'true' : 'false') . '
';
- echo 'Description: ' . $detail->getDescription() . '
';
+ echo 'Value: '.$detail->getValue().'
';
+ echo 'Match: '.($detail->getMatch() ? 'true' : 'false').'
';
+ echo 'Description: '.$detail->getDescription().'
';
echo '
';
}
}
echo 'Timings (in ms)
';
-echo 'Total time: ' . $debugResult->getTiming()->getTime() . '
';
+echo 'Total time: '.$debugResult->getTiming()->getTime().'
';
echo 'Phases
';
foreach ($debugResult->getTiming()->getPhases() as $phaseName => $phaseData) {
- echo '' . $phaseName . '
';
+ echo ''.$phaseName.'
';
foreach ($phaseData as $class => $time) {
- echo $class . ': ' . $time . '
';
+ echo $class.': '.$time.'
';
}
echo '
';
}
diff --git a/examples/2.1.5.12-queryelevation.php b/examples/2.1.5.12-queryelevation.php
index 296e98513..4494a3892 100644
--- a/examples/2.1.5.12-queryelevation.php
+++ b/examples/2.1.5.12-queryelevation.php
@@ -1,6 +1,7 @@
setForceElevation(true);
// specify documents to elevate and/or exclude if you don't use an elevation file or want to override it at request time
-$elevate->setElevateIds(array('VS1GB400C3', 'VDBDB1A16'));
-$elevate->setExcludeIds(array('SP2514N', '6H500F0'));
+$elevate->setElevateIds(['VS1GB400C3', 'VDBDB1A16']);
+$elevate->setExcludeIds(['SP2514N', '6H500F0']);
// document transformers can be omitted from the results
-//$elevate->clearTransformers();
+// $elevate->clearTransformers();
// this executes the query and returns the result
$resultset = $client->select($query);
@@ -33,7 +34,6 @@
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -43,7 +43,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/2.1.5.13-rerankquery.php b/examples/2.1.5.13-rerankquery.php
index c01344108..0da169cd0 100644
--- a/examples/2.1.5.13-rerankquery.php
+++ b/examples/2.1.5.13-rerankquery.php
@@ -1,6 +1,7 @@
';
// the documents are also iterable, to get all fields
@@ -45,7 +45,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/2.1.5.14-termvector.php b/examples/2.1.5.14-termvector.php
index 89719d3c9..ab672716e 100644
--- a/examples/2.1.5.14-termvector.php
+++ b/examples/2.1.5.14-termvector.php
@@ -1,6 +1,7 @@
getTermVector();
foreach ($termVector as $key => $document) {
-
echo ''.$key.'
';
foreach ($document as $fieldName => $field) {
-
echo ''.$fieldName.'
';
foreach ($field as $term => $termInfo) {
-
echo '
'.$term.'
';
- echo '| Term frequency | ' . $termInfo['tf'] ?? '' . ' |
';
- echo '| Document frequency | ' . $termInfo['df'] ?? '' . ' |
';
- echo '| TF * IDF | ' . $termInfo['tf-idf'] ?? '' . ' |
';
+ echo '| Term frequency | '.$termInfo['tf'] ?? ''.' |
';
+ echo '| Document frequency | '.$termInfo['df'] ?? ''.' |
';
+ echo '| TF * IDF | '.$termInfo['tf-idf'] ?? ''.' |
';
echo '| Positions | ';
foreach ($termInfo['positions'] ?? [] as $position) {
- echo $position . ' ';
+ echo $position.' ';
}
echo ' |
';
echo '| Offsets | ';
foreach ($termInfo['offsets'] ?? [] as $offset) {
- echo 'start: '.$offset['start'] . ' ';
- echo 'end: '.$offset['end'] . ' ';
+ echo 'start: '.$offset['start'].' ';
+ echo 'end: '.$offset['end'].' ';
}
echo ' |
';
echo '| Payloads | ';
foreach ($termInfo['payloads'] ?? [] as $payload) {
- echo $payload . ' ';
+ echo $payload.' ';
}
echo ' |
';
diff --git a/examples/2.1.5.2-morelikethis.php b/examples/2.1.5.2-morelikethis.php
index 2e083590c..0dc955943 100644
--- a/examples/2.1.5.2-morelikethis.php
+++ b/examples/2.1.5.2-morelikethis.php
@@ -1,6 +1,7 @@
';
// the documents are also iterable, to get all fields
@@ -36,7 +36,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
MLT results:
';
@@ -48,7 +48,7 @@
echo 'NumFound: '.$mltResult->getNumFound().'
';
echo 'Num. fetched: '.count($mltResult).'
';
foreach ($mltResult as $mltDoc) {
- echo 'MLT result doc: '. $mltDoc->name . ' (id='. $mltDoc->id . ')
';
+ echo 'MLT result doc: '.$mltDoc->name.' (id='.$mltDoc->id.')
';
}
// available since Solr 8.2 if the query wasn't distributed
if (null !== $interestingTerms = $mlt->getInterestingTerm($document->id)) {
@@ -57,7 +57,6 @@
} else {
echo 'No MLT results';
}
-
}
htmlFooter();
diff --git a/examples/2.1.5.3-highlighting.php b/examples/2.1.5.3-highlighting.php
index e5d8b445e..465537cc6 100644
--- a/examples/2.1.5.3-highlighting.php
+++ b/examples/2.1.5.3-highlighting.php
@@ -1,6 +1,7 @@
';
// the documents are also iterable, to get all fields
@@ -34,7 +34,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
Highlighting results:
';
@@ -43,10 +43,9 @@
$highlightedDoc = $highlighting->getResult($document->id);
if ($highlightedDoc) {
foreach ($highlightedDoc as $field => $highlight) {
- echo implode(' (...) ', $highlight) . '
';
+ echo implode(' (...) ', $highlight).'
';
}
}
-
}
htmlFooter();
diff --git a/examples/2.1.5.3.1-per-field-highlighting.php b/examples/2.1.5.3.1-per-field-highlighting.php
index 84ab2f2a9..d23415b14 100644
--- a/examples/2.1.5.3.1-per-field-highlighting.php
+++ b/examples/2.1.5.3.1-per-field-highlighting.php
@@ -1,6 +1,7 @@
';
// the documents are also iterable, to get all fields
@@ -36,7 +36,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
Highlighting results:
';
@@ -45,10 +45,9 @@
$highlightedDoc = $highlighting->getResult($document->id);
if ($highlightedDoc) {
foreach ($highlightedDoc as $field => $highlight) {
- echo implode(' (...) ', $highlight) . '
';
+ echo implode(' (...) ', $highlight).'
';
}
}
-
}
htmlFooter();
diff --git a/examples/2.1.5.4-dismax.php b/examples/2.1.5.4-dismax.php
index 37befdc6c..245f207e4 100644
--- a/examples/2.1.5.4-dismax.php
+++ b/examples/2.1.5.4-dismax.php
@@ -1,6 +1,7 @@
';
// the documents are also iterable, to get all fields
@@ -34,7 +34,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/2.1.5.5-edismax.php b/examples/2.1.5.5-edismax.php
index 28952aa1f..7ec18ddd8 100644
--- a/examples/2.1.5.5-edismax.php
+++ b/examples/2.1.5.5-edismax.php
@@ -1,6 +1,7 @@
';
// the documents are also iterable, to get all fields
@@ -33,7 +33,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/2.1.5.6-grouping-by-field.php b/examples/2.1.5.6-grouping-by-field.php
index 6b742084f..a511520ef 100644
--- a/examples/2.1.5.6-grouping-by-field.php
+++ b/examples/2.1.5.6-grouping-by-field.php
@@ -1,6 +1,7 @@
getGrouping();
foreach ($groups as $groupKey => $fieldGroup) {
-
echo ''.$groupKey.'
';
echo 'Matches: '.$fieldGroup->getMatches().'
';
echo 'Number of groups: '.$fieldGroup->getNumberOfGroups();
foreach ($fieldGroup as $valueGroup) {
-
$value = $valueGroup->getValue();
echo ''.(null !== $value ? (int) $value : 'NULL').'
';
foreach ($valueGroup as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -44,7 +42,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/2.1.5.7-grouping-by-query.php b/examples/2.1.5.7-grouping-by-query.php
index da9d42726..ee15c8b43 100644
--- a/examples/2.1.5.7-grouping-by-query.php
+++ b/examples/2.1.5.7-grouping-by-query.php
@@ -1,6 +1,7 @@
getGrouping();
foreach ($groups as $groupKey => $group) {
-
echo ''.$groupKey.'
';
foreach ($group as $document) {
@@ -36,7 +36,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/2.1.5.8-distributed-search.php b/examples/2.1.5.8-distributed-search.php
index 1026cf837..519169404 100644
--- a/examples/2.1.5.8-distributed-search.php
+++ b/examples/2.1.5.8-distributed-search.php
@@ -1,6 +1,7 @@
Note: The techproducts isn't distributed by default!";
@@ -25,7 +26,6 @@
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -35,7 +35,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/2.1.5.9-spellcheck.php b/examples/2.1.5.9-spellcheck.php
index df3c68602..f3c8d1367 100644
--- a/examples/2.1.5.9-spellcheck.php
+++ b/examples/2.1.5.9-spellcheck.php
@@ -1,6 +1,7 @@
getHits().'
';
echo 'Corrections:
';
foreach ($collation->getCorrections() as $input => $correction) {
- echo $input . ' => ' . $correction .'
';
+ echo $input.' => '.$correction.'
';
}
echo '
';
}
diff --git a/examples/2.1.6-helper-functions.php b/examples/2.1.6-helper-functions.php
index 9094cb082..fe21a2617 100644
--- a/examples/2.1.6-helper-functions.php
+++ b/examples/2.1.6-helper-functions.php
@@ -1,6 +1,7 @@
createFilterQuery('price')->setQuery($helper->rangeQuery('price', 10, 300));
// add a filterquery to find products in a range of 5km, using the helper to generate the 'geofilt' filter
-$query->createFilterQuery('region')->setQuery($helper->geofilt('store',45.15, -93.85, 5));
+$query->createFilterQuery('region')->setQuery($helper->geofilt('store', 45.15, -93.85, 5));
// this executes the query and returns the result
$resultset = $client->select($query);
@@ -24,7 +25,6 @@
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -34,7 +34,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/2.1.7-query-reuse.php b/examples/2.1.7-query-reuse.php
index dacde1fc1..3d6a02cb8 100644
--- a/examples/2.1.7-query-reuse.php
+++ b/examples/2.1.7-query-reuse.php
@@ -1,15 +1,15 @@
setStart(2)->setRows(20);
// set fields to fetch (this overrides the default setting 'all fields')
- $this->setFields(array('id','name','price'));
+ $this->setFields(['id', 'name', 'price']);
// sort the results by price ascending
$this->addSort('price', self::SORT_ASC);
@@ -60,7 +60,6 @@ protected function init(): void
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -70,7 +69,7 @@ protected function init(): void
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/2.10.1-managedresources-resources.php b/examples/2.10.1-managedresources-resources.php
index c012ae1c1..3d408ff7f 100644
--- a/examples/2.10.1-managedresources-resources.php
+++ b/examples/2.10.1-managedresources-resources.php
@@ -1,6 +1,7 @@
';
- echo '| Resource ID | ' . $resource->getResourceId() . ' |
';
- echo '| Number of Observers | ' . $resource->getNumObservers() . ' |
';
- echo '| Class | ' . $resource->getClass() . ' |
';
+ echo '| Resource ID | '.$resource->getResourceId().' |
';
+ echo '| Number of Observers | '.$resource->getNumObservers().' |
';
+ echo '| Class | '.$resource->getClass().' |
';
echo '
';
}
diff --git a/examples/2.10.2-managedresources-stopwords.php b/examples/2.10.2-managedresources-stopwords.php
index e6f3dfdfa..0fba5c1fc 100644
--- a/examples/2.10.2-managedresources-stopwords.php
+++ b/examples/2.10.2-managedresources-stopwords.php
@@ -1,6 +1,7 @@
execute($query);
// display list properties
-echo 'Case sensitive: ' . ($result->isIgnoreCase() ? 'no' : 'yes') . '
';
-echo 'Initialized on: ' . $result->getInitializedOn() . '
';
-echo 'Updated since init: ' . $result->getUpdatedSinceInit() . '
';
+echo 'Case sensitive: '.($result->isIgnoreCase() ? 'no' : 'yes').'
';
+echo 'Initialized on: '.$result->getInitializedOn().'
';
+echo 'Updated since init: '.$result->getUpdatedSinceInit().'
';
// display stopwords
-echo 'Number of stopwords: ' . count($result) . '
';
+echo 'Number of stopwords: '.count($result).'
';
echo 'Stopwords:
';
echo implode(', ', $result->getItems());
echo '
';
@@ -47,7 +48,7 @@
$result = $client->execute($query);
// display the result
- echo '' . $name . ': ' . ($result->getWasSuccessful() ? 'exists' : 'doesn\'t exist') . '
';
+ echo ''.$name.': '.($result->getWasSuccessful() ? 'exists' : 'doesn\'t exist').'
';
}
echo 'Create list
';
@@ -156,7 +157,7 @@
$result = $client->execute($query);
// display the result
- echo '' . $term . ': ' . ($result->getWasSuccessful() ? 'exists' : 'doesn\'t exist') . '
';
+ echo ''.$term.': '.($result->getWasSuccessful() ? 'exists' : 'doesn\'t exist').'
';
}
echo 'Add stopwords
';
diff --git a/examples/2.10.3-managedresources-synonyms.php b/examples/2.10.3-managedresources-synonyms.php
index 61edc98a3..321b70c15 100644
--- a/examples/2.10.3-managedresources-synonyms.php
+++ b/examples/2.10.3-managedresources-synonyms.php
@@ -2,7 +2,8 @@
use Solarium\QueryType\ManagedResources\Query\Synonyms\Synonyms;
-require_once(__DIR__.'/init.php');
+require_once __DIR__.'/init.php';
+
htmlHeader();
// create a client instance
@@ -22,18 +23,18 @@
$result = $client->execute($query);
// display list properties
-echo 'Case sensitive: ' . ($result->isIgnoreCase() ? 'no' : 'yes') . '
';
-echo 'Format: ' . $result->getFormat() . '
';
-echo 'Initialized on: ' . $result->getInitializedOn() . '
';
-echo 'Updated since init: ' . $result->getUpdatedSinceInit() . '
';
+echo 'Case sensitive: '.($result->isIgnoreCase() ? 'no' : 'yes').'
';
+echo 'Format: '.$result->getFormat().'
';
+echo 'Initialized on: '.$result->getInitializedOn().'
';
+echo 'Updated since init: '.$result->getUpdatedSinceInit().'
';
// display synonyms
-echo 'Number of synonym mappings: ' . count($result) . '
';
+echo 'Number of synonym mappings: '.count($result).'
';
echo 'Synonym mappings:
';
echo '';
foreach ($result as $synonym) {
- echo '| ' . $synonym->getTerm() . ' | ' . implode(', ', $synonym->getSynonyms()) . ' |
';
+ echo '| '.$synonym->getTerm().' | '.implode(', ', $synonym->getSynonyms()).' |
';
}
echo '
';
@@ -55,7 +56,7 @@
$result = $client->execute($query);
// display the result
- echo '' . $name . ': ' . ($result->getWasSuccessful() ? 'exists' : 'doesn\'t exist') . '
';
+ echo ''.$name.': '.($result->getWasSuccessful() ? 'exists' : 'doesn\'t exist').'
';
}
echo 'Create list
';
@@ -142,7 +143,7 @@
// display synonym, there will be only one
foreach ($result as $synonym) {
- echo '' . $synonym->getTerm() . ': ' . implode(', ', $synonym->getSynonyms());
+ echo ''.$synonym->getTerm().': '.implode(', ', $synonym->getSynonyms()).'
';
}
echo 'Check synonym mapping existence
';
@@ -165,7 +166,7 @@
$result = $client->execute($query);
// display the result
- echo '' . $term . ': ' . ($result->getWasSuccessful() ? 'exists' : 'doesn\'t exist') . '
';
+ echo ''.$term.': '.($result->getWasSuccessful() ? 'exists' : 'doesn\'t exist').'
';
}
echo 'Add single synonym mapping
';
diff --git a/examples/2.11.1-luke-query-index.php b/examples/2.11.1-luke-query-index.php
index 44854b651..2ea96f839 100644
--- a/examples/2.11.1-luke-query-index.php
+++ b/examples/2.11.1-luke-query-index.php
@@ -1,6 +1,7 @@
index';
echo '';
-echo '| numDocs | ' . $index->getNumDocs() . ' |
';
-echo '| maxDoc | ' . $index->getMaxDoc() . ' |
';
-echo '| deletedDocs | ' . $index->getDeletedDocs() . ' |
';
-echo '| indexHeapUsageBytes | ' . ($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)') . ' |
';
-echo '| version | ' . $index->getVersion() . ' |
';
-echo '| segmentCount | ' . $index->getSegmentCount() . ' |
';
-echo '| current | ' . ($index->getCurrent() ? 'true' : 'false') . ' |
';
-echo '| hasDeletions | ' . ($index->getHasDeletions() ? 'true' : 'false') . ' |
';
-echo '| directory | ' . $index->getDirectory() . ' |
';
-echo '| segmentsFile | ' . $index->getSegmentsFile() . ' |
';
-echo '| segmentsFileSizeInBytes | ' . $index->getSegmentsFileSizeInBytes() . ' |
';
+echo '| numDocs | '.$index->getNumDocs().' |
';
+echo '| maxDoc | '.$index->getMaxDoc().' |
';
+echo '| deletedDocs | '.$index->getDeletedDocs().' |
';
+echo '| indexHeapUsageBytes | '.($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)').' |
';
+echo '| version | '.$index->getVersion().' |
';
+echo '| segmentCount | '.$index->getSegmentCount().' |
';
+echo '| current | '.($index->getCurrent() ? 'true' : 'false').' |
';
+echo '| hasDeletions | '.($index->getHasDeletions() ? 'true' : 'false').' |
';
+echo '| directory | '.$index->getDirectory().' |
';
+echo '| segmentsFile | '.$index->getSegmentsFile().' |
';
+echo '| segmentsFileSizeInBytes | '.$index->getSegmentsFileSizeInBytes().' |
';
$userData = $index->getUserData();
echo '| userData | ';
if (null !== $userData->getCommitCommandVer()) {
- echo 'commitCommandVer: ' . $userData->getCommitCommandVer() . ' ';
+ echo 'commitCommandVer: '.$userData->getCommitCommandVer().' ';
}
if (null !== $userData->getCommitTimeMSec()) {
- echo 'commitTimeMSec: ' . $userData->getCommitTimeMSec() . ' ';
+ echo 'commitTimeMSec: '.$userData->getCommitTimeMSec().' ';
}
echo ' |
';
if (null !== $index->getLastModified()) {
- echo '| lastModified | ' . $index->getLastModified()->format(DATE_RFC3339_EXTENDED) . ' |
';
+ echo '| lastModified | '.$index->getLastModified()->format(DATE_RFC3339_EXTENDED).' |
';
}
echo '
';
diff --git a/examples/2.11.2-luke-query-all-fields.php b/examples/2.11.2-luke-query-all-fields.php
index 3421252f7..c304f187e 100644
--- a/examples/2.11.2-luke-query-all-fields.php
+++ b/examples/2.11.2-luke-query-all-fields.php
@@ -1,6 +1,7 @@
setShow($lukeQuery::SHOW_ALL);
// omitting index flags for each field can speed up Luke requests
-//$lukeQuery->setIncludeIndexFieldFlags(false);
+// $lukeQuery->setIncludeIndexFieldFlags(false);
$result = $client->luke($lukeQuery);
@@ -22,30 +23,30 @@
echo 'index
';
echo '';
-echo '| numDocs | ' . $index->getNumDocs() . ' |
';
-echo '| maxDoc | ' . $index->getMaxDoc() . ' |
';
-echo '| deletedDocs | ' . $index->getDeletedDocs() . ' |
';
-echo '| indexHeapUsageBytes | ' . ($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)') . ' |
';
-echo '| version | ' . $index->getVersion() . ' |
';
-echo '| segmentCount | ' . $index->getSegmentCount() . ' |
';
-echo '| current | ' . ($index->getCurrent() ? 'true' : 'false') . ' |
';
-echo '| hasDeletions | ' . ($index->getHasDeletions() ? 'true' : 'false') . ' |
';
-echo '| directory | ' . $index->getDirectory() . ' |
';
-echo '| segmentsFile | ' . $index->getSegmentsFile() . ' |
';
-echo '| segmentsFileSizeInBytes | ' . $index->getSegmentsFileSizeInBytes() . ' |
';
+echo '| numDocs | '.$index->getNumDocs().' |
';
+echo '| maxDoc | '.$index->getMaxDoc().' |
';
+echo '| deletedDocs | '.$index->getDeletedDocs().' |
';
+echo '| indexHeapUsageBytes | '.($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)').' |
';
+echo '| version | '.$index->getVersion().' |
';
+echo '| segmentCount | '.$index->getSegmentCount().' |
';
+echo '| current | '.($index->getCurrent() ? 'true' : 'false').' |
';
+echo '| hasDeletions | '.($index->getHasDeletions() ? 'true' : 'false').' |
';
+echo '| directory | '.$index->getDirectory().' |
';
+echo '| segmentsFile | '.$index->getSegmentsFile().' |
';
+echo '| segmentsFileSizeInBytes | '.$index->getSegmentsFileSizeInBytes().' |
';
$userData = $index->getUserData();
echo '| userData | ';
if (null !== $userData->getCommitCommandVer()) {
- echo 'commitCommandVer: ' . $userData->getCommitCommandVer() . ' ';
+ echo 'commitCommandVer: '.$userData->getCommitCommandVer().' ';
}
if (null !== $userData->getCommitTimeMSec()) {
- echo 'commitTimeMSec: ' . $userData->getCommitTimeMSec() . ' ';
+ echo 'commitTimeMSec: '.$userData->getCommitTimeMSec().' ';
}
echo ' |
';
if (null !== $index->getLastModified()) {
- echo '| lastModified | ' . $index->getLastModified()->format(DATE_RFC3339_EXTENDED) . ' |
';
+ echo '| lastModified | '.$index->getLastModified()->format(DATE_RFC3339_EXTENDED).' |
';
}
echo '
';
@@ -63,17 +64,17 @@
echo '';
foreach ($fields as $field) {
echo '';
- echo '| ' . $field->getName() . ' | ' . $field->getType() . ' | ' . $field->getSchema() . ' | ';
- echo '' . ($field->getSchema()->isIndexed() ? '⚐' : '') . ' | ' . ($field->getSchema()->isTokenized() ? '⚐' : '') . ' | ' . ($field->getSchema()->isStored() ? '⚐' : '') . ' | ' . ($field->getSchema()->isDocValues() ? '⚐' : '') . ' | ';
- echo '' . $field->getDynamicBase() . ' | ' . $field->getIndex() . ' | ';
+ echo ''.$field->getName().' | '.$field->getType().' | '.$field->getSchema().' | ';
+ echo ''.($field->getSchema()->isIndexed() ? '⚐' : '').' | '.($field->getSchema()->isTokenized() ? '⚐' : '').' | '.($field->getSchema()->isStored() ? '⚐' : '').' | '.($field->getSchema()->isDocValues() ? '⚐' : '').' | ';
+ echo ''.$field->getDynamicBase().' | '.$field->getIndex().' | ';
// some fields have '(unstored field)' or no index flags at all in the result
// and with $lukeQuery->setIncludeIndexFieldFlags(false), index flags are omitted for each field
if (is_object($field->getIndex())) {
- echo '' . ($field->getIndex()->isTokenized() ? '⚐' : '') . ' | ' . ($field->getIndex()->isTermVectors() ? '⚐' : '') . ' | ' . ($field->getIndex()->isOmitNorms() ? '⚐' : '') . ' | ';
+ echo ''.($field->getIndex()->isTokenized() ? '⚐' : '').' | '.($field->getIndex()->isTermVectors() ? '⚐' : '').' | '.($field->getIndex()->isOmitNorms() ? '⚐' : '').' | ';
} else {
echo ' | | | ';
}
- echo '' . $field->getDocs() . ' | ';
+ echo ''.$field->getDocs().' | ';
echo '
';
}
echo '';
@@ -85,10 +86,10 @@
echo '';
echo '| key | ';
foreach ($info->getKey() as $abbreviation => $flag) {
- echo $abbreviation . ': ' . $flag . ' ';
+ echo $abbreviation.': '.$flag.' ';
}
echo ' |
';
-echo '| NOTE | ' . $info->getNote() . ' |
';
+echo '| NOTE | '.$info->getNote().' |
';
echo '
';
htmlFooter();
diff --git a/examples/2.11.2.1-luke-query-field-details.php b/examples/2.11.2.1-luke-query-field-details.php
index eb59515ab..0025d7cfe 100644
--- a/examples/2.11.2.1-luke-query-field-details.php
+++ b/examples/2.11.2.1-luke-query-field-details.php
@@ -1,6 +1,7 @@
Note: Use with caution especially on large indexes!';
@@ -15,10 +16,10 @@
$lukeQuery->setFields('text,cat,price_c');
// you can also get detailed information for all fields
-//$lukeQuery->setFields('*');
+// $lukeQuery->setFields('*');
// omitting index flags for each field can speed up Luke requests
-//$lukeQuery->setIncludeIndexFieldFlags(false);
+// $lukeQuery->setIncludeIndexFieldFlags(false);
// set the number of top terms for each field (Solr's default is 10)
$lukeQuery->setNumTerms(5);
@@ -32,30 +33,30 @@
echo 'index
';
echo '';
-echo '| numDocs | ' . $index->getNumDocs() . ' |
';
-echo '| maxDoc | ' . $index->getMaxDoc() . ' |
';
-echo '| deletedDocs | ' . $index->getDeletedDocs() . ' |
';
-echo '| indexHeapUsageBytes | ' . ($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)') . ' |
';
-echo '| version | ' . $index->getVersion() . ' |
';
-echo '| segmentCount | ' . $index->getSegmentCount() . ' |
';
-echo '| current | ' . ($index->getCurrent() ? 'true' : 'false') . ' |
';
-echo '| hasDeletions | ' . ($index->getHasDeletions() ? 'true' : 'false') . ' |
';
-echo '| directory | ' . $index->getDirectory() . ' |
';
-echo '| segmentsFile | ' . $index->getSegmentsFile() . ' |
';
-echo '| segmentsFileSizeInBytes | ' . $index->getSegmentsFileSizeInBytes() . ' |
';
+echo '| numDocs | '.$index->getNumDocs().' |
';
+echo '| maxDoc | '.$index->getMaxDoc().' |
';
+echo '| deletedDocs | '.$index->getDeletedDocs().' |
';
+echo '| indexHeapUsageBytes | '.($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)').' |
';
+echo '| version | '.$index->getVersion().' |
';
+echo '| segmentCount | '.$index->getSegmentCount().' |
';
+echo '| current | '.($index->getCurrent() ? 'true' : 'false').' |
';
+echo '| hasDeletions | '.($index->getHasDeletions() ? 'true' : 'false').' |
';
+echo '| directory | '.$index->getDirectory().' |
';
+echo '| segmentsFile | '.$index->getSegmentsFile().' |
';
+echo '| segmentsFileSizeInBytes | '.$index->getSegmentsFileSizeInBytes().' |
';
$userData = $index->getUserData();
echo '| userData | ';
if (null !== $userData->getCommitCommandVer()) {
- echo 'commitCommandVer: ' . $userData->getCommitCommandVer() . ' ';
+ echo 'commitCommandVer: '.$userData->getCommitCommandVer().' ';
}
if (null !== $userData->getCommitTimeMSec()) {
- echo 'commitTimeMSec: ' . $userData->getCommitTimeMSec() . ' ';
+ echo 'commitTimeMSec: '.$userData->getCommitTimeMSec().' ';
}
echo ' |
';
if (null !== $index->getLastModified()) {
- echo '| lastModified | ' . $index->getLastModified()->format(DATE_RFC3339_EXTENDED) . ' |
';
+ echo '| lastModified | '.$index->getLastModified()->format(DATE_RFC3339_EXTENDED).' |
';
}
echo '
';
@@ -64,17 +65,17 @@
echo 'fields
';
foreach ($fields as $field) {
- echo '' . $field . '
';
+ echo ''.$field.'
';
echo '';
- echo '| type | ' . $field->getType() . ' |
';
+ echo '| type | '.$field->getType().' |
';
echo '| schema | ';
foreach ($field->getSchema() as $flag) {
- echo $flag . ' ';
+ echo $flag.' ';
}
echo ' |
';
if (null !== $field->getDynamicBase()) {
- echo '| dynamicBase | ' . $field->getDynamicBase() . ' |
';
+ echo '| dynamicBase | '.$field->getDynamicBase().' |
';
}
// some fields don't have index flags in the result (with $lukeQuery->setIncludeIndexFieldFlags(false), none of the fields have)
if (null !== $field->getIndex()) {
@@ -82,7 +83,7 @@
// some fields have '(unstored field)' in the result instead of flags
if (is_object($field->getIndex())) {
foreach ($field->getIndex() as $flag) {
- echo $flag . '
';
+ echo $flag.'
';
}
} else {
echo $field->getIndex();
@@ -90,22 +91,22 @@
echo '';
}
if (null !== $field->getDocs()) {
- echo '| docs | ' . $field->getDocs() . ' |
';
+ echo '| docs | '.$field->getDocs().' |
';
}
if (null !== $field->getDistinct()) {
- echo '| distinct | ' . $field->getDistinct() . ' |
';
+ echo '| distinct | '.$field->getDistinct().' |
';
}
if (null !== $field->getTopTerms()) {
echo '| topTerms | ';
foreach ($field->getTopTerms() as $term => $frequency) {
- echo $term . ': ' . $frequency . ' ';
+ echo $term.': '.$frequency.' ';
}
echo ' |
';
}
if (null !== $field->getHistogram()) {
echo '| histogram | ';
foreach ($field->getHistogram() as $bucket => $frequency) {
- echo $bucket . ': ' . $frequency . ' ';
+ echo $bucket.': '.$frequency.' ';
}
echo ' |
';
}
@@ -119,10 +120,10 @@
echo '';
echo '| key | ';
foreach ($info->getKey() as $abbreviation => $flag) {
- echo $abbreviation . ': ' . $flag . ' ';
+ echo $abbreviation.': '.$flag.' ';
}
echo ' |
';
-echo '| NOTE | ' . $info->getNote() . ' |
';
+echo '| NOTE | '.$info->getNote().' |
';
echo '
';
htmlFooter();
diff --git a/examples/2.11.3-luke-query-schema.php b/examples/2.11.3-luke-query-schema.php
index f062ce1c8..e6d3b9d05 100644
--- a/examples/2.11.3-luke-query-schema.php
+++ b/examples/2.11.3-luke-query-schema.php
@@ -2,7 +2,8 @@
use Solarium\Support\Utility;
-require_once(__DIR__.'/init.php');
+require_once __DIR__.'/init.php';
+
htmlHeader();
// create a client instance
@@ -21,30 +22,30 @@
echo 'index
';
echo '';
-echo '| numDocs | ' . $index->getNumDocs() . ' |
';
-echo '| maxDoc | ' . $index->getMaxDoc() . ' |
';
-echo '| deletedDocs | ' . $index->getDeletedDocs() . ' |
';
-echo '| indexHeapUsageBytes | ' . ($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)') . ' |
';
-echo '| version | ' . $index->getVersion() . ' |
';
-echo '| segmentCount | ' . $index->getSegmentCount() . ' |
';
-echo '| current | ' . ($index->getCurrent() ? 'true' : 'false') . ' |
';
-echo '| hasDeletions | ' . ($index->getHasDeletions() ? 'true' : 'false') . ' |
';
-echo '| directory | ' . $index->getDirectory() . ' |
';
-echo '| segmentsFile | ' . $index->getSegmentsFile() . ' |
';
-echo '| segmentsFileSizeInBytes | ' . $index->getSegmentsFileSizeInBytes() . ' |
';
+echo '| numDocs | '.$index->getNumDocs().' |
';
+echo '| maxDoc | '.$index->getMaxDoc().' |
';
+echo '| deletedDocs | '.$index->getDeletedDocs().' |
';
+echo '| indexHeapUsageBytes | '.($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)').' |
';
+echo '| version | '.$index->getVersion().' |
';
+echo '| segmentCount | '.$index->getSegmentCount().' |
';
+echo '| current | '.($index->getCurrent() ? 'true' : 'false').' |
';
+echo '| hasDeletions | '.($index->getHasDeletions() ? 'true' : 'false').' |
';
+echo '| directory | '.$index->getDirectory().' |
';
+echo '| segmentsFile | '.$index->getSegmentsFile().' |
';
+echo '| segmentsFileSizeInBytes | '.$index->getSegmentsFileSizeInBytes().' |
';
$userData = $index->getUserData();
echo '| userData | ';
if (null !== $userData->getCommitCommandVer()) {
- echo 'commitCommandVer: ' . $userData->getCommitCommandVer() . ' ';
+ echo 'commitCommandVer: '.$userData->getCommitCommandVer().' ';
}
if (null !== $userData->getCommitTimeMSec()) {
- echo 'commitTimeMSec: ' . $userData->getCommitTimeMSec() . ' ';
+ echo 'commitTimeMSec: '.$userData->getCommitTimeMSec().' ';
}
echo ' |
';
if (null !== $index->getLastModified()) {
- echo '| lastModified | ' . $index->getLastModified()->format(DATE_RFC3339_EXTENDED) . ' |
';
+ echo '| lastModified | '.$index->getLastModified()->format(DATE_RFC3339_EXTENDED).' |
';
}
echo '
';
@@ -63,10 +64,10 @@
echo '';
foreach ($schema->getFields() as $field) {
echo '';
- echo '| ' . $field->getName() . ' | ' . $field->getType() . ' | ' . $field->getFlags() . ' | ';
- echo '' . ($field->getFlags()->isIndexed() ? '⚐' : '') . ' | ' . ($field->getFlags()->isTokenized() ? '⚐' : '') . ' | ' . ($field->getFlags()->isStored() ? '⚐' : '') . ' | ' . ($field->getFlags()->isDocValues() ? '⚐' : '') . ' | ';
- echo '' . ($field->isRequired() ? '✓' : '') . ' | ' . $field->getDefault() . ' | ' . ($field->isUniqueKey() ? '✓' : '') . ' | ' . $field->getPositionIncrementGap() . ' | ';
- echo '' . implode(', ', $field->getCopyDests()) . ' | ' . implode(', ', $field->getCopySources()) . ' | ';
+ echo ''.$field->getName().' | '.$field->getType().' | '.$field->getFlags().' | ';
+ echo ''.($field->getFlags()->isIndexed() ? '⚐' : '').' | '.($field->getFlags()->isTokenized() ? '⚐' : '').' | '.($field->getFlags()->isStored() ? '⚐' : '').' | '.($field->getFlags()->isDocValues() ? '⚐' : '').' | ';
+ echo ''.($field->isRequired() ? '✓' : '').' | '.$field->getDefault().' | '.($field->isUniqueKey() ? '✓' : '').' | '.$field->getPositionIncrementGap().' | ';
+ echo ''.implode(', ', $field->getCopyDests()).' | '.implode(', ', $field->getCopySources()).' | ';
echo '
';
}
echo '
';
@@ -82,10 +83,10 @@
echo '';
foreach ($schema->getDynamicFields() as $field) {
echo '';
- echo '| ' . $field->getName() . ' | ' . $field->getType() . ' | ' . $field->getFlags() . ' | ';
- echo '' . ($field->getFlags()->isMultiValued() ? '⚐' : '') . ' | ' . ($field->getFlags()->isOmitNorms() ? '⚐' : '') . ' | ' . ($field->getFlags()->isSortMissingFirst() ? '⚐' : '') . ' | ' . ($field->getFlags()->isSortMissingLast() ? '⚐' : '') . ' | ';
- echo '' . $field->getPositionIncrementGap() . ' | ';
- echo '' . implode(', ', $field->getCopyDests()) . ' | ' . implode(', ', $field->getCopySources()) . ' | ';
+ echo ''.$field->getName().' | '.$field->getType().' | '.$field->getFlags().' | ';
+ echo ''.($field->getFlags()->isMultiValued() ? '⚐' : '').' | '.($field->getFlags()->isOmitNorms() ? '⚐' : '').' | '.($field->getFlags()->isSortMissingFirst() ? '⚐' : '').' | '.($field->getFlags()->isSortMissingLast() ? '⚐' : '').' | ';
+ echo ''.$field->getPositionIncrementGap().' | ';
+ echo ''.implode(', ', $field->getCopyDests()).' | '.implode(', ', $field->getCopySources()).' | ';
echo '
';
}
echo '';
@@ -103,8 +104,8 @@
$similarity = $schema->getSimilarity();
echo '';
-echo '| className | ' . $similarity->getClassName() . ' |
';
-echo '| details | ' . $similarity->getDetails() . ' |
';
+echo '| className | '.$similarity->getClassName().' |
';
+echo '| details | '.$similarity->getDetails().' |
';
echo '
';
echo 'types
';
@@ -116,8 +117,8 @@
echo '';
foreach ($schema->getTypes() as $type) {
echo '';
- echo '| ' . $type->getName() . ' | ' . implode(', ', $type->getFields()) . ' | ' . ($type->isTokenized() ? '✓' : '') . ' | ' . Utility::compactSolrClassName($type->getClassName()) . ' | ';
- echo '' . Utility::compactSolrClassName($type->getIndexAnalyzer()) . ' | ' . Utility::compactSolrClassName($type->getQueryAnalyzer()) . ' | ' . Utility::compactSolrClassName($type->getSimilarity()) . ' | ';
+ echo ''.$type->getName().' | '.implode(', ', $type->getFields()).' | '.($type->isTokenized() ? '✓' : '').' | '.Utility::compactSolrClassName($type->getClassName()).' | ';
+ echo ''.Utility::compactSolrClassName($type->getIndexAnalyzer()).' | '.Utility::compactSolrClassName($type->getQueryAnalyzer()).' | '.Utility::compactSolrClassName($type->getSimilarity()).' | ';
echo '
';
}
echo '';
@@ -129,10 +130,10 @@
echo '';
echo '| key | ';
foreach ($info->getKey() as $abbreviation => $flag) {
- echo $abbreviation . ': ' . $flag . ' ';
+ echo $abbreviation.': '.$flag.' ';
}
echo ' |
';
-echo '| NOTE | ' . $info->getNote() . ' |
';
+echo '| NOTE | '.$info->getNote().' |
';
echo '
';
htmlFooter();
diff --git a/examples/2.11.4-luke-query-doc.php b/examples/2.11.4-luke-query-doc.php
index e09d6d1b3..665596a0f 100644
--- a/examples/2.11.4-luke-query-doc.php
+++ b/examples/2.11.4-luke-query-doc.php
@@ -1,6 +1,7 @@
setId('9885A004');
// alternatively, you can use a Lucene documentID
-//$lukeQuery->setDocId(27);
+// $lukeQuery->setDocId(27);
$result = $client->luke($lukeQuery);
@@ -25,30 +26,30 @@
echo 'index
';
echo '';
-echo '| numDocs | ' . $index->getNumDocs() . ' |
';
-echo '| maxDoc | ' . $index->getMaxDoc() . ' |
';
-echo '| deletedDocs | ' . $index->getDeletedDocs() . ' |
';
-echo '| indexHeapUsageBytes | ' . ($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)') . ' |
';
-echo '| version | ' . $index->getVersion() . ' |
';
-echo '| segmentCount | ' . $index->getSegmentCount() . ' |
';
-echo '| current | ' . ($index->getCurrent() ? 'true' : 'false') . ' |
';
-echo '| hasDeletions | ' . ($index->getHasDeletions() ? 'true' : 'false') . ' |
';
-echo '| directory | ' . $index->getDirectory() . ' |
';
-echo '| segmentsFile | ' . $index->getSegmentsFile() . ' |
';
-echo '| segmentsFileSizeInBytes | ' . $index->getSegmentsFileSizeInBytes() . ' |
';
+echo '| numDocs | '.$index->getNumDocs().' |
';
+echo '| maxDoc | '.$index->getMaxDoc().' |
';
+echo '| deletedDocs | '.$index->getDeletedDocs().' |
';
+echo '| indexHeapUsageBytes | '.($index->getIndexHeapUsageBytes() ?? '(not supported by this version of Solr)').' |
';
+echo '| version | '.$index->getVersion().' |
';
+echo '| segmentCount | '.$index->getSegmentCount().' |
';
+echo '| current | '.($index->getCurrent() ? 'true' : 'false').' |
';
+echo '| hasDeletions | '.($index->getHasDeletions() ? 'true' : 'false').' |
';
+echo '| directory | '.$index->getDirectory().' |
';
+echo '| segmentsFile | '.$index->getSegmentsFile().' |
';
+echo '| segmentsFileSizeInBytes | '.$index->getSegmentsFileSizeInBytes().' |
';
$userData = $index->getUserData();
echo '| userData | ';
if (null !== $userData->getCommitCommandVer()) {
- echo 'commitCommandVer: ' . $userData->getCommitCommandVer() . ' ';
+ echo 'commitCommandVer: '.$userData->getCommitCommandVer().' ';
}
if (null !== $userData->getCommitTimeMSec()) {
- echo 'commitTimeMSec: ' . $userData->getCommitTimeMSec() . ' ';
+ echo 'commitTimeMSec: '.$userData->getCommitTimeMSec().' ';
}
echo ' |
';
if (null !== $index->getLastModified()) {
- echo '| lastModified | ' . $index->getLastModified()->format(DATE_RFC3339_EXTENDED) . ' |
';
+ echo '| lastModified | '.$index->getLastModified()->format(DATE_RFC3339_EXTENDED).' |
';
}
echo '
';
@@ -59,7 +60,7 @@
echo 'docId
';
echo '';
-echo '| Lucene documentID | ' . $docInfo->getDocId() . ' |
';
+echo '| Lucene documentID | '.$docInfo->getDocId().' |
';
echo '
';
echo 'lucene
';
@@ -74,14 +75,14 @@
echo '';
foreach ($docInfo->getLucene() as $field) {
echo '';
- echo '| ' . $field->getName() . ' | ' . $field->getType() . ' | ' . $field->getSchema() . ' | ';
- echo '' . ($field->getSchema()->isIndexed() ? '⚐' : '') . ' | ' . ($field->getSchema()->isTokenized() ? '⚐' : '') . ' | ' . ($field->getSchema()->isStored() ? '⚐' : '') . ' | ' . ($field->getSchema()->isDocValues() ? '⚐' : '') . ' | ';
- echo '' . $field->getFlags() . ' | ';
- echo '' . ($field->getFlags()->isIndexed() ? '⚐' : '') . ' | ' . ($field->getFlags()->isOmitNorms() ? '⚐' : '') . ' | ' . ($field->getFlags()->isOmitTermFreqAndPositions() ? '⚐' : '') . ' | ';
- echo '' . $field->getValue() . ' | ' . $field->getDocFreq() . ' | ';
+ echo ' | '.$field->getName().' | '.$field->getType().' | '.$field->getSchema().' | ';
+ echo ''.($field->getSchema()->isIndexed() ? '⚐' : '').' | '.($field->getSchema()->isTokenized() ? '⚐' : '').' | '.($field->getSchema()->isStored() ? '⚐' : '').' | '.($field->getSchema()->isDocValues() ? '⚐' : '').' | ';
+ echo ''.$field->getFlags().' | ';
+ echo ''.($field->getFlags()->isIndexed() ? '⚐' : '').' | '.($field->getFlags()->isOmitNorms() ? '⚐' : '').' | '.($field->getFlags()->isOmitTermFreqAndPositions() ? '⚐' : '').' | ';
+ echo ''.$field->getValue().' | '.$field->getDocFreq().' | ';
if (null !== $termVector = $field->getTermVector()) {
foreach ($termVector as $term => $frequency) {
- echo $term . ': ' . $frequency . ' ';
+ echo $term.': '.$frequency.' ';
}
}
echo ' | ';
@@ -97,7 +98,7 @@
$value = implode(', ', $value);
}
- echo '
| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '';
@@ -108,10 +109,10 @@
echo '';
echo '| key | ';
foreach ($info->getKey() as $abbreviation => $flag) {
- echo $abbreviation . ': ' . $flag . ' ';
+ echo $abbreviation.': '.$flag.' ';
}
echo ' |
';
-echo '| NOTE | ' . $info->getNote() . ' |
';
+echo '| NOTE | '.$info->getNote().' |
';
echo '
';
htmlFooter();
diff --git a/examples/2.2.1-add-docs.php b/examples/2.2.1-add-docs.php
index 2d72a9312..72b9065ba 100644
--- a/examples/2.2.1-add-docs.php
+++ b/examples/2.2.1-add-docs.php
@@ -1,6 +1,7 @@
price = 340;
// add the documents and a commit command to the update query
-$update->addDocuments(array($doc1, $doc2));
+$update->addDocuments([$doc1, $doc2]);
$update->addCommit();
// this executes the query and returns the result
$result = $client->update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
diff --git a/examples/2.2.1.1-atomic-updates.php b/examples/2.2.1.1-atomic-updates.php
index 0c974e4fb..efa26b7b0 100644
--- a/examples/2.2.1.1-atomic-updates.php
+++ b/examples/2.2.1.1-atomic-updates.php
@@ -1,6 +1,7 @@
update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
// get a select query instance
$query = $client->createSelect();
@@ -55,11 +56,10 @@
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/examples/2.2.1.2-nested-child-documents.php b/examples/2.2.1.2-nested-child-documents.php
index 177add560..c26e381b4 100644
--- a/examples/2.2.1.2-nested-child-documents.php
+++ b/examples/2.2.1.2-nested-child-documents.php
@@ -1,6 +1,7 @@
createDocument();
$doc1->id = 123;
$doc1->name = 'testdoc-1';
-$doc1->childdocs = array(
- array(
+$doc1->childdocs = [
+ [
'id' => 1230,
'name' => 'childdoc-1-1',
'price' => 465,
- ),
- array(
+ ],
+ [
'id' => 1231,
'name' => 'childdoc-1-2',
'price' => 545,
- ),
-);
+ ],
+];
// and a second one where child documents are added one by one
$doc2 = $update->createDocument();
$doc2->setField('id', 124);
$doc2->setField('name', 'testdoc-2');
-$doc2->addField('childdocs', array(
+$doc2->addField('childdocs', [
'id' => 1240,
'name' => 'childdoc-2-1',
'price' => 360,
-));
-$doc2->addField('childdocs', array(
+]);
+$doc2->addField('childdocs', [
'id' => 1241,
'name' => 'childdoc-2-2',
'price' => 398,
-));
+]);
// add the documents and a commit command to the update query
-$update->addDocuments(array($doc1, $doc2));
+$update->addDocuments([$doc1, $doc2]);
$update->addCommit();
// this executes the query and returns the result
$result = $client->update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
diff --git a/examples/2.2.2-delete-by-query.php b/examples/2.2.2-delete-by-query.php
index c2876bf0a..b75486531 100644
--- a/examples/2.2.2-delete-by-query.php
+++ b/examples/2.2.2-delete-by-query.php
@@ -1,6 +1,7 @@
update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
diff --git a/examples/2.2.3-delete-by-id.php b/examples/2.2.3-delete-by-id.php
index be96498c4..d8d8ec151 100644
--- a/examples/2.2.3-delete-by-id.php
+++ b/examples/2.2.3-delete-by-id.php
@@ -1,6 +1,7 @@
update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
diff --git a/examples/2.2.4-optimize.php b/examples/2.2.4-optimize.php
index 9861194ab..08a28f9a4 100644
--- a/examples/2.2.4-optimize.php
+++ b/examples/2.2.4-optimize.php
@@ -1,6 +1,7 @@
update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
diff --git a/examples/2.2.5-rollback.php b/examples/2.2.5-rollback.php
index 58ef92090..abec9c8a3 100644
--- a/examples/2.2.5-rollback.php
+++ b/examples/2.2.5-rollback.php
@@ -1,6 +1,7 @@
update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
diff --git a/examples/2.2.6-rawxml.php b/examples/2.2.6-rawxml.php
index 69100780c..c4056a97f 100644
--- a/examples/2.2.6-rawxml.php
+++ b/examples/2.2.6-rawxml.php
@@ -1,6 +1,7 @@
update($update);
echo 'Update query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
diff --git a/examples/2.3.1-mlt-query.php b/examples/2.3.1-mlt-query.php
index b0b0c0b4d..7f3e9d63d 100644
--- a/examples/2.3.1-mlt-query.php
+++ b/examples/2.3.1-mlt-query.php
@@ -1,10 +1,11 @@
Note: You need to define your own /mlt handler in solrconfig.xml to run this example!";
-echo "<requestHandler name="/mlt" class="solr.MoreLikeThisHandler" />
";
+echo 'Note: You need to define your own /mlt handler in solrconfig.xml to run this example!
';
+echo '<requestHandler name="/mlt" class="solr.MoreLikeThisHandler" />
';
// create a client instance
$client = new Solarium\Client($adapter, $eventDispatcher, $config);
@@ -32,7 +33,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
@@ -51,7 +52,6 @@
// show MLT documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -61,7 +61,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/2.3.2-mlt-stream.php b/examples/2.3.2-mlt-stream.php
index e0c5c112a..ba0a678d7 100644
--- a/examples/2.3.2-mlt-stream.php
+++ b/examples/2.3.2-mlt-stream.php
@@ -1,10 +1,11 @@
Note: You need to define your own /mlt handler in solrconfig.xml to run this example!";
-echo "<requestHandler name="/mlt" class="solr.MoreLikeThisHandler" />
";
+echo 'Note: You need to define your own /mlt handler in solrconfig.xml to run this example!
';
+echo '<requestHandler name="/mlt" class="solr.MoreLikeThisHandler" />
';
// create a client instance
$client = new Solarium\Client($adapter, $eventDispatcher, $config);
@@ -45,7 +46,6 @@
// show MLT documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -55,7 +55,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/2.4.1-analysis-document.php b/examples/2.4.1-analysis-document.php
index 0bbde89bb..cbc5caac1 100644
--- a/examples/2.4.1-analysis-document.php
+++ b/examples/2.4.1-analysis-document.php
@@ -1,6 +1,7 @@
setQuery('ipod');
$doc = new Solarium\QueryType\Update\Query\Document(
- array(
+ [
'id' => 'MA147LL',
'name' => 'Apple 60 GB iPod with Video Playback Black',
'manu' => 'Apple Computer Inc.',
@@ -32,7 +33,7 @@
'price' => 399.00,
'popularity' => 10,
'inStock' => true,
- )
+ ]
);
$query->addDocument($doc);
@@ -42,29 +43,27 @@
// show the results
foreach ($result as $document) {
-
- echo '
Document: ' . $document->getName() . '
';
+ echo '
Document: '.$document->getName().'
';
foreach ($document as $field) {
-
- echo 'Field: ' . $field->getName() . '
';
+ echo 'Field: '.$field->getName().'
';
$indexAnalysis = $field->getIndexAnalysis();
if (!empty($indexAnalysis)) {
echo 'Index Analysis
';
- foreach ($indexAnalysis as $classes) {
+ foreach ($indexAnalysis as $classes) {
echo ''.$classes->getName().'
';
foreach ($classes as $result) {
- echo 'Text: ' . $result->getText() . '
';
- echo 'Raw text: ' . $result->getRawText() . '
';
- echo 'Start: ' . $result->getStart() . '
';
- echo 'End: ' . $result->getEnd() . '
';
- echo 'Position: ' . $result->getPosition() . '
';
- echo 'Position history: ' . implode(', ', $result->getPositionHistory()) . '
';
- echo 'Type: ' . htmlspecialchars($result->getType()) . '
';
- echo 'Match: ' . var_export($result->getMatch(), true) . '
';
+ echo 'Text: '.$result->getText().'
';
+ echo 'Raw text: '.$result->getRawText().'
';
+ echo 'Start: '.$result->getStart().'
';
+ echo 'End: '.$result->getEnd().'
';
+ echo 'Position: '.$result->getPosition().'
';
+ echo 'Position history: '.implode(', ', $result->getPositionHistory()).'
';
+ echo 'Type: '.htmlspecialchars($result->getType()).'
';
+ echo 'Match: '.var_export($result->getMatch(), true).'
';
echo '-----------
';
}
}
@@ -73,19 +72,19 @@
$queryAnalysis = $field->getQueryAnalysis();
if (!empty($queryAnalysis)) {
echo 'Query Analysis
';
- foreach ($queryAnalysis as $classes) {
+ foreach ($queryAnalysis as $classes) {
echo ''.$classes->getName().'
';
foreach ($classes as $result) {
- echo 'Text: ' . $result->getText() . '
';
- echo 'Raw text: ' . $result->getRawText() . '
';
- echo 'Start: ' . $result->getStart() . '
';
- echo 'End: ' . $result->getEnd() . '
';
- echo 'Position: ' . $result->getPosition() . '
';
- echo 'Position history: ' . implode(', ', $result->getPositionHistory()) . '
';
- echo 'Type: ' . htmlspecialchars($result->getType()) . '
';
- echo 'Match: ' . var_export($result->getMatch(), true) . '
';
+ echo 'Text: '.$result->getText().'
';
+ echo 'Raw text: '.$result->getRawText().'
';
+ echo 'Start: '.$result->getStart().'
';
+ echo 'End: '.$result->getEnd().'
';
+ echo 'Position: '.$result->getPosition().'
';
+ echo 'Position history: '.implode(', ', $result->getPositionHistory()).'
';
+ echo 'Type: '.htmlspecialchars($result->getType()).'
';
+ echo 'Match: '.var_export($result->getMatch(), true).'
';
echo '-----------
';
}
}
diff --git a/examples/2.4.2-analysis-field.php b/examples/2.4.2-analysis-field.php
index 9afd247cd..59290a19a 100644
--- a/examples/2.4.2-analysis-field.php
+++ b/examples/2.4.2-analysis-field.php
@@ -1,6 +1,7 @@
Result list: ' . $result->getName() . '
';
+ echo '
Result list: '.$result->getName().'
';
foreach ($result as $item) {
-
- echo 'Item: ' . $item->getName() . '
';
+ echo 'Item: '.$item->getName().'
';
$indexAnalysis = $item->getIndexAnalysis();
if (!empty($indexAnalysis)) {
echo 'Index Analysis
';
- foreach ($indexAnalysis as $classes) {
+ foreach ($indexAnalysis as $classes) {
echo ''.$classes->getName().'
';
foreach ($classes as $result) {
- echo 'Text: ' . $result->getText() . '
';
- echo 'Raw text: ' . $result->getRawText() . '
';
- echo 'Start: ' . $result->getStart() . '
';
- echo 'End: ' . $result->getEnd() . '
';
- echo 'Position: ' . $result->getPosition() . '
';
- echo 'Position history: ' . implode(', ', $result->getPositionHistory()) . '
';
- echo 'Type: ' . htmlspecialchars($result->getType()) . '
';
- echo 'Match: ' . var_export($result->getMatch(), true) . '
';
+ echo 'Text: '.$result->getText().'
';
+ echo 'Raw text: '.$result->getRawText().'
';
+ echo 'Start: '.$result->getStart().'
';
+ echo 'End: '.$result->getEnd().'
';
+ echo 'Position: '.$result->getPosition().'
';
+ echo 'Position history: '.implode(', ', $result->getPositionHistory()).'
';
+ echo 'Type: '.htmlspecialchars($result->getType()).'
';
+ echo 'Match: '.var_export($result->getMatch(), true).'
';
echo '-----------
';
}
}
@@ -51,19 +50,19 @@
$queryAnalysis = $item->getQueryAnalysis();
if (!empty($queryAnalysis)) {
echo 'Query Analysis
';
- foreach ($queryAnalysis as $classes) {
+ foreach ($queryAnalysis as $classes) {
echo ''.$classes->getName().'
';
foreach ($classes as $result) {
- echo 'Text: ' . $result->getText() . '
';
- echo 'Raw text: ' . $result->getRawText() . '
';
- echo 'Start: ' . $result->getStart() . '
';
- echo 'End: ' . $result->getEnd() . '
';
- echo 'Position: ' . $result->getPosition() . '
';
- echo 'Position history: ' . implode(', ', $result->getPositionHistory()) . '
';
- echo 'Type: ' . htmlspecialchars($result->getType()) . '
';
- echo 'Match: ' . var_export($result->getMatch(), true) . '
';
+ echo 'Text: '.$result->getText().'
';
+ echo 'Raw text: '.$result->getRawText().'
';
+ echo 'Start: '.$result->getStart().'
';
+ echo 'End: '.$result->getEnd().'
';
+ echo 'Position: '.$result->getPosition().'
';
+ echo 'Position history: '.implode(', ', $result->getPositionHistory()).'
';
+ echo 'Type: '.htmlspecialchars($result->getType()).'
';
+ echo 'Match: '.var_export($result->getMatch(), true).'
';
echo '-----------
';
}
}
diff --git a/examples/2.5-terms-query.php b/examples/2.5-terms-query.php
index 5a49e1721..3b1e561b9 100644
--- a/examples/2.5-terms-query.php
+++ b/examples/2.5-terms-query.php
@@ -1,6 +1,7 @@
$terms) {
- echo '' . $field . '
';
+ echo ''.$field.'
';
foreach ($terms as $term => $count) {
- echo $term . ' (' . $count . ')
';
+ echo $term.' ('.$count.')
';
}
echo '
';
}
diff --git a/examples/2.6-spellcheck-query.php b/examples/2.6-spellcheck-query.php
index bfb94889e..4ccdb77a3 100644
--- a/examples/2.6-spellcheck-query.php
+++ b/examples/2.6-spellcheck-query.php
@@ -1,6 +1,7 @@
$termResult) {
- echo '' . $term . '
';
+ echo ''.$term.'
';
echo 'NumFound: '.$termResult->getNumFound().'
';
echo 'StartOffset: '.$termResult->getStartOffset().'
';
echo 'EndOffset: '.$termResult->getEndOffset().'
';
diff --git a/examples/2.6-suggester-query.php b/examples/2.6-suggester-query.php
index c7f91e794..db187be3c 100644
--- a/examples/2.6-suggester-query.php
+++ b/examples/2.6-suggester-query.php
@@ -1,6 +1,7 @@
$terms) {
- echo '' . $dictionary . '
';
+ echo ''.$dictionary.'
';
foreach ($terms as $term => $termResult) {
- echo '' . $term . '
';
+ echo ''.$term.'
';
echo 'NumFound: '.$termResult->getNumFound().'
';
foreach ($termResult as $result) {
echo '- '.$result['term'].'
';
diff --git a/examples/2.7.1-extract-query.php b/examples/2.7.1-extract-query.php
index 070dcf6cf..b8b2b490f 100644
--- a/examples/2.7.1-extract-query.php
+++ b/examples/2.7.1-extract-query.php
@@ -1,6 +1,7 @@
Note: The extraction Solr Module needs to be enabled to run this example!';
@@ -26,7 +27,7 @@
$result = $client->extract($query);
echo 'Extract query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
diff --git a/examples/2.7.2-extract-query-extract-only.php b/examples/2.7.2-extract-query-extract-only.php
index c3d95195e..501f1fa59 100644
--- a/examples/2.7.2-extract-query-extract-only.php
+++ b/examples/2.7.2-extract-query-extract-only.php
@@ -1,6 +1,7 @@
Note: The extraction Solr Module needs to be enabled to run this example!';
@@ -30,7 +31,7 @@
$value = implode('
', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '';
diff --git a/examples/2.7.3.1-extract-query-generated-content.php b/examples/2.7.3.1-extract-query-generated-content.php
index 6e516ca0f..9c38305cd 100644
--- a/examples/2.7.3.1-extract-query-generated-content.php
+++ b/examples/2.7.3.1-extract-query-generated-content.php
@@ -1,6 +1,7 @@
Note: The extraction Solr Module needs to be enabled to run this example!';
@@ -35,8 +36,8 @@
$result = $client->extract($query);
echo 'Extract query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
// don't forget to close your file pointer!
fclose($file);
diff --git a/examples/2.7.3.2-extract-query-pdo-lob.php b/examples/2.7.3.2-extract-query-pdo-lob.php
index b4cf2659e..3b02e9021 100644
--- a/examples/2.7.3.2-extract-query-pdo-lob.php
+++ b/examples/2.7.3.2-extract-query-pdo-lob.php
@@ -1,11 +1,12 @@
Note: The extraction Solr Module needs to be enabled to run this example!';
echo "Note: This example doesn't work in PHP < 8.1.0!
";
-echo "Note: This example requires the PDO_SQLITE PDO driver (enabled by default in PHP)
";
+echo 'Note: This example requires the PDO_SQLITE PDO driver (enabled by default in PHP)
';
// create a client instance
$client = new Solarium\Client($adapter, $eventDispatcher, $config);
@@ -19,12 +20,12 @@
// create a database & store content as an example
$db = new PDO('sqlite::memory:');
-$db->exec("CREATE TABLE test (id INT, content TEXT)");
-$insert = $db->prepare("INSERT INTO test (id, content) VALUES (:id, :content)");
+$db->exec('CREATE TABLE test (id INT, content TEXT)');
+$insert = $db->prepare('INSERT INTO test (id, content) VALUES (:id, :content)');
$insert->execute(['id' => 1, 'content' => file_get_contents(__DIR__.'/index.html')]);
// get content from the database and map it as a stream
-$select = $db->prepare("SELECT content FROM test WHERE id = :id");
+$select = $db->prepare('SELECT content FROM test WHERE id = :id');
$select->execute(['id' => 1]);
$select->bindColumn(1, $content, PDO::PARAM_LOB);
$select->fetch(PDO::FETCH_BOUND);
@@ -42,7 +43,7 @@
$result = $client->extract($query);
echo 'Extract query executed
';
-echo 'Query status: ' . $result->getStatus(). '
';
-echo 'Query time: ' . $result->getQueryTime();
+echo 'Query status: '.$result->getStatus().'
';
+echo 'Query time: '.$result->getQueryTime();
htmlFooter();
diff --git a/examples/2.8-realtime-get-query.php b/examples/2.8-realtime-get-query.php
index bb2f02eca..b269b532b 100644
--- a/examples/2.8-realtime-get-query.php
+++ b/examples/2.8-realtime-get-query.php
@@ -1,6 +1,7 @@
createSelect();
-$query->setQuery('id:%1%', array($id));
+$query->setQuery('id:%1%', [$id]);
$resultset = $client->select($query);
echo 'NumFound with standard select: '.$resultset->getNumFound().'
';
@@ -34,9 +35,8 @@
// Display the document
echo '
';
foreach ($result->getDocument() as $field => $value) {
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
-
htmlFooter();
diff --git a/examples/2.9-server-core-admin-status.php b/examples/2.9-server-core-admin-status.php
index 601296a26..c2c482beb 100644
--- a/examples/2.9-server-core-admin-status.php
+++ b/examples/2.9-server-core-admin-status.php
@@ -1,6 +1,7 @@
getInitFailureResults();
echo 'CoreAdmin status action execution:
';
-foreach($statusResults as $statusResult) {
- echo 'Uptime of the core ( ' .$statusResult->getCoreName(). ' ): ' . $statusResult->getUptime() . '
';
+foreach ($statusResults as $statusResult) {
+ echo 'Uptime of the core ( '.$statusResult->getCoreName().' ): '.$statusResult->getUptime().'
';
}
-foreach($initFailures as $initFailure) {
- echo 'Init failure ( '. $initFailure->getCoreName() .' ): ' . $initFailure->getException() . '
';
+foreach ($initFailures as $initFailure) {
+ echo 'Init failure ( '.$initFailure->getCoreName().' ): '.$initFailure->getException().'
';
}
htmlFooter();
diff --git a/examples/4.1-api-usage.php b/examples/4.1-api-usage.php
index b85898de2..17bffd76b 100644
--- a/examples/4.1-api-usage.php
+++ b/examples/4.1-api-usage.php
@@ -1,6 +1,6 @@
setQuery('*:*');
$query->setStart(2)->setRows(20);
-$query->setFields(array('id','name','price'));
+$query->setFields(['id', 'name', 'price']);
$query->addSort('price', $query::SORT_ASC);
// create a filterquery using the API
@@ -33,16 +33,15 @@
echo '
Facet counts for field "inStock":
';
$facet = $resultset->getFacetSet()->getFacet('stock');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/examples/4.2-configuration-usage.php b/examples/4.2-configuration-usage.php
index eeb108bc5..46d9fc105 100644
--- a/examples/4.2-configuration-usage.php
+++ b/examples/4.2-configuration-usage.php
@@ -1,28 +1,29 @@
'*:*',
- 'start' => 2,
- 'rows' => 20,
- 'fields' => array('id','name','price'),
- 'sort' => array('price' => 'asc'),
- 'filterquery' => array(
- 'maxprice' => array(
- 'query' => 'price:[1 TO 300]'
- ),
- ),
- 'component' => array(
- 'facetset' => array(
- 'facet' => array(
+$select = [
+ 'query' => '*:*',
+ 'start' => 2,
+ 'rows' => 20,
+ 'fields' => ['id', 'name', 'price'],
+ 'sort' => ['price' => 'asc'],
+ 'filterquery' => [
+ 'maxprice' => [
+ 'query' => 'price:[1 TO 300]',
+ ],
+ ],
+ 'component' => [
+ 'facetset' => [
+ 'facet' => [
// notice this config uses an inline key value under 'local_key', instead of array key like the filterquery
- array('type' => 'field', 'local_key' => 'stock', 'field' => 'inStock'),
- )
- ),
- ),
-);
+ ['type' => 'field', 'local_key' => 'stock', 'field' => 'inStock'],
+ ],
+ ],
+ ],
+];
// create a client instance
$client = new Solarium\Client($adapter, $eventDispatcher, $config);
@@ -40,16 +41,15 @@
echo '
Facet counts for field "inStock":
';
$facet = $resultset->getFacetSet()->getFacet('stock');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/examples/4.3-extending-usage.php b/examples/4.3-extending-usage.php
index a0bd92739..c6a9208c5 100644
--- a/examples/4.3-extending-usage.php
+++ b/examples/4.3-extending-usage.php
@@ -1,9 +1,10 @@
setQuery('*:*');
$this->setStart(2)->setRows(20);
- $this->setFields(array('id','name','price'));
+ $this->setFields(['id', 'name', 'price']);
$this->addSort('price', self::SORT_ASC);
// create a facet field instance and set options
@@ -43,7 +44,7 @@ protected function init(): void
$client = new Client($adapter, $eventDispatcher, $config);
// create a query instance
-$query = new ProductPriceLimitedQuery;
+$query = new ProductPriceLimitedQuery();
// this executes the query and returns the result
$resultset = $client->select($query);
@@ -55,16 +56,15 @@ protected function init(): void
echo '
Facet counts for field "inStock":
';
$facet = $resultset->getFacetSet()->getFacet('stock');
foreach ($facet as $value => $count) {
- echo $value . ' [' . $count . ']
';
+ echo $value.' ['.$count.']
';
}
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
- echo '| id | ' . $document->id . ' |
';
- echo '| name | ' . $document->name . ' |
';
- echo '| price | ' . $document->price . ' |
';
+ echo '| id | '.$document->id.' |
';
+ echo '| name | '.$document->name.' |
';
+ echo '| price | '.$document->price.' |
';
echo '
';
}
diff --git a/examples/5.1-partial-usage.php b/examples/5.1-partial-usage.php
index a72c4e06d..12ce0d26f 100644
--- a/examples/5.1-partial-usage.php
+++ b/examples/5.1-partial-usage.php
@@ -1,6 +1,7 @@
getUri() . '
';
+echo 'Request URI: '.$request->getUri().'
';
// you can still execute the request using the client and get a 'raw' response object
$response = $client->executeRequest($request);
@@ -33,7 +33,6 @@
// show documents using the resultset iterator
foreach ($result as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -43,7 +42,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/5.2-extending.php b/examples/5.2-extending.php
index 2b40aa9e2..ff6bc9dd1 100644
--- a/examples/5.2-extending.php
+++ b/examples/5.2-extending.php
@@ -1,9 +1,10 @@
MyQuery::class,
- );
+ ];
}
-
// create a client instance
$client = new MyClient($adapter, $eventDispatcher, $config);
@@ -33,7 +33,7 @@ class MyClient extends Client
$query = $client->createSelect();
// check the query class, it should be our custom query class
-echo 'Query class: ' . get_class($query) . '
';
+echo 'Query class: '.get_class($query).'
';
// execute query
$result = $client->execute($query);
@@ -43,7 +43,6 @@ class MyClient extends Client
// show documents using the resultset iterator
foreach ($result as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -53,7 +52,7 @@ class MyClient extends Client
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/5.3.1-plugin-event-hooks.php b/examples/5.3.1-plugin-event-hooks.php
index cb7222c83..5e4a4db4a 100644
--- a/examples/5.3.1-plugin-event-hooks.php
+++ b/examples/5.3.1-plugin-event-hooks.php
@@ -1,14 +1,15 @@
start = microtime(true);
$dispatcher = $this->client->getEventDispatcher();
- $dispatcher->addListener(Events::PRE_CREATE_REQUEST, array($this, 'preCreateRequest'));
- $dispatcher->addListener(Events::POST_CREATE_REQUEST, array($this, 'postCreateRequest'));
- $dispatcher->addListener(Events::PRE_EXECUTE_REQUEST, array($this, 'preExecuteRequest'));
- $dispatcher->addListener(Events::POST_EXECUTE_REQUEST, array($this, 'postExecuteRequest'));
- $dispatcher->addListener(Events::PRE_CREATE_RESULT, array($this, 'preCreateResult'));
- $dispatcher->addListener(Events::POST_CREATE_RESULT, array($this, 'postCreateResult'));
- $dispatcher->addListener(Events::PRE_EXECUTE, array($this, 'preExecute'));
- $dispatcher->addListener(Events::POST_EXECUTE, array($this, 'postExecute'));
- $dispatcher->addListener(Events::PRE_CREATE_QUERY, array($this, 'preCreateQuery'));
- $dispatcher->addListener(Events::POST_CREATE_QUERY, array($this, 'postCreateQuery'));
+ $dispatcher->addListener(Events::PRE_CREATE_REQUEST, [$this, 'preCreateRequest']);
+ $dispatcher->addListener(Events::POST_CREATE_REQUEST, [$this, 'postCreateRequest']);
+ $dispatcher->addListener(Events::PRE_EXECUTE_REQUEST, [$this, 'preExecuteRequest']);
+ $dispatcher->addListener(Events::POST_EXECUTE_REQUEST, [$this, 'postExecuteRequest']);
+ $dispatcher->addListener(Events::PRE_CREATE_RESULT, [$this, 'preCreateResult']);
+ $dispatcher->addListener(Events::POST_CREATE_RESULT, [$this, 'postCreateResult']);
+ $dispatcher->addListener(Events::PRE_EXECUTE, [$this, 'preExecute']);
+ $dispatcher->addListener(Events::POST_EXECUTE, [$this, 'postExecute']);
+ $dispatcher->addListener(Events::PRE_CREATE_QUERY, [$this, 'preCreateQuery']);
+ $dispatcher->addListener(Events::POST_CREATE_QUERY, [$this, 'postCreateQuery']);
}
// This method is called if the plugin is removed from the client.
public function deinitPlugin(): void
{
$dispatcher = $this->client->getEventDispatcher();
- $dispatcher->removeListener(Events::PRE_CREATE_REQUEST, array($this, 'preCreateRequest'));
- $dispatcher->removeListener(Events::POST_CREATE_REQUEST, array($this, 'postCreateRequest'));
- $dispatcher->removeListener(Events::PRE_EXECUTE_REQUEST, array($this, 'preExecuteRequest'));
- $dispatcher->removeListener(Events::POST_EXECUTE_REQUEST, array($this, 'postExecuteRequest'));
- $dispatcher->removeListener(Events::PRE_CREATE_RESULT, array($this, 'preCreateResult'));
- $dispatcher->removeListener(Events::POST_CREATE_RESULT, array($this, 'postCreateResult'));
- $dispatcher->removeListener(Events::PRE_EXECUTE, array($this, 'preExecute'));
- $dispatcher->removeListener(Events::POST_EXECUTE, array($this, 'postExecute'));
- $dispatcher->removeListener(Events::PRE_CREATE_QUERY, array($this, 'preCreateQuery'));
- $dispatcher->removeListener(Events::POST_CREATE_QUERY, array($this, 'postCreateQuery'));
+ $dispatcher->removeListener(Events::PRE_CREATE_REQUEST, [$this, 'preCreateRequest']);
+ $dispatcher->removeListener(Events::POST_CREATE_REQUEST, [$this, 'postCreateRequest']);
+ $dispatcher->removeListener(Events::PRE_EXECUTE_REQUEST, [$this, 'preExecuteRequest']);
+ $dispatcher->removeListener(Events::POST_EXECUTE_REQUEST, [$this, 'postExecuteRequest']);
+ $dispatcher->removeListener(Events::PRE_CREATE_RESULT, [$this, 'preCreateResult']);
+ $dispatcher->removeListener(Events::POST_CREATE_RESULT, [$this, 'postCreateResult']);
+ $dispatcher->removeListener(Events::PRE_EXECUTE, [$this, 'preExecute']);
+ $dispatcher->removeListener(Events::POST_EXECUTE, [$this, 'postExecute']);
+ $dispatcher->removeListener(Events::PRE_CREATE_QUERY, [$this, 'preCreateQuery']);
+ $dispatcher->removeListener(Events::POST_CREATE_QUERY, [$this, 'postCreateQuery']);
}
protected function timer(string $event): void
{
$time = round(microtime(true) - $this->start, 5);
- $this->output[] = '['.$time.'] ' . $event;
+ $this->output[] = '['.$time.'] '.$event;
}
public function display(): void
@@ -74,7 +75,7 @@ public function preExecuteRequest(PreExecuteRequest $event): void
// this dummy param will be visible in the debug output but will also be used in the actual Solr request
$event->getRequest()->addParam('dummyparam', 'dummyvalue');
- $this->output[] = 'Request URI: ' . $event->getRequest()->getUri();
+ $this->output[] = 'Request URI: '.$event->getRequest()->getUri();
}
public function postExecuteRequest(): void
@@ -113,7 +114,6 @@ public function postCreateQuery(): void
}
}
-
htmlHeader();
// create a client instance and register the plugin
@@ -127,7 +127,6 @@ public function postCreateQuery(): void
echo 'NumFound: '.$resultset->getNumFound();
foreach ($resultset as $document) {
-
echo '
';
foreach ($document as $field => $value) {
@@ -135,7 +134,7 @@ public function postCreateQuery(): void
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/5.3.2-plugin-solarium-presets.php b/examples/5.3.2-plugin-solarium-presets.php
index 68620b8e4..80fcf0d85 100644
--- a/examples/5.3.2-plugin-solarium-presets.php
+++ b/examples/5.3.2-plugin-solarium-presets.php
@@ -1,10 +1,11 @@
createSelect();
// check the query class, it should be our custom query class
-echo 'Query class: ' . get_class($query) . '
';
+echo 'Query class: '.get_class($query).'
';
// execute the query and display the results
$resultset = $client->select($query);
echo 'NumFound: '.$resultset->getNumFound();
foreach ($resultset as $document) {
-
echo '
';
foreach ($document as $field => $value) {
@@ -48,7 +47,7 @@ public function initPlugin($client, array $options): void
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/6.1.1-psr18-adapter.php b/examples/6.1.1-psr18-adapter.php
index a63ed486c..3e90af393 100644
--- a/examples/6.1.1-psr18-adapter.php
+++ b/examples/6.1.1-psr18-adapter.php
@@ -1,6 +1,7 @@
';
// the documents are also iterable, to get all fields
@@ -32,7 +32,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/6.1.2-curl-adapter.php b/examples/6.1.2-curl-adapter.php
index 076e69d44..0edb9bb10 100644
--- a/examples/6.1.2-curl-adapter.php
+++ b/examples/6.1.2-curl-adapter.php
@@ -1,6 +1,7 @@
';
// the documents are also iterable, to get all fields
@@ -30,7 +30,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/6.1.3-http-adapter.php b/examples/6.1.3-http-adapter.php
index c37cfd041..e3aedc89a 100644
--- a/examples/6.1.3-http-adapter.php
+++ b/examples/6.1.3-http-adapter.php
@@ -1,6 +1,7 @@
';
// the documents are also iterable, to get all fields
@@ -30,7 +30,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/6.2-escaping.php b/examples/6.2-escaping.php
index 8144bd2bc..154f7b24f 100644
--- a/examples/6.2-escaping.php
+++ b/examples/6.2-escaping.php
@@ -1,6 +1,7 @@
getHelper();
-$query->setQuery('features:' . $helper->escapePhrase($input));
+$query->setQuery('features:'.$helper->escapePhrase($input));
// this executes the query and returns the result
$resultset = $client->select($query);
@@ -25,7 +26,6 @@
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -35,7 +35,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/6.3-placeholder-syntax.php b/examples/6.3-placeholder-syntax.php
index a5627a81f..d585ca492 100644
--- a/examples/6.3-placeholder-syntax.php
+++ b/examples/6.3-placeholder-syntax.php
@@ -1,6 +1,7 @@
setQuery('features: %p1% AND inStock:%2%', array($input, 1));
+$query->setQuery('features: %p1% AND inStock:%2%', [$input, 1]);
// show the result after replacing the placeholders with values
-echo $query->getQuery() . '
';
+echo $query->getQuery().'
';
// this executes the query and returns the result
$resultset = $client->select($query);
@@ -27,7 +28,6 @@
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
@@ -37,7 +37,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/6.4-dereferenced-params.php b/examples/6.4-dereferenced-params.php
index 95c373559..3ade12ac7 100644
--- a/examples/6.4-dereferenced-params.php
+++ b/examples/6.4-dereferenced-params.php
@@ -1,35 +1,30 @@
createSelect();
$helper = $query->getHelper();
-$join = $helper->qparser('join', array('from' => 'manu_id', 'to' => 'id'), true);
-$queryString = $join . 'id:1';
+$join = $helper->qparser('join', ['from' => 'manu_id', 'to' => 'id'], true);
+$queryString = $join.'id:1';
$query->setQuery($queryString);
$request = $client->createRequest($query);
// output resulting url with dereferenced params
-echo urldecode($request->getUri()) . '
';
-
-
-
+echo urldecode($request->getUri()).'
';
// this second example gives the exact same result, using the special join helper
$query = $client->createSelect();
$helper = $query->getHelper();
$join = $helper->join('manu_id', 'id', true);
-$queryString = $join . 'id:1';
+$queryString = $join.'id:1';
$query->setQuery($queryString);
$request = $client->createRequest($query);
diff --git a/examples/6.5-exceptions.php b/examples/6.5-exceptions.php
index 8dea1c196..093dbcf00 100644
--- a/examples/6.5-exceptions.php
+++ b/examples/6.5-exceptions.php
@@ -1,6 +1,7 @@
execute($ping);
+ $client->ping($ping);
} catch (Exception $e) {
echo 'Something went wrong:
';
echo $e->getMessage();
@@ -26,7 +27,7 @@
// distinguish exceptions thrown by Solarium
try {
- $client->execute($ping);
+ $client->ping($ping);
} catch (Solarium\Exception\ExceptionInterface $e) {
echo 'Solarium ran into a problem:
';
echo $e->getMessage();
@@ -39,7 +40,7 @@
// distinguish exceptions of particular interest
try {
- $client->execute($ping);
+ $client->ping($ping);
} catch (Solarium\Exception\HttpException $e) {
echo 'Solarium can\'t reach your Solr server:
';
echo $e->getMessage();
@@ -52,7 +53,7 @@
// distinguish after catching
try {
- $client->execute($ping);
+ $client->ping($ping);
} catch (Exception $e) {
echo 'Something went wrong:
';
echo $e->getMessage();
diff --git a/examples/7.1-plugin-loadbalancer.php b/examples/7.1-plugin-loadbalancer.php
index f137d81f1..9c3902ed4 100644
--- a/examples/7.1-plugin-loadbalancer.php
+++ b/examples/7.1-plugin-loadbalancer.php
@@ -1,6 +1,6 @@
getEndpoint()->getCore();
$endpoint1 = $client->createEndpoint('local1');
-$endpoint1->setCore($core); //normally you would add endpoint specific settings...
+$endpoint1->setCore($core); // normally you would add endpoint specific settings...
$endpoint2 = $client->createEndpoint('local2');
-$endpoint2->setCore($core); //normally you would add endpoint specific settings...
+$endpoint2->setCore($core); // normally you would add endpoint specific settings...
$endpoint3 = $client->createEndpoint('local3');
-$endpoint3->setCore($core); //normally you would add endpoint specific settings...
+$endpoint3->setCore($core); // normally you would add endpoint specific settings...
// get loadbalancer plugin instance and add endpoints
$loadbalancer = $client->getPlugin('loadbalancer');
@@ -31,11 +31,11 @@
$query = $client->createSelect();
// execute the query multiple times, displaying the server for each execution
-for ($i = 1; $i <= 8; $i++) {
+for ($i = 1; $i <= 8; ++$i) {
$resultset = $client->select($query);
- echo 'Query execution #' . $i . '
';
- echo 'NumFound: ' . $resultset->getNumFound(). '
';
- echo 'Server: ' . $loadbalancer->getLastEndpoint() .'
';
+ echo 'Query execution #'.$i.'
';
+ echo 'NumFound: '.$resultset->getNumFound().'
';
+ echo 'Server: '.$loadbalancer->getLastEndpoint().'
';
}
// force a server for a query (normally 'local3' is extremely unlikely based on its weight)
@@ -43,19 +43,19 @@
$resultset = $client->select($query);
echo 'Query execution with server forced to local3
';
-echo 'NumFound: ' . $resultset->getNumFound(). '
';
-echo 'Server: ' . $loadbalancer->getLastEndpoint() .'
';
+echo 'NumFound: '.$resultset->getNumFound().'
';
+echo 'Server: '.$loadbalancer->getLastEndpoint().'
';
// test a ping query
$query = $client->createPing();
$client->ping($query);
echo 'Loadbalanced ping query, should display a loadbalancing server:
';
-echo 'Ping server: ' . $loadbalancer->getLastEndpoint() .'
';
+echo 'Ping server: '.$loadbalancer->getLastEndpoint().'
';
// exclude ping query from loadbalancing
$loadbalancer->addBlockedQueryType(Solarium\Client::QUERY_PING);
$client->ping($query);
echo 'Non-loadbalanced ping query, should not display a loadbalancing server:
';
-echo 'Ping server: ' . $loadbalancer->getLastEndpoint() .'
';
+echo 'Ping server: '.$loadbalancer->getLastEndpoint().'
';
htmlFooter();
diff --git a/examples/7.2-plugin-postbigrequest.php b/examples/7.2-plugin-postbigrequest.php
index ca7e25f5f..289ea3d35 100644
--- a/examples/7.2-plugin-postbigrequest.php
+++ b/examples/7.2-plugin-postbigrequest.php
@@ -1,6 +1,6 @@
';
// the documents are also iterable, to get all fields
@@ -33,7 +32,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/7.3-plugin-customizerequest.php b/examples/7.3-plugin-customizerequest.php
index 36e82f8cc..abe975878 100644
--- a/examples/7.3-plugin-customizerequest.php
+++ b/examples/7.3-plugin-customizerequest.php
@@ -1,6 +1,6 @@
createCustomization(
- array(
+ [
'key' => 'auth',
'type' => 'header',
'name' => 'X-my-auth',
'value' => 'mypassword',
- 'persistent' => true
- )
+ 'persistent' => true,
+ ]
);
// add a persistent GET param (using fluent interface)
@@ -39,7 +39,7 @@
$resultset = $client->select($query);
// display the total number of documents found by Solr
-echo 'NumFound: '.$resultset->getNumFound() . '
';
+echo 'NumFound: '.$resultset->getNumFound().'
';
// execute the same query again (this time the 'id' param should no longer show up in the logs)
$resultset = $client->select($query);
diff --git a/examples/7.4-plugin-parallelexecution.php b/examples/7.4-plugin-parallelexecution.php
index 8d03bb712..a6279bb30 100644
--- a/examples/7.4-plugin-parallelexecution.php
+++ b/examples/7.4-plugin-parallelexecution.php
@@ -1,6 +1,6 @@
getPlugin('customizerequest');
$customizer->createCustomization(
- array(
+ [
'key' => 'delay',
'type' => 'param',
'name' => 'delay',
'value' => '500',
- 'persistent' => true
- )
+ 'persistent' => true,
+ ]
);
// create two queries to execute
@@ -31,12 +31,12 @@
// first execute the queries the normal way and time it
echo 'Serial execution
';
$start = microtime(true);
-$resultInStock = $client->execute($queryInStock);
-$resultLowPrice = $client->execute($queryLowPrice);
-echo 'Execution time for normal "serial" execution of two queries: ' . round(microtime(true)-$start, 3) . ' s';
+$resultInStock = $client->select($queryInStock);
+$resultLowPrice = $client->select($queryLowPrice);
+echo 'Execution time for normal "serial" execution of two queries: '.round(microtime(true) - $start, 3).' s';
echo '
';
-echo 'In stock: ' . $resultInStock->getNumFound() . '
';
-echo 'Low price: ' . $resultLowPrice->getNumFound() . '
';
+echo 'In stock: '.$resultInStock->getNumFound().'
';
+echo 'Low price: '.$resultLowPrice->getNumFound().'
';
echo '
';
@@ -47,10 +47,10 @@
$parallel->addQuery('instock', $queryInStock);
$parallel->addQuery('lowprice', $queryLowPrice);
$results = $parallel->execute();
-echo 'Execution time for parallel execution of two queries: ' . round(microtime(true)-$start, 3) . ' s';
+echo 'Execution time for parallel execution of two queries: '.round(microtime(true) - $start, 3).' s';
echo '
';
-echo 'In stock: ' . $results['instock']->getNumFound() . '
';
-echo 'Low price: ' . $results['lowprice']->getNumFound() . '
';
+echo 'In stock: '.$results['instock']->getNumFound().'
';
+echo 'Low price: '.$results['lowprice']->getNumFound().'
';
htmlFooter();
diff --git a/examples/7.5.1-plugin-bufferedadd.php b/examples/7.5.1-plugin-bufferedadd.php
index 4dd72a220..f01e72cbe 100644
--- a/examples/7.5.1-plugin-bufferedadd.php
+++ b/examples/7.5.1-plugin-bufferedadd.php
@@ -1,10 +1,10 @@
getEventDispatcher()->addListener(
Events::PRE_FLUSH,
function (PreFlush $event): void {
- echo 'Flushing buffer (' . count($event->getBuffer()) . ' docs)
';
+ echo 'Flushing buffer ('.count($event->getBuffer()).' docs)
';
}
);
// let's insert 25 docs
-for ($i=1; $i<=25; $i++) {
-
+for ($i = 1; $i <= 25; ++$i) {
// create a new document with dummy data and add it to the buffer
- $data = array(
+ $data = [
'id' => 'test_'.$i,
'name' => 'test for buffered add',
'price' => $i,
- );
+ ];
$buffer->createDocument($data);
// alternatively you could create document instances yourself and use the addDocument(s) method
diff --git a/examples/7.5.2-plugin-buffereddelete.php b/examples/7.5.2-plugin-buffereddelete.php
index a0f3d0c8e..7c865ddd7 100644
--- a/examples/7.5.2-plugin-buffereddelete.php
+++ b/examples/7.5.2-plugin-buffereddelete.php
@@ -1,10 +1,10 @@
getEventDispatcher()->addListener(
Events::PRE_FLUSH,
function (PreFlush $event): void {
- echo 'Flushing buffer (' . count($event->getBuffer()) . ' deletes)
';
+ echo 'Flushing buffer ('.count($event->getBuffer()).' deletes)
';
}
);
// let's delete 25 docs
-for ($i=1; $i<=25; $i++) {
+for ($i = 1; $i <= 25; ++$i) {
$buffer->addDeleteById($i);
}
diff --git a/examples/7.5.3-plugin-bufferedupdate-benchmarks.php b/examples/7.5.3-plugin-bufferedupdate-benchmarks.php
index 102883d69..5f06af9a3 100644
--- a/examples/7.5.3-plugin-bufferedupdate-benchmarks.php
+++ b/examples/7.5.3-plugin-bufferedupdate-benchmarks.php
@@ -1,12 +1,12 @@
<?php
- require_once(__DIR__.'/init.php');
-
use Solarium\QueryType\Update\Query\Query;
+ require_once __DIR__.'/init.php';
+
$weight = '';
$addRequestFormat = Query::REQUEST_FORMAT_JSON;
$delRequestFormat = Query::REQUEST_FORMAT_JSON;
- require(__DIR__.'/7.5.3-plugin-bufferedupdate-benchmarks.php');
+ require __DIR__.'/7.5.3-plugin-bufferedupdate-benchmarks.php';
EOT;
diff --git a/examples/7.5.3.0-plugin-bufferedupdate-benchmarks-build-only.php b/examples/7.5.3.0-plugin-bufferedupdate-benchmarks-build-only.php
index ddfa9b558..fbbdb8720 100644
--- a/examples/7.5.3.0-plugin-bufferedupdate-benchmarks-build-only.php
+++ b/examples/7.5.3.0-plugin-bufferedupdate-benchmarks-build-only.php
@@ -1,13 +1,13 @@
createSelect();
-$query->setFields(array('id'));
+$query->setFields(['id']);
// cursor functionality can be used for efficient deep paging (since Solr 4.7)
$query->setCursorMark('*');
@@ -22,11 +22,11 @@
$prefetch->setQuery($query);
// display the total number of documents found by Solr
-echo 'NumFound: ' . count($prefetch);
+echo 'NumFound: '.count($prefetch);
// show document IDs using the resultset iterator
foreach ($prefetch as $document) {
- echo '
ID: '. $document->id;
+ echo '
ID: '.$document->id;
}
htmlFooter();
diff --git a/examples/7.7-plugin-minimumscorefilter.php b/examples/7.7-plugin-minimumscorefilter.php
index 28363a10c..f8f829c07 100644
--- a/examples/7.7-plugin-minimumscorefilter.php
+++ b/examples/7.7-plugin-minimumscorefilter.php
@@ -1,6 +1,6 @@
getPlugin('minimumscorefilter');
$query = $client->createQuery($filter::QUERY_TYPE);
$query->setQuery('a');
-$query->setFields(array('id'));
+$query->setFields(['id']);
$query->setFilterRatio(.5);
$query->setFilterMode($query::FILTER_MODE_MARK);
@@ -24,7 +24,6 @@
// show documents using the resultset iterator
foreach ($resultset as $document) {
-
// by setting the FILTER_MARK option we get a special method to test each document
if ($document->markedAsLowScore()) {
echo '
MARKED AS LOW SCORE';
@@ -39,7 +38,7 @@
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/7.7.1-plugin-minimumscorefilter-grouping.php b/examples/7.7.1-plugin-minimumscorefilter-grouping.php
index 59f41e62d..6b8dc2aa6 100644
--- a/examples/7.7.1-plugin-minimumscorefilter-grouping.php
+++ b/examples/7.7.1-plugin-minimumscorefilter-grouping.php
@@ -1,6 +1,7 @@
getPlugin('minimumscorefilter');
$query = $client->createQuery($filter::QUERY_TYPE);
$query->setRows(50);
-$query->setFields(array('id','name','score'));
+$query->setFields(['id', 'name', 'score']);
$query->setQuery('memory');
$query->setFilterRatio(.8);
$query->setFilterMode($query::FILTER_MODE_MARK);
@@ -28,29 +29,25 @@
$groups = $resultset->getGrouping();
foreach ($groups as $groupKey => $fieldGroup) {
-
echo ''.$groupKey.'
';
echo 'Matches: '.$fieldGroup->getMatches().'
';
echo 'Number of groups: '.$fieldGroup->getNumberOfGroups();
foreach ($fieldGroup as $valueGroup) {
-
$value = $valueGroup->getValue();
echo ''.(null !== $value ? (int) $value : 'NULL').'
';
foreach ($valueGroup as $document) {
-
echo '
';
// the documents are also iterable, to get all fields
foreach ($document as $field => $value) {
-
// this converts multivalue fields to a comma-separated string
if (is_array($value)) {
$value = implode(', ', $value);
}
- echo '| ' . $field . ' | ' . $value . ' |
';
+ echo '| '.$field.' | '.$value.' |
';
}
echo '
';
diff --git a/examples/7.8-plugin-postbigextractrequest.php b/examples/7.8-plugin-postbigextractrequest.php
index 5cd4c60d1..b899c7487 100644
--- a/examples/7.8-plugin-postbigextractrequest.php
+++ b/examples/7.8-plugin-postbigextractrequest.php
@@ -1,6 +1,7 @@
array(
- 'localhost' => array(
- 'scheme' => 'http', # or https
+$config = [
+ 'endpoint' => [
+ 'localhost' => [
+ 'scheme' => 'http', // or https
'host' => '127.0.0.1',
'port' => 8983,
'path' => '/',
- // 'context' => 'solr', # only necessary to set if not the default 'solr'
+ // 'context' => 'solr', // only necessary to set if not the default 'solr'
'core' => 'techproducts',
- )
- )
-);
+ ],
+ ],
+];
diff --git a/examples/execute_all.php b/examples/execute_all.php
index aee13d9a1..bcdb9f735 100644
--- a/examples/execute_all.php
+++ b/examples/execute_all.php
@@ -5,8 +5,7 @@
use Solarium\Support\Utility;
try {
-
- require(__DIR__.'/init.php');
+ require __DIR__.'/init.php';
$collection_or_core_name = $config['endpoint']['localhost']['core'] = uniqid();
@@ -214,18 +213,18 @@
foreach (scandir(__DIR__) as $example) {
if (preg_match('/^\d.*\.php/', $example)) {
- print "\n".$example.' ';
+ echo PHP_EOL.$example.' ';
if (in_array($example, $skipAltogether)) {
- print 'Could not be run against the techproducts example.';
+ echo 'Could not be run against the techproducts example.';
} elseif (in_array($example, $skipForSolrVersion)) {
printf('Could not be run against Solr %d.', $solrVersion);
} elseif ('solrcloud' === $solr_mode && in_array($example, $skipForCloud)) {
- print 'Could not be run in cloud mode.';
+ echo 'Could not be run in cloud mode.';
} elseif (in_array($example, $skipForPHPVersion)) {
printf('Could not be run in PHP %s.', PHP_VERSION);
} else {
ob_start();
- require($example);
+ require $example;
ob_end_clean();
}
}
@@ -253,10 +252,10 @@
$coreAdminQuery->setAction($unloadAction);
$client->coreAdmin($coreAdminQuery);
}
-} catch (\Exception $e) {
- print $e;
+} catch (Exception $e) {
+ echo $e;
exit(1);
}
-print "\n\n";
+echo PHP_EOL.PHP_EOL;
exit(0);
diff --git a/examples/init.php b/examples/init.php
index 30885a5dc..3b3f9fec0 100644
--- a/examples/init.php
+++ b/examples/init.php
@@ -7,7 +7,7 @@
ini_set('display_errors', true);
if (file_exists('config.php')) {
- require('config.php');
+ require 'config.php';
}
require $config['autoload'] ?? __DIR__.'/../vendor/autoload.php';