BloGroonga

2023-08-31

Groonga 13.0.6 has been released

Groonga 13.0.6 has been released!

How to install: Install

Changes

Here are important changes in this release:

Improvements

  • highlight_html Don't report error when we specify empty string into highlight_html() as below.

    highlight_html() just returns an empty text.

    table_create Entries TABLE_NO_KEY
    column_create Entries body COLUMN_SCALAR ShortText
    
    table_create Terms TABLE_PAT_KEY ShortText \
      --default_tokenizer 'TokenNgram("report_source_location", true)' \
      --normalizer 'NormalizerNFKC150'
    column_create Terms document_index COLUMN_INDEX|WITH_POSITION Entries body
    
    load --table Entries
    [
    {"body": "ab cd ed gh"}
    ]
    
    select Entries \
      --match_columns body \
      --query 'ab' \
      --output_columns 'highlight_html("", Terms)'
    [
      [
        0,
        0.0,
        0.0
      ],
      [
        [
          [
            1
          ],
          [
            [
              "highlight_html",null
            ]
          ],
          [
            ""
          ]
        ]
      ]
    ]
    
  • Added support aggregator_* for dynamic columns and pseudo columns.

    Pseudo column is a column with _ prefix.(e.g. _id, _nsubrecs, …).

    aggregator_* functions is for aggregating as below.

    • aggregator_sum()

      It returns the sum of specify columns.

    • aggregator_mean()

      It returns the arithmetic mean of specify columns.

    • aggregator_sd()

      It returns the standard deviation or unbiased variance of specify columns.

    These functions is for using with drilldown. For example, we want to get mean of sales every category as below.

    table_create Items TABLE_HASH_KEY ShortText
    column_create Items price COLUMN_SCALAR UInt32
    column_create Items tag COLUMN_SCALAR ShortText
    
    load --table Items
    [
    {"_key": "Book",  "price": 1000, "tag": "A"},
    {"_key": "Note",  "price": 1000, "tag": "B"},
    {"_key": "Box",   "price": 500,  "tag": "B"},
    {"_key": "Pen",   "price": 500,  "tag": "A"},
    {"_key": "Food",  "price": 500,  "tag": "C"},
    {"_key": "Drink", "price": 300,  "tag": "B"}
    ]
    
    select Items \
      --drilldowns[tag].keys tag \
      --drilldowns[tag].output_columns _key,_nsubrecs,price_mean \
      --drilldowns[tag].columns[price_mean].stage group \
      --drilldowns[tag].columns[price_mean].type Float \
      --drilldowns[tag].columns[price_mean].flags COLUMN_SCALAR \
      --drilldowns[tag].columns[price_mean].value 'aggregator_mean(price)'
    [
      [
        0,
        0.0,
        0.0
      ],
      [
        [
          [
            6
          ],
          [
            [
              "_id",
              "UInt32"
            ],
            [
              "_key",
              "ShortText"
            ],
            [
              "price",
              "UInt32"
            ],
            [
              "tag",
              "ShortText"
            ]
          ],
          [
            1,
            "Book",
            1000,
            "A"
          ],
          [
            2,
            "Note",
            1000,
            "B"
          ],
          [
            3,
            "Box",
            500,
            "B"
          ],
          [
            4,
            "Pen",
            500,
            "A"
          ],
          [
            5,
            "Food",
            500,
            "C"
          ],
          [
            6,
            "Drink",
            300,
            "B"
          ]
        ],
        {
          "tag":
          [
            [
              3
            ],
            [
              [
                "_key",
                "ShortText"
              ],
              [
                "_nsubrecs",
                "Int32"
              ],
              [
                "price_mean",
                "Float"
              ]
            ],
            [
              "A",
              2,
              750.0
            ],
            [
              "B",
              3,
              600.0
            ],
            [
              "C",
              1,
              500.0
            ]
          ]
        }
      ]
    ]
    

Fixes

  • highlight_html Fixed a bug that highlight position may be incorrect.

    For example, this bug occures when we specify as highlight target both of keyword with the number of characters is one and keyword with the number of characters is two.

    table_create Entries TABLE_NO_KEY
    column_create Entries body COLUMN_SCALAR ShortText
    
    table_create Terms TABLE_PAT_KEY ShortText \
      --default_tokenizer 'TokenNgram("report_source_location", true)' \
      --normalizer 'NormalizerNFKC150'
    column_create Terms document_index COLUMN_INDEX|WITH_POSITION Entries body
    
    load --table Entries
    [
    {"body": "斉藤の一人"}
    ]
    
    select Entries \
      --match_columns body \
      --query '斉藤 一' \
      --output_columns 'highlight_html(body, Terms)'
    [
      [
        0,
        0.0,
        0.0
      ],
      [
        [
          [
            1
          ],
          [
            [
              "highlight_html",
              null
            ]
          ],
          [
            "<span class=\"keyword\">斉藤</span>の<span class=\"keyword\">一</span>人"
          ]
        ]
      ]
    ]
    

Conclusion

Please refert to the following news for more details.

News Release 13.0.6

Let's search by Groonga!