7.3.53. reindex#

7.3.53.1. Summary#

New in version 5.1.0.

reindex command recreates one or more index columns.

If you specify a database as target object, all index columns are recreated.

If you specify a table as target object, all index columns in the table are recreated.

If you specify a data column as target object, all index columns for the data column are recreated.

If you specify an index column as target object, the index column is recreated.

This command is useful when your index column is broken. The target object is one of database, table and column.

Note

You can’t use target index columns while reindex command is running. If you use the same database from multiple processes, all processes except running reindex should reopen the database. You can use database_unmap for reopening database.

7.3.53.2. Syntax#

This command takes only one optional parameter:

reindex [target_name=null]

If target_name parameters is omitted, database is used for the target object. It means that all index columns in the database are recreated.

7.3.53.3. Usage#

Here is an example to recreate all index columns in the database:

Execution example:

reindex
# [[0,1337566253.89858,0.000355720520019531],true]

Here is an example to recreate all index columns (Lexicon.entry_key and Lexicon.entry_body) in Lexicon table:

Execution example:

table_create Entry TABLE_HASH_KEY ShortText
# [[0,1337566253.89858,0.000355720520019531],true]
column_create Entry body COLUMN_SCALAR Text
# [[0,1337566253.89858,0.000355720520019531],true]
table_create Lexicon TABLE_PAT_KEY ShortText \
  --default_tokenizer TokenBigram \
  --normalizer NormalizerAuto
# [[0,1337566253.89858,0.000355720520019531],true]
column_create Lexicon entry_key COLUMN_INDEX|WITH_POSITION \
  Entry _key
# [[0,1337566253.89858,0.000355720520019531],true]
column_create Lexicon entry_body COLUMN_INDEX|WITH_POSITION \
  Entry body
# [[0,1337566253.89858,0.000355720520019531],true]
reindex Lexicon
# [[0,1337566253.89858,0.000355720520019531],true]

Here is an example to recreate all index columns (BigramLexicon.site_title and RegexpLexicon.site_title) of Site.title data column:

Execution example:

table_create Site TABLE_HASH_KEY ShortText
# [[0,1337566253.89858,0.000355720520019531],true]
column_create Site title COLUMN_SCALAR ShortText
# [[0,1337566253.89858,0.000355720520019531],true]
table_create BigramLexicon TABLE_PAT_KEY ShortText \
  --default_tokenizer TokenBigram \
  --normalizer NormalizerAuto
# [[0,1337566253.89858,0.000355720520019531],true]
column_create BigramLexicon site_title COLUMN_INDEX|WITH_POSITION \
  Site title
# [[0,1337566253.89858,0.000355720520019531],true]
table_create RegexpLexicon TABLE_PAT_KEY ShortText \
  --default_tokenizer TokenRegexp \
  --normalizer NormalizerAuto
# [[0,1337566253.89858,0.000355720520019531],true]
column_create RegexpLexicon site_title COLUMN_INDEX|WITH_POSITION \
  Site title
# [[0,1337566253.89858,0.000355720520019531],true]
reindex Site.title
# [[0,1337566253.89858,0.000355720520019531],true]

Here is an example to recreate an index column (Timestamp.index):

Execution example:

table_create Logs TABLE_NO_KEY
# [[0,1337566253.89858,0.000355720520019531],true]
column_create Logs timestamp COLUMN_SCALAR Time
# [[0,1337566253.89858,0.000355720520019531],true]
table_create Timestamp TABLE_PAT_KEY Time
# [[0,1337566253.89858,0.000355720520019531],true]
column_create Timestamp logs_timestamp COLUMN_INDEX  Logs timestamp
# [[0,1337566253.89858,0.000355720520019531],true]
reindex Timestamp.logs_timestamp
# [[0,1337566253.89858,0.000355720520019531],true]

7.3.53.4. Parameters#

This section describes all parameters.

7.3.53.4.1. target_name#

Specifies the name of table or column.

If you don’t specify it, database is used for the target object.

The default is none. It means that the target object is database.

7.3.53.5. Return value#

reindex command returns whether recreation is succeeded or not:

[HEADER, SUCCEEDED_OR_NOT]

HEADER

See Output format about HEADER.

SUCCEEDED_OR_NOT

If command succeeded, it returns true, otherwise it returns false on error.