예제 #1
0
파일: Server.php 프로젝트: rjsmelo/tiki
 function getMatchingConnections($criteria)
 {
     $index = $this->getIndex();
     ZendSearch\Lucene\Search\Query\Wildcard::setMinPrefixLength(0);
     ZendSearch\Lucene\Lucene::setResultSetLimit(25);
     // TODO during dev
     $results = $index->find($criteria);
     $ret = array();
     foreach ($results as $hit) {
         $res = array();
         $res['created'] = $hit->created;
         try {
             $res['title'] = $hit->title;
         } catch (ZendSearch\Lucene\Exception\ExceptionInterface $e) {
             $res['title'] = '';
         }
         try {
             $res['url'] = $hit->url;
         } catch (ZendSearch\Lucene\Exception\ExceptionInterface $e) {
             $res['url'] = '';
         }
         try {
             $res['keywords'] = $hit->keywords;
         } catch (ZendSearch\Lucene\Exception\ExceptionInterface $e) {
             $res['keywords'] = '';
         }
         try {
             $res['language'] = $hit->language;
         } catch (ZendSearch\Lucene\Exception\ExceptionInterface $e) {
             $res['language'] = '';
         }
         try {
             $res['geo_lat'] = $hit->geo_lat;
         } catch (ZendSearch\Lucene\Exception\ExceptionInterface $e) {
             $res['geo_lat'] = '';
         }
         try {
             $res['geo_lon'] = $hit->geo_lon;
         } catch (ZendSearch\Lucene\Exception\ExceptionInterface $e) {
             $res['geo_lon'] = '';
         }
         try {
             $res['geo_zoom'] = $hit->geo_zoom;
         } catch (ZendSearch\Lucene\Exception\ExceptionInterface $e) {
             $res['geo_zoom'] = '';
         }
         $res['class'] = 'tablename';
         $res['metadata'] = '';
         if ($res['geo_lat'] && $res['geo_lon']) {
             $res['class'] .= ' geolocated connection';
             $res['metadata'] = " data-geo-lat=\"{$res['geo_lat']}\" data-geo-lon=\"{$res['geo_lon']}\"";
             if (isset($res['geo_zoom'])) {
                 $res['metadata'] .= " data-geo-zoom=\"{$res['geo_zoom']}\"";
             }
             $res['metadata'] .= ' data-icon-name="tiki"';
         }
         $ret[] = $res;
     }
     return $ret;
 }
예제 #2
0
파일: Index.php 프로젝트: linuxwhy/tiki-1
 private function getLucene()
 {
     if ($this->lucene) {
         return $this->lucene;
     }
     try {
         $this->lucene = ZendSearch\Lucene\Lucene::open($this->directory);
     } catch (ZendSearch\Lucene\Exception\ExceptionInterface $e) {
         $this->lucene = ZendSearch\Lucene\Lucene::create($this->directory);
     }
     global $prefs;
     if (!empty($prefs['unified_lucene_max_buffered_docs'])) {
         // these break indexing if set empty
         $this->lucene->setMaxBufferedDocs($prefs['unified_lucene_max_buffered_docs']);
         // default is 10
     }
     if (!empty($prefs['unified_lucene_max_merge_docs'])) {
         $this->lucene->setMaxMergeDocs($prefs['unified_lucene_max_merge_docs']);
         // default is PHP_INT_MAX (effectively "infinite")
     }
     if (!empty($prefs['unified_lucene_merge_factor'])) {
         $this->lucene->setMergeFactor($prefs['unified_lucene_merge_factor']);
         // default is 10
     }
     ZendSearch\Lucene\Lucene::setResultSetLimit($this->resultSetLimit);
     return $this->lucene;
 }