Ejemplo n.º 1
0
 public function get_indexed_types()
 {
     if (is_null($this->indexed_types)) {
         $collection = new vB_Collection_ContentType();
         $collection->filterSearchable(true);
         $this->indexed_types = array();
         foreach ($collection as $type) {
             $search_type = $this->get_search_type_from_id($type->getID());
             if ($search_type->is_enabled()) {
                 $value = array();
                 $value['contenttypeid'] = $type->getID();
                 $value['package'] = $type->getPackageClass();
                 $value['class'] = $type->getClass();
                 $this->indexed_types[$type->getID()] = $value;
             }
         }
     }
     return $this->indexed_types;
 }
 /**
  * Build list of indexes, required for used content types.
  *
  */
 protected function _get_sphinx_indices($content_types = null)
 {
     $indexes = array();
     if (!empty($content_types) and !is_array($content_types)) {
         $content_types = array(vB_Types::instance()->getContentTypeId($content_types));
     } elseif (empty($content_types)) {
         global $vbulletin;
         // Additional setting for our product.
         // Show quick search results as snippets or as threads
         if ($vbulletin->options['sph_quick_search_results_as_post']) {
             // If show as threads - grouping required
             $this->_require_grouping = true;
         }
     }
     $collection = new vB_Collection_ContentType();
     $collection->filterSearchable(true);
     foreach ($collection as $type) {
         $content_type_id = $type->getID();
         if ($content_type_id == vB_Types::instance()->getContentTypeId('vBForum_Thread')) {
             // We use the same index for Posts & Threads
             $content_type_id = vB_Types::instance()->getContentTypeId('vBForum_Post');
         }
         if (!empty($content_types) and !in_array($content_type_id, $content_types)) {
             continue;
         }
         $sphinx_index = vBSphinxSearch_Core::get_sphinx_index_map($content_type_id);
         if (!empty($sphinx_index)) {
             if ($this->_single_index_enabled) {
                 $indexes[] = $sphinx_index[0];
             } else {
                 $indexes[] = implode(",", $sphinx_index);
             }
         }
     }
     return implode(", ", $indexes);
 }