Esempio n. 1
0
 /**
  * @{inheritDoc}
  */
 public function search()
 {
     $search_results = $this->client->find($this->query);
     $results = array('user_ids' => array(), 'documents' => array(), 'total' => $search_results->resultCount);
     foreach ($search_results->documents as $result) {
         $doc = $result->document;
         $results['user_ids'][] = $doc->author;
         $results['documents'][] = $doc->get_state();
     }
     return $results;
 }
Esempio n. 2
0
 /**
  * @dataProvider datatypes
  */
 public function testDataTypes1($string, $html, $bool, $int, $float, $date, $findField, $findValue)
 {
     $session = new ezcSearchSession($this->backend, new ezcSearchEmbeddedManager());
     $a = new DataTypeTest('testId', $string, $html, $bool, $int, $float, $date);
     $session->index($a);
     $q = $session->createFindQuery('DataTypeTest');
     $q->where($q->eq($findField, $findValue));
     $r = $session->find($q);
     self::assertEquals(1, $r->resultCount);
     self::assertEquals($string, $r->documents['testId']['document']->string);
     self::assertEquals($html, $r->documents['testId']['document']->html);
     self::assertEquals($bool, $r->documents['testId']['document']->bool);
     self::assertEquals($int, $r->documents['testId']['document']->int);
     self::assertEquals($float, $r->documents['testId']['document']->float);
     self::assertEquals(date_create("{$date}")->format('\\sU'), $r->documents['testId']['document']->date->format('\\sU'));
 }
<?php

$solr = new ezcSearchSolrHandler();
$session = new ezcSearchSession($solr, new ezcSearchEmbeddedManager());
$q = $session->createFindQuery('ezcSearchSimpleArticle');
$searchWords = split(' ', $searchWord);
foreach ($searchWords as $searchWord) {
    $q->where($q->eq('body', $searchWord))->where($q->eq('title', $searchWord));
}
$q->facet('type')->limit(10, $begin);
$r = $session->find($q);
Esempio n. 4
0
 /**
  * @dataProvider datatypesMulti
  */
 public function testDataTypes3($string, $html, $bool, $int, $float, $date, $findField, $findValue)
 {
     $session = new ezcSearchSession($this->backend, new ezcSearchEmbeddedManager());
     $string = is_array($string) ? $string : array($string);
     $html = is_array($html) ? $html : array($html);
     $bool = is_array($bool) ? $bool : array($bool);
     $int = is_array($int) ? $int : array($int);
     $float = is_array($float) ? $float : array($float);
     $date = is_array($date) ? $date : array($date);
     $a = new DataTypeTestMulti('testId', $string, $html, $bool, $int, $float, $date);
     $session->index($a);
     $q = $session->createFindQuery('DataTypeTestMulti');
     $q->where($q->eq($findField, $findValue));
     $r = $session->find($q);
     self::assertEquals(1, $r->resultCount);
     self::assertEquals($string, $r->documents['testId']->document->string);
     self::assertEquals($html, $r->documents['testId']->document->html);
     self::assertEquals($bool, $r->documents['testId']->document->bool);
     self::assertEquals($int, $r->documents['testId']->document->int);
     self::assertEquals($float, $r->documents['testId']->document->float);
     self::assertEquals(date_create($date[0])->format('\\sU'), $r->documents['testId']->document->date[0]->format('\\sU'));
 }