/**
  * @group query1
  */
 public function testGetQuery_SearchInAllFields()
 {
     $document = new Document();
     $document->addField('id', 'validtestentity_1');
     $query = new FindByDocumentNameQuery();
     $query->setDocumentName('validtestentity');
     $query->setDocument($document);
     $queryString = $query->getQuery();
     $this->assertEquals('id:validtestentity_*', $queryString, 'filter query');
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function findAll()
 {
     $mapper = $this->solr->getMapper();
     $mapper->setMappingCommand($this->solr->getCommandFactory()->get('all'));
     $metaInformation = $this->solr->getMetaFactory()->loadInformation($this->entity);
     $document = $mapper->toDocument($metaInformation);
     if (null === $document) {
         return null;
     }
     $document->removeField('id');
     $query = new FindByDocumentNameQuery();
     $query->setRows(1000000);
     $query->setDocumentName($metaInformation->getDocumentName());
     $query->setIndex($metaInformation->getIndex());
     $query->setDocument($document);
     $query->setEntity($this->entity);
     $query->setSolr($this->solr);
     $query->setHydrationMode($this->hydrationMode);
     return $this->solr->query($query);
 }
Пример #3
0
 public function testQuery_OneDocumentFound()
 {
     $arrayObj = new SolrDocumentStub(array('title_s' => 'title'));
     $document = new Document();
     $document->addField('document_name_s', 'name');
     $query = new FindByDocumentNameQuery();
     $query->setDocumentName('name');
     $query->setDocument($document);
     $query->setEntity(new ValidTestEntity());
     $query->setIndex('index0');
     $this->assertQueryWasExecuted(array($arrayObj), 'index0');
     $solr = new Solr($this->solrClientFake, $this->commandFactory, $this->eventDispatcher, $this->metaFactory, $this->mapper);
     $entities = $solr->query($query);
     $this->assertEquals(1, count($entities));
 }