File: vector_size.rst

package info (click to toggle)
groonga 15.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 163,080 kB
  • sloc: ansic: 770,564; cpp: 48,925; ruby: 40,447; javascript: 10,250; yacc: 7,045; sh: 5,602; python: 2,821; makefile: 1,672
file content (73 lines) | stat: -rw-r--r-- 1,562 bytes parent folder | download | duplicates (3)
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
.. -*- rst -*-

.. groonga-command
.. database: vector_size

``vector_size``
===============

Summary
-------

.. versionadded:: 5.0.3

``vector_size`` returns the value of vector column size.

To enable this function, register ``functions/vector`` plugin by
the following command::

  plugin_register functions/vector

Syntax
------

``vector_size`` requires one argument - ``target``.

::

  vector_size(target)

Usage
-----

Here is a schema definition and sample data.

Sample schema:

.. groonga-command
.. plugin_register functions/vector
.. include:: ../../example/reference/functions/vector_size/usage_setup_schema.log
.. table_create Memos TABLE_HASH_KEY ShortText
.. column_create Memos tags COLUMN_VECTOR ShortText

Sample data:

.. groonga-command
.. include:: ../../example/reference/functions/vector_size/usage_setup_data.log
.. load --table Memos
.. [
.. {"_key": "Groonga",          "tags": ["Groonga"]},
.. {"_key": "Rroonga",          "tags": ["Groonga", "Ruby"]},
.. {"_key": "Nothing"}
.. ]

Here is the simple usage of ``vector_size`` function which returns tags and size - the value of ``tags`` column and size of it.

.. groonga-command
.. include:: ../../example/reference/functions/vector_size/usage_only.log
.. select Memos --output_columns 'tags, vector_size(tags)'

Parameters
----------

There is only one required parameter.

``target``
^^^^^^^^^^

Specifies a vector column of table that is specified by ``table`` parameter in ``select``.

Return value
------------

``vector_size`` returns the value of target vector column size.