Percolate table

Percolate table is a special table which stores queries instead of documents. It is used for prospective searches (or “search in reverse”).

The schema of a percolate table is fixed and contains the following fields:

FieldDescription
IDUnsigned 64-bit integer with autoincrement functionality therefore it can be omitted when you add a PQ rule
QueryFull-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
FiltersFilters 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
TagsOptional. 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:
  1. CREATE TABLE products(title text, meta json) type='pq';
Creating a percolate table via JSON over HTTP:
  1. POST /cli -d "CREATE TABLE products(title text, meta json) type='pq'"
Creating a percolate table via PHP client:
  1. $index = [
  2. 'index' => 'products',
  3. 'body' => [
  4. 'columns' => [
  5. 'title' => ['type' => 'text'],
  6. 'meta' => ['type' => 'json']
  7. ],
  8. 'settings' => [
  9. 'type' => 'pq'
  10. ]
  11. ]
  12. ];
  13. $client->indices()->create($index);
  1. utilsApi.sql('CREATE TABLE products(title text, meta json) type=\'pq\'')
  1. res = await utilsApi.sql('CREATE TABLE products(title text, meta json) type=\'pq\'');
  1. utilsApi.sql("CREATE TABLE products(title text, meta json) type='pq'");
Creating a percolate table via config:
  1. table products {
  2. type = percolate
  3. path = tbl_pq
  4. rt_field = title
  5. rt_attr_json = meta
  6. }

Response

  1. Query OK, 0 rows affected (0.00 sec)
  1. {
  2. "total":0,
  3. "error":"",
  4. "warning":""
  5. }
  1. Array(
  2. [total] => 0
  3. [error] =>
  4. [warning] =>
  5. )

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:
  1. table template {
  2. type = template
  3. morphology = stem_en
  4. wordforms = wordforms.txt
  5. exceptions = exceptions.txt
  6. stopwords = stopwords.txt
  7. }

NLP and tokenization