Create an {@link Index} instance
@return
@throws Exception
175153
public Index createResourceIndex() throws Exception {
        if (!ResourceIndex.INSTANCE.isLoaded()) {
            // Load resource index defined by the BELFramework instance
            final SystemConfiguration sysConfig = getSystemConfiguration();
            final String resourceIndexURL = sysConfig.getResourceIndexURL();
            File indexFile = new File(resourceIndexURL);
            if (!indexFile.exists() || !indexFile.canRead()) {
                // try the index as an online resource.
                ResolvedResource resolvedResource = cacheService
                        .resolveResource(ResourceType.RESOURCE_INDEX,
                                resourceIndexURL);
                indexFile = resolvedResource.getCacheResourceCopy();
            }

            ResourceIndex.INSTANCE.loadIndex(indexFile);
        }
        return ResourceIndex.INSTANCE.getIndex();
    }
1094779
@Override
  public Result<MZMLIndexElement> buildIndex(final Info info) throws Exception {

    Result<MZMLIndexElement> result = new IndexBuilder.Result<>(info);
    vars.reset();

    XMLStreamReaderImpl reader = (pool == null) ? new XMLStreamReaderImpl() : pool.borrowObject();
    try {
      reader.setInput(info.is, StandardCharsets.UTF_8.name());
      LogHelper.setJavolutionLogLevelFatal();

      int eventType;
      do {
        // Read the next XML element
        try {
          eventType = reader.next();
        } catch (XMLStreamException e) {

          if (e instanceof XMLUnexpectedEndTagException) {
            // it's ok to have unexpected closing tags
            eventType = reader.getEventType();
          } else if (e instanceof XMLUnexpectedEndOfDocumentException) {
            // as we're reading arbitrary chunks of file, we will almost always finish parsing by hitting this condition
            break;
          } else {
            throw new FileParsingException(e);
          }
        }

        // process the read event
        switch (eventType) {

          case XMLStreamConstants.START_ELEMENT:
            CharArray localName = reader.getLocalName();
            Attributes attrs = reader.getAttributes();

            if (localName.contentEquals(MZMLMultiSpectraParser.TAG.SPECTRUM.name)) {

              if (vars.offsetLo != null) {
                throw new FileParsingException("Nested spectrum tags not allowed in mzml.");
              }

              // these are required attributes, if they're not there, just throw an exception
              try {
                vars.spectrumIndex = attrs.getValue(MZMLMultiSpectraParser.ATTR.SPECTRUM_INDEX.name)
                    .toInt();
                vars.spectrumId = attrs.getValue(MZMLMultiSpectraParser.ATTR.SPECTRUM_ID.name)
                    .toString();
                vars.offsetLo = reader.getLocation().getLastStartTagPos();
                addAndFlush(result, info.offsetInFile);

              } catch (NumberFormatException e) {
                throw new FileParsingException("Malformed scan number while building index", e);
              }
            }
            break;

          case XMLStreamConstants.CHARACTERS:
            break;

          case XMLStreamConstants.END_ELEMENT:
            localName = reader.getLocalName();

            if (localName.contentEquals(MZMLMultiSpectraParser.TAG.SPECTRUM.name)) {
              vars.offsetHi = reader.getLocation().getTotalCharsRead();
              addAndFlush(result, info.offsetInFile);
            }

            break;
        }

      } while (eventType != XMLStreamConstants.END_DOCUMENT);

    } finally {
      addAndFlush(result, info.offsetInFile);

      // we need to return the reaer to the pool, if we borrowed it from there
      if (pool != null && reader != null) {
        pool.returnObject(reader);
      }
    }

    return result;
  }
7596
@Override
	public void visit(SQLProperty property) throws Exception {
		// add property index
		classBuilder.addField(FieldSpec.builder(Integer.TYPE, "index"+(counter++), Modifier.PROTECTED).addJavadoc("Index for column $S\n", property.getName()).build());

	}
358567
private void initIndex() throws Exception {

        // 0. Add the tasklog template
        GetIndexTemplatesResponse result = elasticSearchClient.admin()
            .indices()
            .prepareGetTemplates("tasklog_template")
            .execute()
            .actionGet();

        if (result.getIndexTemplates().isEmpty()) {
            logger.info("Creating the index template 'tasklog_template'");
            InputStream stream = ElasticSearchDAOV5.class
                .getResourceAsStream("/template_tasklog.json");
            byte[] templateSource = IOUtils.toByteArray(stream);

            try {
                elasticSearchClient.admin()
                    .indices()
                    .preparePutTemplate("tasklog_template")
                    .setSource(templateSource, XContentType.JSON)
                    .execute()
                    .actionGet();
            } catch (Exception e) {
                logger.error("Failed to init tasklog_template", e);
            }
        }
    }
1056429
public static JMDictSense create() {
		if (index >= instances.size()) {
			instances.add(new JMDictSense());
		}
		return instances.get(index++);
	}
695664
private void initMappings() throws Exception {
        checkClient();
        // We extract indexes and mappings to manage from mappings definition
        if (mappings != null && mappings.length > 0) {
            Map<String, Collection<String>> indices = getIndexMappings(mappings);

            // Let's initialize indexes and mappings if needed
            for (String index : indices.keySet()) {
                createIndex(client.getLowLevelClient(), classpathRoot, index, forceMapping);
                if (mergeSettings) {
                    updateSettings(client.getLowLevelClient(), classpathRoot, index);
                }

                createMapping(client, classpathRoot, index, mergeMapping);
            }
        }
    }
1105481
public Snapshot createSnapshot(long index) {
    SnapshotDescriptor descriptor = SnapshotDescriptor.builder()
      .withIndex(index)
      .withTimestamp(System.currentTimeMillis())
      .build();
    return createSnapshot(descriptor);
  }
1047978
int createPathUserIndex() {
		if (m_pathindices == null)
			m_pathindices = new ArrayList<AttributeStreamOfInt32>(0);
		// Try getting existing index. Use linear search. We do not expect many
		// indices to be created.
		for (int i = 0; i < m_pathindices.size(); i++) {
			if (m_pathindices.get(i) == null) {
				m_pathindices.set(i,
						(AttributeStreamOfInt32) (AttributeStreamBase
								.createIndexStream(0)));
				return i;
			}
		}

		m_pathindices.add((AttributeStreamOfInt32) (AttributeStreamBase
				.createIndexStream(0)));
		return (int) (m_pathindices.size() - 1);
	}
1085886
private static void createTypeWithMappingInElasticsearch(RestHighLevelClient client, String index, String mapping)
            throws Exception {
        logger.trace("createTypeWithMappingInElasticsearch([{}])", index);

        assert client != null;
        assert index != null;

        if (mapping != null) {
            // Create mapping
            client.indices().putMapping(new PutMappingRequest(index).source(mapping, XContentType.JSON), RequestOptions.DEFAULT);
        } else {
            logger.trace("no content given for mapping. Ignoring mapping creation in index [{}].", index);
        }

        logger.trace("/createTypeWithMappingInElasticsearch([{}])", index);
    }
147246
public static <T> Indexed<T> index(long index, T value) {
        return new Indexed<>(index, value);
    }
1336756
public Index<SecondaryTable<T>> getOrCreateIndex()
   {
      List<Node> nodeList = childNode.get("index");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new IndexImpl<SecondaryTable<T>>(this, "index", childNode, nodeList.get(0));
      }
      return createIndex();
   }
880908
public function build($index, $default = null, $params = [])
    {
        $class = $this->get($index, $default);
        if (!class_exists($class)) {
            throw new \Exception('Class doesn\'t exist for the index : ' .$index);
        }

        $class = new \ReflectionClass($class);
        return $class->newInstanceArgs($params);
    }
14417
public static <T> PositionFactory<Iterable<? extends T>, T> atIndex(final int index) {
        return new PositionFactory<Iterable<? extends T>, T>(index) {

            @Override
            public String toString() {
                return String.format("Element [%s]", index);
            }

            @Override
            protected <P> Type evaluateElementType(Position<P> parentPosition) {
                return TypeUtils.getTypeArguments(parentPosition.getType(), Iterable.class)
                    .get(Iterable.class.getTypeParameters()[0]);
            }
        };
    }
1029948
protected function createOn($meta, $fromIndex, $relatedMeta, $toIndex)
    {
        if (!isset($meta->indexes[$fromIndex])) {
            throw new Exception("Index $fromIndex does not exist on {$meta->id}");
        }
        if (!isset($relatedMeta->indexes[$toIndex])) {
            throw new Exception("Index $toIndex does not exist on {$relatedMeta->id}");
        }

        $on = [];

        // If an index exists, you don't need to join on all of it.
        // This assumes that the indexes are properly numbered. If not, BOOM!
        foreach ($meta->indexes[$fromIndex]['fields'] as $idx=>$fromField) {
            if (!isset($relatedMeta->indexes[$toIndex]['fields'][$idx])) {
                break;
            }
            $on[$fromField] = $relatedMeta->indexes[$toIndex]['fields'][$idx];
        }

        return $on;
    }
285179
def create_index(self, index):
    

    index._path = os.path.join(self.indexes_path, index._name)

    if whoosh.index.exists_in(index._path):
      _whoosh = whoosh.index.open_dir(index._path)
    elif not os.path.exists(index._path):
      os.makedirs(index._path)
      _whoosh = whoosh.index.create_in(index._path, index._schema)
    index._whoosh = _whoosh
56205
public function getIndexConfigurator()
    {
        static $indexConfigurator;

        if (! $indexConfigurator) {
            if (! isset($this->indexConfigurator) || empty($this->indexConfigurator)) {
                throw new Exception(sprintf(
                    'An index configurator for the %s model is not specified.',
                    __CLASS__
                ));
            }

            $indexConfiguratorClass = $this->indexConfigurator;
            $indexConfigurator = new $indexConfiguratorClass;
        }

        return $indexConfigurator;
    }
30626
public synchronized static Index createIndex(Class<?> type) {
        Index index = indices.get(type);
        if (index == null) {
            try {
                Indexer indexer = new Indexer();
                Class<?> currentType = type;
                while ( currentType != null ) {
                    String className = currentType.getName().replace(".", "/") + ".class";
                    InputStream stream = type.getClassLoader()
                            .getResourceAsStream(className);
                    indexer.index(stream);
                    currentType = currentType.getSuperclass();
                }
                index = indexer.complete();
                indices.put(type, index);
            } catch (IOException e) {
                throw new RuntimeException("Failed to initialize Indexer", e);
            }
        }
        return index;
    }