Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into solr_8.5.0
- Loading branch information
Showing
25 changed files
with
926 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
docs/queries/update-query/building-an-update-query/rawxml-command.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
You can use this command to add XML formatted update commands to an update query. | ||
|
||
Make sure the XML is valid as Solarium will not check this. If you are constructing these strings in your own code, you should probably be using the other commands Solarium provides to build your update query. | ||
|
||
Options | ||
------- | ||
|
||
This command has no options. | ||
|
||
Example | ||
------- | ||
|
||
```php | ||
<?php | ||
|
||
require(__DIR__.'/init.php'); | ||
htmlHeader(); | ||
|
||
// create a client instance | ||
$client = new Solarium\Client($config); | ||
|
||
// get an update query instance | ||
$update = $client->createUpdate(); | ||
|
||
// create an XML string with a valid update command | ||
$xml = ' | ||
<add> | ||
<doc> | ||
<field name="id">125</field> | ||
<field name="name">testdoc-3</field> | ||
<field name="price">325</field> | ||
</doc> | ||
<doc> | ||
<field name="id">126</field> | ||
<field name="name">testdoc-4</field> | ||
<field name="price">375</field> | ||
</doc> | ||
</add> | ||
'; | ||
|
||
// or use an XML file containing a valid update command | ||
$xmlfile = 'example.xml'; | ||
|
||
// add the XML string, the XML file and a commit command to the update query | ||
$update->addRawXmlCommand($xml); | ||
$update->addRawXmlFile($xmlfile); | ||
$update->addCommit(); | ||
|
||
// this executes the query and returns the result | ||
$result = $client->update($update); | ||
|
||
echo '<b>Update query executed</b><br/>'; | ||
echo 'Query status: ' . $result->getStatus(). '<br/>'; | ||
echo 'Query time: ' . $result->getQueryTime(); | ||
|
||
htmlFooter(); | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
require(__DIR__.'/init.php'); | ||
htmlHeader(); | ||
|
||
// create a client instance | ||
$client = new Solarium\Client($config); | ||
|
||
// get an update query instance | ||
$update = $client->createUpdate(); | ||
|
||
// create an XML string with a valid update command | ||
$xml = ' | ||
<add> | ||
<doc> | ||
<field name="id">125</field> | ||
<field name="name">testdoc-3</field> | ||
<field name="price">325</field> | ||
</doc> | ||
<doc> | ||
<field name="id">126</field> | ||
<field name="name">testdoc-4</field> | ||
<field name="price">375</field> | ||
</doc> | ||
</add> | ||
'; | ||
|
||
// or use an XML file containing a valid update command | ||
$xmlfile = 'example.xml'; | ||
|
||
// add the XML string, the XML file and a commit command to the update query | ||
$update->addRawXmlCommand($xml); | ||
$update->addRawXmlFile($xmlfile); | ||
$update->addCommit(); | ||
|
||
// this executes the query and returns the result | ||
$result = $client->update($update); | ||
|
||
echo '<b>Update query executed</b><br/>'; | ||
echo 'Query status: ' . $result->getStatus(). '<br/>'; | ||
echo 'Query time: ' . $result->getQueryTime(); | ||
|
||
htmlFooter(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.