Creates index worker instances for each class to index

        kwargs:
        -------
            idx_only_base[bool]: True will only index the base class
345764
def _set_es_workers(self, **kwargs):
        
        def make_es_worker(search_conn, es_index, es_doc_type, class_name):
            """
            Returns a new es_worker instance

            args:
            -----
                search_conn: the connection to elasticsearch
                es_index: the name of the elasticsearch index
                es_doc_type: the name of the elasticsearch doctype
                class_name: name of the rdf class that is being indexed
            """
            new_esbase = copy.copy(search_conn)
            new_esbase.es_index = es_index
            new_esbase.doc_type = es_doc_type
            log.info("Indexing '%s' into ES index '%s' doctype '%s'",
                     class_name.pyuri,
                     es_index,
                     es_doc_type)
            return new_esbase

        def additional_indexers(rdf_class):
            """
            returns additional classes to index based off of the es definitions
            """
            rtn_list = rdf_class.es_indexers()
            rtn_list.remove(rdf_class)
            return rtn_list


        self.es_worker = make_es_worker(self.search_conn,
                                        self.es_index,
                                        self.es_doc_type,
                                        self.rdf_class.__name__)
        if not kwargs.get("idx_only_base"):
            self.other_indexers = {item.__name__: make_es_worker(
                        self.search_conn,
                        item.es_defs.get('kds_esIndex')[0],
                        item.es_defs.get('kds_esDocType')[0],
                        item.__name__)
                    for item in additional_indexers(self.rdf_class)}
        else:
            self.other_indexers = {}
1348070
def create_index(self, mappings_file, delete=True):
        

        if self._read_only:
            raise IOError("Cannot write, Connector created as Read Only")

        if delete:
            logger.info(self.__log_prefix + " Deleting index " + self._es_index)
            self._es_conn.indices.delete(self._es_index, ignore=[400, 404])

        # Read Mapping
        with open(mappings_file) as f:
            mapping = f.read()

        self._es_conn.indices.create(self._es_index, body=mapping)
1371761
def build_index(self, idx_name, _type='default'):
        ""
        indexes = {}
        has_non_string_values = False
        for key, item in self.data.items():
            if idx_name in item:
                value = item[idx_name]
                # A non-string index value switches it into a lazy one.
                if not isinstance(value, six.string_types):
                    has_non_string_values = True
                if value not in indexes:
                    indexes[value] = set([])
                indexes[value].add(key)
        self.indexes[idx_name] = indexes
        if self._meta.lazy_indexes or has_non_string_values:
            # Every index is lazy
            _type = 'lazy'
        self.index_defs[idx_name] = {'type': _type}
51090
def _build_index():
    
    global _module_file_index
    _module_file_index = {
        mod.__file__: mod.__name__
        for mod in sys.modules.values()
        if hasattr(mod, '__file__') and hasattr(mod, '__name__')
    }
1336356
def create_index(self, key, reindex=True, sparse=False):
        
        warnings.warn('Index support is currently very alpha and is not guaranteed')
        if isinstance(key, (list, tuple)):
            index_name = ','.join(key)
            index_columns = ', '.join('%s text' % f for f in key)
        else:
            index_name = key
            index_columns = '%s text' % key

        table_name = '[%s{%s}]' % (self.name, index_name)
        reindex = reindex or not self._object_exists('table', table_name)

        # Create a table store for the index data
        self.db.execute("""
            create table if not exists {table} (
                id integer primary key,
                {columns},
                foreign key(id) references {collection}(id) on delete cascade on update cascade
            )
        """.format(
            table=table_name,
            collection=self.name,
            columns=index_columns
        ))

        # Create the index
        self.db.execute("""
            create index if not exists [idx.{collection}{{index}}] on {table}({index})
        """.format(
            collection=self.name,
            index=index_name,
            table=table_name,
        ))

        if reindex:
            self.reindex(key)
656074
def create_index(manager, prop, node_type='Node'):
    
    with manager.session as s:
        s.run('CREATE INDEX ON :{node_type}({prop})'.format(node_type=node_type, prop=prop))
83607
def create_index(column_names, unique=False):
    
    connection = _State.connection()
    _State.reflect_metadata()
    table_name = _State.table.name

    table = _State.table

    index_name = re.sub(r'[^a-zA-Z0-9]', '', table_name) + '_'
    index_name += '_'.join(re.sub(r'[^a-zA-Z0-9]', '', x)
                           for x in column_names)

    if unique:
        index_name += '_unique'

    columns = []
    for column_name in column_names:
        columns.append(table.columns[column_name])

    current_indices = [x.name for x in table.indexes]
    index = sqlalchemy.schema.Index(index_name, *columns, unique=unique)
    if index.name not in current_indices:
        index.create(bind=_State.engine)
898716
def index_all(klass, ids, options = {})
      Entry.enqueue(self, klass, ids, false, options[:priority] || self.class.default_priority)
    end
1346189
def with_indices(*args):
    '''
    
    '''
    def decorator(cls):
        for c in cls.__bases__:
            if hasattr(c, '_indicesNames'):
                cls._classnameIndex = c._classnameIndex + 1
                for i in range(0, cls._classnameIndex):
                    setattr(cls, '_classname' + str(i), getattr(c, '_classname' + str(i)))
                setattr(cls, '_classname' + str(cls._classnameIndex), cls._getTypename())
                cls._indicesNames = c._indicesNames + ('_classname' + str(cls._classnameIndex),) + args
                cls._generateTemplate()
                return cls
        cls._classnameIndex = -1
        cls._indicesNames = args
        cls._generateTemplate()
        return cls
    return decorator
395881
private final void onEachIndex( ProvidedIndexOperation op ) {
        for (String workspaceName : workspaceNames()) {
            Collection<AtomicIndex> indexes = providedIndexesFor(workspaceName);
            if (indexes != null) {
                for (AtomicIndex atomicIndex : indexes) {
                    assert atomicIndex.managed() != null;
                    assert atomicIndex.indexDefinition() != null;
                    op.apply(workspaceName, atomicIndex);
                }
            }
        }
    }
821803
function Worker(baseUrl, opts = {}) {

  if (!(this instanceof Worker)) {
    return new Worker(baseUrl, opts);
  }

  // inheritance
  Emitter.call(this);

  this.options = extend({
    workerId: uuid.v4()
  }, defaultOptions, opts);

  this.subscriptions = {};

  this.state = STATE_NEW;

  // apply extensions
  if (this.options.use) {
    this.extend(this.options.use);
  }

  // local variables
  this.engineApi = new EngineApi(
    baseUrl,
    this.options.requestOptions,
    this.options.apiVersion
  );

  if (this.options.pollingDelay) {
    throw new Error('options.pollingDelay got replaced with options.autoPoll');
  }

  // start
  if (this.options.autoPoll) {
    this.start();
  }
}
714491
def index(self, values=None, only_index=None):
        
        assert self.indexable, "Field not indexable"
        assert not only_index or self.has_index(only_index), "Invalid index"
        if only_index:
            only_index = only_index if isclass(only_index) else only_index.__class__

        if values is None:
            values = self.proxy_get()

        for value in values:
            if value is not None:
                needs_to_check_uniqueness = bool(self.unique)

                for index in self._indexes:
                    if only_index and not isinstance(index, only_index):
                        continue

                    index.add(value, check_uniqueness=needs_to_check_uniqueness and index.handle_uniqueness)

                    if needs_to_check_uniqueness and index.handle_uniqueness:
                        # uniqueness check is done for this value
                        needs_to_check_uniqueness = False
422009
def create_index(self):
        
        es = self._init_connection()
        if not es.indices.exists(index=self.index):
            es.indices.create(index=self.index, body=self.settings)
823302
def create_index(self, columns, name=None, **kw):
        
        columns = [normalize_column_name(c) for c in ensure_tuple(columns)]
        with self.db.lock:
            if not self.exists:
                raise DatasetException("Table has not been created yet.")

            for column in columns:
                if not self.has_column(column):
                    return

            if not self.has_index(columns):
                self._threading_warn()
                name = name or index_name(self.name, columns)
                columns = [self.table.c[c] for c in columns]
                idx = Index(name, *columns, **kw)
                idx.create(self.db.executable)
957564
def indexables(self):
        
        if self._indexables is None:

            self._indexables = []

            # index columns
            self._indexables.extend([
                IndexCol(name=name, axis=axis, pos=i)
                for i, (axis, name) in enumerate(self.attrs.index_cols)
            ])

            # values columns
            dc = set(self.data_columns)
            base_pos = len(self._indexables)

            def f(i, c):
                klass = DataCol
                if c in dc:
                    klass = DataIndexableCol
                return klass.create_for_block(i=i, name=c, pos=base_pos + i,
                                              version=self.version)

            self._indexables.extend(
                [f(i, c) for i, c in enumerate(self.attrs.values_cols)])

        return self._indexables
167756
def create(self, name, index=None):
        
        if index is None:
            index = len(self)
        self._create(name, index)
        return self[name]
1342428
def get_indexes_from_base(self):
        
        if self.is_indexed:
            return np.copy(self.order[i])
        if self.data.base is None:
            i = 0
        else:
            i = self.get_raw_index(0)
        return np.arange(i, i + len(self), dtype=np.uint32)