Percolate table
Percolate table is a special table which stores queries instead of documents. It is used for prospective searches (or “search in reverse”).
- See section Percolate query for more details about performing a search query against a percolate table.
- See section Adding rules to a percolate table to learn how to prepare a table for searching.
The schema of a percolate table is fixed and contains the following fields:
Field | Description |
---|---|
ID | Unsigned 64-bit integer with autoincrement functionality therefore it can be omitted when you add a PQ rule |
Query | Full-text query of the rule. You can think of it as the value of a MATCH clause or JSON /search. If per field operators are used inside the query, the full text fields need to be declared in the percolate table configuration. If the stored query is supposed to do only attribute filtering (no full-text querying), the query value can be empty or simply omitted. The value of this field should correspond to the expected document schema which you specify when you create a percolate table |
Filters | Filters is an optional string containing attribute filters and/or expressions the same way they are defined in the WHERE clause or JSON filtering. The value of this field should correspond to the expected document schema which you specify when you create a percolate table |
Tags | Optional. Tags represent a list of string labels separated by comma that can be used for filtering/deleting PQ rules. The tags can be returned along with matching documents when you Percolate query |
You don’t need to worry about adding the above fields when you create a percolate table.
What you need to take care of when you add a new table is to specify the expected schema of a document which is to be checked against the rules you will add later. This is done the same way as for any other local table.
- SQL
- JSON
- PHP
- Python
- javascript
- java
- CONFIG
SQL JSON PHP Python javascript java CONFIG
Creating a percolate table via MySQL protocol:
CREATE TABLE products(title text, meta json) type='pq';
Creating a percolate table via JSON over HTTP:
POST /cli -d "CREATE TABLE products(title text, meta json) type='pq'"
Creating a percolate table via PHP client:
$index = [
'index' => 'products',
'body' => [
'columns' => [
'title' => ['type' => 'text'],
'meta' => ['type' => 'json']
],
'settings' => [
'type' => 'pq'
]
]
];
$client->indices()->create($index);
utilsApi.sql('CREATE TABLE products(title text, meta json) type=\'pq\'')
res = await utilsApi.sql('CREATE TABLE products(title text, meta json) type=\'pq\'');
utilsApi.sql("CREATE TABLE products(title text, meta json) type='pq'");
Creating a percolate table via config:
table products {
type = percolate
path = tbl_pq
rt_field = title
rt_attr_json = meta
}
Response
Query OK, 0 rows affected (0.00 sec)
{
"total":0,
"error":"",
"warning":""
}
Array(
[total] => 0
[error] =>
[warning] =>
)
Template table
Template table is a pseudo-table since it does not store any data and does not create any files on your disk. At the same time it can have the same NLP settings as a plain or a real-time table. Template tables can be used for a few purposes:
- as templates to inherit plain/real-time tables in the Plain mode) just to minify Manticore configuration file
- keywords generation with help of CALL KEYWORDS
- highlighting of an arbitrary string using CALL SNIPPETS
- CONFIG
CONFIG
Creating a template table via a configuration file:
table template {
type = template
morphology = stem_en
wordforms = wordforms.txt
exceptions = exceptions.txt
stopwords = stopwords.txt
}