Starts the generation of the indices.

@throws WikiApiException
if an error occurs
966919
public void generate()
		throws WikiApiException
	{
		Indexer data = null;
		try {
			data = new Indexer(config);

			System.out.println("GENERATING INDEX STARTED");

			long bufferSize = config.getBufferSize();
			Revision rev;
			long count = 0;
			long last = 0, now, start = System.currentTimeMillis();

			Iterator<Revision> it = new IndexIterator(config);
			while (it.hasNext()) {

				if (++count % bufferSize == 0) {
					now = System.currentTimeMillis() - start;
					System.out.println(Time.toClock(now) + "\t" + (now - last)
							+ "\tINDEXING " + count);
					last = now;
				}

				rev = it.next();
				data.index(rev);
			}

			System.out.println("GENERATING INDEX ENDED + ("
					+ Time.toClock(System.currentTimeMillis() - start) + ")");

		}
		catch (Exception e) {

			throw new WikiApiException(e);

		}
		finally {
			if (data != null) {
				data.close();
			}
		}
	}
926679
public static void main(String[] args) throws ParseException, IOException {
		Client client = new Client(
				new DumpProcessingController("wikidatawiki"), args);
		client.performActions();
	}
424157
public void updateIndex() {

        if (!isEnabled()) {
            return;
        }

        final IndexWriterConfig indexWriterConfig = new IndexWriterConfig(new StandardAnalyzer());
        indexWriterConfig
                .setCommitOnClose(true)
                .setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND);

        try (IndexWriter indexWriter = new IndexWriter(directory, indexWriterConfig)) {
            final List<IPortletDefinition> portlets = portletRegistry.getAllPortletDefinitions();
            portlets.forEach(portlet -> indexPortlet(portlet, indexWriter));
        } catch (Exception e) {
            logger.error("Unable to update index", e);
        }
    }
270007
def _initialize_indices(model_class, name, bases, attrs):
    """"""
    model_class._indices = []
    for k, v in attrs.iteritems():
        if isinstance(v, (Attribute, ListField)) and v.indexed:
            model_class._indices.append(k)
    if model_class._meta['indices']:
        model_class._indices.extend(model_class._meta['indices'])
725219
public void generateClasses() throws IOException {
		for (PrefsEntity item : model.getEntities()) {
			BindSharedPreferencesBuilder.generate(elementUtils, filer, item);
		}
	}
877139
def begin(self):
        
        self.url = self.server.wiki.create(self)
        if not self.testmode:
            self.commit.create_status("pending", self.url, "Running unit tests...")
442608
@Override
    public void startIndexing() {
        metrics.startIndexing(allGenerators);
        context.clearIndex();
        buildInternalIndex();
        buildExternalIndex();
        context.buildCompositeIndex();
        metrics.stopIndexing();
    }
1209113
public void index(final Revision rev)
		throws WikiApiException
	{

		int articleID = rev.getArticleID();
		int fullRevisionID = rev.getFullRevisionID();
		int revisionCounter = rev.getRevisionCounter();

		if (articleID != currentArticleID) {

			if (lastRev != null) {
				info.setEndRevisionCount(lastRev.getRevisionCounter());
				this.infoList.add(info);

				try {
					this.articleIndex.add(currentArticleID, startTime, endTime,
							infoList);
					send();
				}
				catch (SQLException sql) {
					sql.printStackTrace();
					throw new WikiApiException(sql);
				}
				catch (IOException sql) {
					sql.printStackTrace();
					throw new WikiApiException(sql);
				}
			}

			if (revisionCounter != 1) {
				System.err.println("WARNING : ArticleID (" + articleID
						+ ") RevisionCounter 1 expected - " + revisionCounter
						+ " read");
			}

			startTime = Long.MAX_VALUE;
			endTime = Long.MIN_VALUE;

			currentArticleID = articleID;
			currentFullRevisionID = fullRevisionID;

			info = new ArticleIndexData();

			info.setFullRevisionPrimaryKey(rev.getPrimaryKey());
			info.setStartRevisionCount(rev.getRevisionCounter());

		}
		else if (fullRevisionID != currentFullRevisionID) {

			if (lastRev.getRevisionCounter() + 1 != revisionCounter) {
				System.err.println("WARNING : ArticleID (" + articleID + ")"
						+ " RevisionCounter "
						+ (lastRev.getRevisionCounter() + 1) + " expected - "
						+ revisionCounter + " read");
			}

			info.setEndRevisionCount(lastRev.getRevisionCounter());
			this.infoList.add(info);

			currentFullRevisionID = fullRevisionID;
			info = new ArticleIndexData();

			info.setFullRevisionPrimaryKey(rev.getPrimaryKey());
			info.setStartRevisionCount(rev.getRevisionCounter());

		}
		else if (lastRev.getRevisionCounter() + 1 != revisionCounter) {

			System.err.println("WARNING : ArticleID (" + articleID + ")"
					+ " RevisionCounter " + (lastRev.getRevisionCounter() + 1)
					+ " expected - " + revisionCounter + " read");
		}

		this.startTime = Math.min(rev.getTimeStamp().getTime(), startTime);
		this.endTime = Math.max(rev.getTimeStamp().getTime(), endTime);

		revisionIndex.add(rev.getRevisionID(), rev.getPrimaryKey(),
				info.getFullRevisionPrimaryKey());
		chronoIndex.add(articleID, rev.getRevisionCounter(), rev.getTimeStamp()
				.getTime());
		lastRev = rev;
	}
169608
public void finish() throws IOException{

		writer.write("CREATE INDEX articleIdx ON revisions(ArticleID);\r\n");
		writer.write("ALTER TABLE index_articleID_rc_ts ENABLE KEYS;\r\n");
		writer.write("ALTER TABLE index_revisionID ENABLE KEYS;\r\n");
		writer.write("ALTER TABLE index_chronological ENABLE KEYS;\r\n");
		writer.flush();

	}
1042799
public function startIndexingAction()
    {
        // make indexer instance and init
        /* @var $indexer IndexerRunner */
        $indexer = GeneralUtility::makeInstance(IndexerRunner::class);

        // get indexer configurations
        $indexerConfigurations = $indexer->getConfigurations();

        // get uri builder
        $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);

        $content = '';

        // action: start indexer or remove lock
        if ($this->do == 'startindexer') {
            // start indexing in verbose mode with cleanup process
            $content .= $indexer->startIndexing(true, $this->extConf);
        } else {
            if ($this->do == 'rmLock') {
                // remove lock from registry - admin only!
                if ($this->getBackendUser()->isAdmin()) {
                    $this->registry->removeAllByNamespace('tx_kesearch');
                } else {
                    $content .=
                        '<p>'
                        . LocalizationUtility::translate(
                            'LLL:EXT:ke_search/Resources/Private/Language/locallang_mod.xml:not_allowed_remove_indexer_lock',
                            'KeSearch'
                        )
                        . '</p>';
                }
            }
        }


        // check for index process lock in registry
        // remove lock if older than 12 hours
        $lockTime = $this->registry->get('tx_kesearch', 'startTimeOfIndexer');
        $compareTime = time() - (60 * 60 * 12);
        if ($lockTime !== null && $lockTime < $compareTime) {
            // lock is older than 12 hours
            // remove lock and show "start index" button
            $this->registry->removeAllByNamespace('tx_kesearch');
            $lockTime = null;
        }

        // show information about indexer configurations and number of records
        // if action "start indexing" is not selected
        if ($this->do != 'startindexer') {
            $content .= $this->printNumberOfRecords();
            $content .= $this->printIndexerConfigurations($indexerConfigurations);
        }

        // show "start indexing" or "remove lock" button
        if ($lockTime !== null) {
            if (!$this->getBackendUser()->isAdmin()) {
                // print warning message for non-admins
                $content .= '<br /><p style="color: red; font-weight: bold;">WARNING!</p>';
                $content .= '<p>The indexer is already running and can not be started twice.</p>';
            } else {
                // show 'remove lock' button for admins
                $content .= '<br /><p>The indexer is already running and can not be started twice.</p>';
                $content .= '<p>The indexing process was started at ' . strftime('%c', $lockTime) . '.</p>';
                $content .= '<p>You can remove the lock by clicking the following button.</p>';
                $moduleUrl = $uriBuilder->buildUriFromRoute(
                    'web_KeSearchBackendModule',
                    [
                        'id' => $this->id,
                        'do' => 'rmLock'
                    ]
                );
                $content .= '<br /><a class="lock-button" href="' . $moduleUrl . '">RemoveLock</a>';
            }
        } else {
            // no lock set - show "start indexer" link if indexer configurations have been found
            if ($indexerConfigurations) {
                $moduleUrl = $uriBuilder->buildUriFromRoute(
                    'web_KeSearchBackendModule',
                    [
                        'id' => $this->id,
                        'do' => 'startindexer'
                    ]
                );
                $content .= '<br /><a class="index-button" href="' . $moduleUrl . '">'
                    .
                    LocalizationUtility::translate(
                        'LLL:EXT:ke_search/Resources/Private/Language/locallang_mod.xml:start_indexer',
                        'KeSearch'
                    )
                    . '</a>';
            } else {
                $content .=
                    '<div class="alert alert-info">'
                    .
                    LocalizationUtility::translate(
                        'LLL:EXT:ke_search/Resources/Private/Language/locallang_mod.xml:no_indexer_configurations',
                        'KeSearch'
                    )
                    . '</div>';
            }
        }

        $this->view->assign('content', $content);
    }
685147
private function loadIndexes(): void
    {
        if (null !== $this->gsi) {
            return;
        }

        $this->gsi = [];
        foreach ($this->getIndexes() as $gsi) {
            $this->gsi[$gsi->getAlias()] = $gsi;
        }
    }
285795
protected function initIndexesInfo()
    {
        $this->_indexNames = [];
        $this->_indexTypes = [];
        $indexes = $this->findIndexes();
        foreach ($indexes as $index) {
            $indexName = $index['Index'];
            $this->_indexNames[] = $indexName;
            $this->_indexTypes[$indexName] = $index['Type'];
        }
    }
1175947
protected void startThread() {

        m_reportPanel.setVisible(true);
        m_startPanel.setVisible(false);
        Component report = m_manager.getUpdateThreadComponent(m_indexList);
        report.setHeight("500px");
        report.setWidth("100%");
        m_layout.removeAllComponents();
        m_layout.addComponent(report);
    }
752685
public function initIndices()
    {
        $elems = $this->node->xpath("value[@key='indices']");
        $this->indices = $this->getFormatter()->createIndices($this, $elems[0]);

        return $this;
    }
851100
private void initializeIfNeeded() throws BackendInitializationException,
            BackendNewInstanceException {
        if (isClosed()) {
            throw new IllegalStateException("Knowledge source already closed!");
        }
        if (this.inDataSourceGetter == null) {
            this.inDataSourceGetter
                    = new SubtreePropositionDefinitionGetterRegular(this, true);
        }
        if (this.collectSubtreeGetter == null) {
            this.collectSubtreeGetter
                    = new SubtreePropositionDefinitionGetterRegular(this, false);
        }
    }
329333
private synchronized void initOut() throws IOException
   {
      if (out == null)
      {
         OutputStream os = new IndexOutputStream(dir.createOutput(REDO_LOG));
         out = new BufferedWriter(new OutputStreamWriter(os));
      }
   }
763065
void init() throws KnowledgeSourceBackendInitializationException {
        if (this.project == null) {
            Util.logger().log(Level.FINE, "Opening Protege project {0}",
                    this.projectIdentifier);
            this.project = initProject();
            if (this.project == null) {
                throw new KnowledgeSourceBackendInitializationException(
                        "Could not load project " + this.projectIdentifier);
            } else {
                this.protegeKnowledgeBase = this.project.getKnowledgeBase();
                Util.logger().log(Level.FINE,
                        "Project {0} opened successfully",
                        this.projectIdentifier);
            }
        }
    }