1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
.. -*- rst -*-
.. groonga-command
.. database: reindex
``reindex``
===========
Summary
-------
.. versionadded:: 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 :doc:`database_unmap` for reopening database.
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.
Usage
-----
Here is an example to recreate all index columns in the database:
.. groonga-command
.. include:: ../../example/reference/commands/reindex/database.log
.. reindex
Here is an example to recreate all index columns
(``Lexicon.entry_key`` and ``Lexicon.entry_body``) in ``Lexicon``
table:
.. groonga-command
.. include:: ../../example/reference/commands/reindex/table.log
.. table_create Entry TABLE_HASH_KEY ShortText
.. column_create Entry body COLUMN_SCALAR Text
..
.. table_create Lexicon TABLE_PAT_KEY ShortText \
.. --default_tokenizer TokenBigram \
.. --normalizer NormalizerAuto
.. column_create Lexicon entry_key COLUMN_INDEX|WITH_POSITION \
.. Entry _key
.. column_create Lexicon entry_body COLUMN_INDEX|WITH_POSITION \
.. Entry body
..
.. reindex Lexicon
Here is an example to recreate all index columns
(``BigramLexicon.site_title`` and ``RegexpLexicon.site_title``) of
``Site.title`` data column:
.. groonga-command
.. include:: ../../example/reference/commands/reindex/data_column.log
.. table_create Site TABLE_HASH_KEY ShortText
.. column_create Site title COLUMN_SCALAR ShortText
..
.. table_create BigramLexicon TABLE_PAT_KEY ShortText \
.. --default_tokenizer TokenBigram \
.. --normalizer NormalizerAuto
.. column_create BigramLexicon site_title COLUMN_INDEX|WITH_POSITION \
.. Site title
..
.. table_create RegexpLexicon TABLE_PAT_KEY ShortText \
.. --default_tokenizer TokenRegexp \
.. --normalizer NormalizerAuto
.. column_create RegexpLexicon site_title COLUMN_INDEX|WITH_POSITION \
.. Site title
..
.. reindex Site.title
Here is an example to recreate an index column (``Timestamp.index``):
.. groonga-command
.. include:: ../../example/reference/commands/reindex/index_column.log
.. table_create Logs TABLE_NO_KEY
.. column_create Logs timestamp COLUMN_SCALAR Time
..
.. table_create Timestamp TABLE_PAT_KEY Time
.. column_create Timestamp logs_timestamp COLUMN_INDEX Logs timestamp
..
.. reindex Timestamp.logs_timestamp
Parameters
----------
This section describes all parameters.
``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.
Return value
------------
``reindex`` command returns whether recreation is succeeded or not::
[HEADER, SUCCEEDED_OR_NOT]
``HEADER``
See :doc:`/reference/command/output_format` about ``HEADER``.
``SUCCEEDED_OR_NOT``
If command succeeded, it returns true, otherwise it returns false on
error.
|