| 1 |
.. -*- rst -*- |
| 2 |
|
| 3 |
.. groonga-command |
| 4 |
.. database: vector_size |
| 5 |
|
| 6 |
``vector_size`` |
| 7 |
=============== |
| 8 |
|
| 9 |
Summary |
| 10 |
------- |
| 11 |
|
| 12 |
.. versionadded:: 5.0.3 |
| 13 |
|
| 14 |
``vector_size`` returns the value of vector column size. |
| 15 |
|
| 16 |
To enable this function, register ``functions/vector`` plugin by |
| 17 |
the following command:: |
| 18 |
|
| 19 |
plugin_register functions/vector |
| 20 |
|
| 21 |
Syntax |
| 22 |
------ |
| 23 |
|
| 24 |
``vector_size`` requires one argument - ``target``. |
| 25 |
|
| 26 |
:: |
| 27 |
|
| 28 |
vector_size(target) |
| 29 |
|
| 30 |
Usage |
| 31 |
----- |
| 32 |
|
| 33 |
Here is a schema definition and sample data. |
| 34 |
|
| 35 |
Sample schema: |
| 36 |
|
| 37 |
.. groonga-command |
| 38 |
.. plugin_register functions/vector |
| 39 |
.. include:: ../../example/reference/functions/vector_size/usage_setup_schema.log |
| 40 |
.. table_create Memos TABLE_HASH_KEY ShortText |
| 41 |
.. column_create Memos tags COLUMN_VECTOR ShortText |
| 42 |
|
| 43 |
Sample data: |
| 44 |
|
| 45 |
.. groonga-command |
| 46 |
.. include:: ../../example/reference/functions/vector_size/usage_setup_data.log |
| 47 |
.. load --table Memos |
| 48 |
.. [ |
| 49 |
.. {"_key": "Groonga", "tags": ["Groonga"]}, |
| 50 |
.. {"_key": "Rroonga", "tags": ["Groonga", "Ruby"]}, |
| 51 |
.. {"_key": "Nothing"} |
| 52 |
.. ] |
| 53 |
|
| 54 |
Here is the simple usage of ``vector_size`` function which returns tags and size - the value of ``tags`` column and size of it. |
| 55 |
|
| 56 |
.. groonga-command |
| 57 |
.. include:: ../../example/reference/functions/vector_size/usage_only.log |
| 58 |
.. select Memos --output_columns 'tags, vector_size(tags)' |
| 59 |
|
| 60 |
Parameters |
| 61 |
---------- |
| 62 |
|
| 63 |
There is only one required parameter. |
| 64 |
|
| 65 |
``target`` |
| 66 |
^^^^^^^^^^ |
| 67 |
|
| 68 |
Specifies a vector column of table that is specified by ``table`` parameter in ``select``. |
| 69 |
|
| 70 |
Return value |
| 71 |
------------ |
| 72 |
|
| 73 |
``vector_size`` returns the value of target vector column size. |