Overview

Namespaces

  • elasticsearch

Classes

  • Config
  • Defaults
  • Faceting
  • Indexer
  • Searcher
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: namespace elasticsearch;
 3: 
 4: /**
 5: * Returns a set of default values that are sufficient for indexing wordpress if the user does not set any values.
 6: *
 7: * @license http://opensource.org/licenses/MIT
 8: * @author Paris Holley <[email protected]>
 9: * @version 2.0.0
10: **/
11: class Defaults{
12:     /**
13:     * Useful field names that wordpress provides out the box
14:     *
15:     * @return string[] field names
16:     **/
17:     static function fields(){
18:         return array('post_content', 'post_title');
19:     }
20: 
21:     /**
22:     * Returns any post types currently defined in wordpress
23:     *
24:     * @return string[] post type names
25:     **/
26:     static function types(){
27:         $types = get_post_types();
28: 
29:         $available = array();
30: 
31:         foreach($types as $type){
32:             $tobject = get_post_type_object($type);
33: 
34:             if(!$tobject->exclude_from_search && $type != 'attachment'){
35:                 $available[] = $type;
36:             }
37:         }
38: 
39:         return $available;
40:     }
41: 
42:     /**
43:     * Returns any taxonomies registered for the provided post types
44:     *
45:     * @return string[] taxonomy slugs
46:     **/
47:     static function taxonomies($types){
48:         $taxes = array();
49: 
50:         foreach($types as $type){
51:             $taxes = array_merge($taxes, get_object_taxonomies($type));
52:         }
53: 
54:         return array_unique($taxes); 
55:     }
56: }
57: ?>
58: 
API documentation generated by ApiGen 2.8.0