# groonga - An open-source fulltext search engine and column store.

- 日本語

# 7.14.30. `vector_size`

## 7.14.30.1. Summary

New in version 5.0.3.

`vector_size` returns the value of vector column size.

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

    plugin_register functions/vector

Then, use `vector_size` function with `--command_version 2` option. Note that you must specify `--command_version 2` to use `vector_size` function.”

## 7.14.30.2. Syntax

`vector_size` requires one argument - `target`.

    vector_size(target)

## 7.14.30.3. Usage

Here is a schema definition and sample data.

Sample schema:

Execution example:

    table_create Memos TABLE_HASH_KEY ShortText
    # [[0, 1337566253.89858, 0.000355720520019531], true]
    column_create Memos tags COLUMN_VECTOR ShortText
    # [[0, 1337566253.89858, 0.000355720520019531], true]

Sample data:

Execution example:

    load --table Memos
    [
    {"_key": "Groonga",          "tags": ["Groonga"]},
    {"_key": "Rroonga",          "tags": ["Groonga", "Ruby"]},
    {"_key": "Nothing"}
    ]
    # [[0, 1337566253.89858, 0.000355720520019531], 3]

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

Execution example:

    select Memos --output_columns 'tags, vector_size(tags)' --command_version 2
    # [
    #   [
    #     0,
    #     1337566253.89858,
    #     0.000355720520019531
    #   ],
    #   [
    #     [
    #       [
    #         3
    #       ],
    #       [
    #         [
    #           "tags",
    #           "ShortText"
    #         ],
    #         [
    #           "vector_size",
    #           null
    #         ]
    #       ],
    #       [
    #         [
    #           "Groonga"
    #         ],
    #         1
    #       ],
    #       [
    #         [
    #           "Groonga",
    #           "Ruby"
    #         ],
    #         2
    #       ],
    #       [
    #         [],
    #         0
    #       ]
    #     ]
    #   ]
    # ]

## 7.14.30.4. Parameters

There is one required parameter, `target`.

### 7.14.30.4.1. `target`

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

## 7.14.30.5. Return value

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