Manticore Search имеет один уровень иерархии для таблиц.
В отличие от других СУБД, в Manticore нет концепции группировки таблиц в базы данных. Однако, для совместимости с диалектами SQL, Manticore принимает операторы SHOW DATABASES для совместимости с диалектом SQL, но оператор не возвращает никаких результатов.
Общий синтаксис:
SHOW TABLES [ LIKE pattern ]
Оператор SHOW TABLES выводит список всех активных в данный момент таблиц вместе с их типами. Существующие типы таблиц: local, distributed, rt, percolate и template.
$client->nodes()->table();
utilsApi.sql('SHOW TABLES')
await utilsApi.sql('SHOW TABLES')
res = await utilsApi.sql('SHOW TABLES');
utilsApi.sql("SHOW TABLES", true)
utilsApi.Sql("SHOW TABLES", true)
utils_api.sql("SHOW TABLES", Some(true)).await
+----------+-------------+
| Index | Type |
+----------+-------------+
| dist | distributed |
| plain | local |
| pq | percolate |
| rt | rt |
| template | template |
+----------+-------------+
5 rows in set (0.00 sec)
Array
(
[dist1] => distributed
[rt] => rt
[products] => rt
)
{u'columns': [{u'Index': {u'type': u'string'}},
{u'Type': {u'type': u'string'}}],
u'data': [{u'Index': u'dist1', u'Type': u'distributed'},
{u'Index': u'rt', u'Type': u'rt'},
{u'Index': u'products', u'Type': u'rt'}],
u'error': u'',
u'total': 0,
u'warning': u''}
{u'columns': [{u'Index': {u'type': u'string'}},
{u'Type': {u'type': u'string'}}],
u'data': [{u'Index': u'dist1', u'Type': u'distributed'},
{u'Index': u'rt', u'Type': u'rt'},
{u'Index': u'products', u'Type': u'rt'}],
u'error': u'',
u'total': 0,
u'warning': u''}
{"columns":[{"Index":{"type":"string"}},{"Type":{"type":"string"}}],"data":[{"Index":"products","Type":"rt"}],"total":0,"error":"","warning":""}
{columns=[{Index={type=string}}, {Type={type=string}}], data=[{Index=products, Type=rt}], total=0, error=, warning=}
{columns=[{Index={type=string}}, {Type={type=string}}], data=[{Index=products, Type=rt}], total=0, error="", warning=""}
{columns=[{Index={type=string}}, {Type={type=string}}], data=[{Index=products, Type=rt}], total=0, error="", warning=""}
Поддерживается необязательный оператор LIKE для фильтрации таблиц по имени.
$client->nodes()->table(['body'=>['pattern'=>'pro%']]);
utilsApi.sql('SHOW TABLES LIKE \'pro%\'');
await utilsApi.sql('SHOW TABLES LIKE \'pro%\'');
utilsApi.sql('SHOW TABLES LIKE \'pro%\'')
utilsApi.sql("SHOW TABLES LIKE 'pro%'", true)
utilsApi.Sql("SHOW TABLES LIKE 'pro%'", true)
utils_api.sql("SHOW TABLES LIKE 'pro%'", Some(true)).await
+----------+-------------+
| Index | Type |
+----------+-------------+
| products | distributed |
+----------+-------------+
1 row in set (0.00 sec)
Array
(
[products] => distributed
)
{u'columns': [{u'Index': {u'type': u'string'}},
{u'Type': {u'type': u'string'}}],
u'data': [{u'Index': u'products', u'Type': u'rt'}],
u'error': u'',
u'total': 0,
u'warning': u''}
{u'columns': [{u'Index': {u'type': u'string'}},
{u'Type': {u'type': u'string'}}],
u'data': [{u'Index': u'products', u'Type': u'rt'}],
u'error': u'',
u'total': 0,
u'warning': u''}
{"columns":[{"Index":{"type":"string"}},{"Type":{"type":"string"}}],"data":[{"Index":"products","Type":"rt"}],"total":0,"error":"","warning":""}
{columns=[{Index={type=string}}, {Type={type=string}}], data=[{Index=products, Type=rt}], total=0, error=, warning=}
{columns=[{Index={type=string}}, {Type={type=string}}], data=[{Index=products, Type=rt}], total=0, error="", warning=""}
{columns=[{Index={type=string}}, {Type={type=string}}], data=[{Index=products, Type=rt}], total=0, error="", warning=""}
{DESC | DESCRIBE} table_name [ LIKE pattern ]
Оператор DESCRIBE выводит столбцы таблицы и их соответствующие типы. Столбцы включают ID документа, полнотекстовые поля и атрибуты. Порядок соответствует порядку, в котором поля и атрибуты ожидаются в операторах INSERT и REPLACE. Типы столбцов включают field, integer, timestamp, ordinal, bool, float, bigint, string и mva. Столбец ID будет иметь тип bigint. Пример:
mysql> DESC rt;
+---------+---------+
| Field | Type |
+---------+---------+
| id | bigint |
| title | field |
| content | field |
| gid | integer |
+---------+---------+
4 rows in set (0.00 sec)
Поддерживается необязательный оператор LIKE. Обратитесь к
SHOW META для деталей синтаксиса.
Вы также можете просмотреть схему таблицы, выполнив запрос select * from <table_name>.@table. Преимущество этого метода в том, что вы можете использовать оператор WHERE для фильтрации:
select * from tbl.@table where type='text';
+------+-------+------+----------------+
| id | field | type | properties |
+------+-------+------+----------------+
| 2 | title | text | indexed stored |
+------+-------+------+----------------+
1 row in set (0.00 sec)
Вы также можете выполнять многие другие действия с <your_table_name>.@table, рассматривая её как обычную таблицу Manticore с колонками, состоящими из целочисленных и строковых атрибутов.
select field from tbl.@table;
select field, properties from tbl.@table where type in ('text', 'uint');
select * from tbl.@table where properties any ('stored');
SHOW CREATE TABLE table_name
Выводит оператор CREATE TABLE, использованный для создания указанной таблицы.
Table: tbl
Create Table: CREATE TABLE tbl (
f text indexed stored
) charset_table='non_cont,cont' morphology='icu_chinese'
1 row in set (0.00 sec)
Если вы используете оператор DESC для таблицы percolate, он отобразит схему внешней таблицы, которая является схемой сохранённых запросов. Эта схема статична и одинакова для всех локальных таблиц percolate:
mysql> DESC pq;
+---------+--------+
| Field | Type |
+---------+--------+
| id | bigint |
| query | string |
| tags | string |
| filters | string |
+---------+--------+
4 rows in set (0.00 sec)
Если вы хотите просмотреть ожидаемую схему документа, используйте следующую команду:
DESC <pq table name> table:
mysql> DESC pq TABLE;
+-------+--------+
| Field | Type |
+-------+--------+
| id | bigint |
| title | text |
| gid | uint |
+-------+--------+
3 rows in set (0.00 sec)
Также поддерживается desc pq table like ... и работает следующим образом:
mysql> desc pq table like '%title%';
+-------+------+----------------+
| Field | Type | Properties |
+-------+------+----------------+
| title | text | indexed stored |
+-------+------+----------------+
1 row in set (0.00 sec)