示例#1
0
文件: Issue.php 项目: Br3nda/indefero
 function _toIndex()
 {
     $r = array();
     foreach ($this->get_comments_list() as $c) {
         $r[] = $c->_toIndex();
     }
     $str = str_repeat($this->summary . ' ', 4) . ' ' . implode(' ', $r);
     return Pluf_Text::cleanString(html_entity_decode($str, ENT_QUOTES, 'UTF-8'));
 }
示例#2
0
 /**
  * Search.
  *
  * Returns an array of array with model_class, model_id and
  * score. The list is already sorted by score descending.
  *
  * You can then filter the list as you wish with another set of
  * weights.
  *
  * @param string Query string.
  * @param int Project id to limit the results (null)
  * @param string Model class (null)
  * @param string Stemmer class ('Pluf_Text_Stemmer_Porter')
  * @return array Results
  */
 public static function mySearch($query, $project = null, $model = null, $stemmer = 'Pluf_Text_Stemmer_Porter')
 {
     $query = Pluf_Text::cleanString(html_entity_decode($query, ENT_QUOTES, 'UTF-8'));
     $words = Pluf_Text::tokenize($query);
     if ($stemmer != null) {
         $words = self::stem($words, $stemmer);
     }
     $words_flat = array();
     foreach ($words as $word => $c) {
         $words_flat[] = $word;
     }
     $word_ids = self::getWordIds($words_flat);
     if (in_array(null, $word_ids) or count($word_ids) == 0) {
         return array();
     }
     return self::mySearchDocuments($word_ids, $project, $model);
 }
示例#3
0
 function _toIndex()
 {
     $str = str_repeat($this->summary . ' ', 4) . ' ' . $this->fullmessage;
     return Pluf_Text::cleanString(html_entity_decode($str, ENT_QUOTES, 'UTF-8'));
 }
示例#4
0
文件: Lang.php 项目: burbuja/pluf
 /**
  * Given a string, returns the language.
  *
  * Algorithm by Cavnar et al. 94.
  *
  * @param string
  * @param bool Is the string clean (false)
  * @return array Language, Confidence
  */
 public static function detect($string, $is_clean = false)
 {
     if (!$is_clean) {
         $string = Pluf_Text::cleanString($string);
     }
 }
示例#5
0
 function _toIndex()
 {
     $rev = $this->get_current_revision()->_toIndex();
     $str = str_repeat($this->title . ' ' . $this->summary . ' ', 4) . ' ' . $rev;
     return Pluf_Text::cleanString(html_entity_decode($str, ENT_QUOTES, 'UTF-8'));
 }