Revision 7576,
812 bytes
checked in by adir, 12 years ago
(diff) |
Ticket #000 - Adicionando a integracao de buscas com Solr na base a ser isnerida na comunidade
|
Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | require('init.php'); |
---|
4 | htmlHeader(); |
---|
5 | |
---|
6 | // create a client instance |
---|
7 | $client = new Solarium_Client($config); |
---|
8 | |
---|
9 | // get an update query instance |
---|
10 | $update = $client->createUpdate(); |
---|
11 | |
---|
12 | // create a new document for the data |
---|
13 | $doc1 = $update->createDocument(); |
---|
14 | $doc1->id = 123; |
---|
15 | $doc1->name = 'testdoc-1'; |
---|
16 | $doc1->price = 364; |
---|
17 | |
---|
18 | // and a second one |
---|
19 | $doc2 = $update->createDocument(); |
---|
20 | $doc2->id = 124; |
---|
21 | $doc2->name = 'testdoc-2'; |
---|
22 | $doc2->price = 340; |
---|
23 | |
---|
24 | // add the documents and a commit command to the update query |
---|
25 | $update->addDocuments(array($doc1, $doc2)); |
---|
26 | $update->addCommit(); |
---|
27 | |
---|
28 | // this executes the query and returns the result |
---|
29 | $result = $client->update($update); |
---|
30 | |
---|
31 | echo '<b>Update query executed</b><br/>'; |
---|
32 | echo 'Query status: ' . $result->getStatus(). '<br/>'; |
---|
33 | echo 'Query time: ' . $result->getQueryTime(); |
---|
34 | |
---|
35 | htmlFooter(); |
---|
Note: See
TracBrowser
for help on using the repository browser.