예제 #1
0
 /**
  * Write a message to the log.     *
  *
  * @param array $data     Data specific to what we're saving
  * @param array $userData Browser, IP, urls, etc
  *
  * @return void
  */
 public function write($data, $userData)
 {
     if (isset($data['phrase']) && $data['phrase'] == '') {
         $data['phrase'] = '*:*';
     }
     $update = new \VuFindSearch\Backend\Solr\Document\UpdateDocument();
     $update->addRecord(new \VuFindSearch\Backend\Solr\Record\SerializableRecord(array_merge($data, $userData)));
     $this->solrWriter->save('SolrStats', $update);
 }
예제 #2
0
 /**
  * Test delete records
  *
  * @return void
  */
 public function testDeleteRecords()
 {
     $bm = $this->getBackendManagerWithMockSolr();
     $connector = $bm->get('Solr')->getConnector();
     $callback = function ($i) {
         return trim($i->asXML()) == "<?xml version=\"1.0\"?>\n<delete><id>foo</id><id>bar</id></delete>";
     };
     $connector->expects($this->once())->method('write')->with($this->callback($callback));
     $ct = $this->getMockChangeTracker();
     $ct->expects($this->at(0))->method('markDeleted')->with($this->equalTo('biblio'), $this->equalTo('foo'));
     $ct->expects($this->at(1))->method('markDeleted')->with($this->equalTo('biblio'), $this->equalTo('bar'));
     $writer = new Writer($bm, $ct);
     $writer->deleteRecords('Solr', ['foo', 'bar']);
 }