BloGroonga

2024-05-09

Groonga 14.0.3 has been released

Groonga 14.0.3 has been released!

How to install: Install

Changes

Here are important changes in this release:

Improvements

  • We optimized performance as below.

    • We optimized performance of OR and AND search when the number of hits were many.

    • We optimized performance of prefix search(@^).

    • We optimized performance of AND search when the number of records of A more than B in condition of A AND B.

    • We optimized performance of search when we used many dynamic columns.

  • token_ngram Added new option ignore_blank.

    We can replace TokenBigramIgnoreBlank with TokenNgram("ignore_blank", true) as below.

    Here is example of use TokenBigram.

    tokenize TokenBigram "! ! !" NormalizerAuto
    [
      [
        0,
        1715155644.64263,
        0.001013517379760742
      ],
      [
        {
          "value": "!",
          "position": 0,
          "force_prefix": false,
          "force_prefix_search": false
        },
        {
          "value": "!",
          "position": 1,
          "force_prefix": false,
          "force_prefix_search": false
        },
        {
          "value": "!",
          "position": 2,
          "force_prefix": false,
          "force_prefix_search": false
        }
      ]
    ]
    

    Here is example of use TokenBigramIgnoreBlank.

    tokenize TokenBigramIgnoreBlank "! ! !" NormalizerAuto
    [
      [
        0,
        1715155680.323451,
        0.0009913444519042969
      ],
      [
        {
          "value": "!!!",
          "position": 0,
          "force_prefix": false,
          "force_prefix_search": false
        }
      ]
    ]
    

    Here is example of use TokenNgram("ignore_blank", true).

    tokenize 'TokenNgram("ignore_blank", true)' "! ! !" NormalizerAuto
    [
      [
        0,
        1715155762.340685,
        0.001041412353515625
      ],
      [
        {
          "value": "!!!",
          "position": 0,
          "force_prefix": false,
          "force_prefix_search": false
        }
      ]
    ]
    
  • ubuntu Add support for Ubuntu 24.04 LTS (Noble Numbat).

Fixes

  • request_cancel Fix a bug that Groonga may crash when we execute request_cancel command while we execute the other query.

  • Fixed the unexpected error when using --post_filter with --offset greater than the post-filtered result

    In the same situation, using --filter with --offset doesn't raise the error. This inconsistency in behavior between --filter and --post-filter has now been resolved.

    table_create Users TABLE_PAT_KEY ShortText
    column_create Users age COLUMN_SCALAR UInt32
    load --table Users
    [
      ["_key", "age"],
      ["Alice", 21],
      ["Bob", 22],
      ["Chris", 23],
      ["Diana", 24],
      ["Emily", 25]
    ]
    select Users \
      --filter 'age >= 22' \
      --post_filter 'age <= 24' \
      --offset 3 \
      --sort_keys -age --output_pretty yes
    [
      [
        -68,
        1715224057.317582,
        0.001833438873291016,
        "[table][sort] grn_output_range_normalize failed",
        [
          [
            "grn_table_sort",
            "/home/horimoto/Work/free-software/groonga.tag/lib/sort.c",
            1052
          ]
        ]
      ]
    ]
    
  • Fixed a bug where incorrect search result could be returned when not all phrases within (...) matched using near phrase product.

    For example, there is no record which matched (2) condition using --query '*NPP1"(a) (2)"'. In this case, the expected behavior would be return no record. However, the actual behavior was equal to the query --query '*NPP and "(a)" as below. This means that despite no records matched (2), records like ax1 and axx1 were incorrectly returned.

    table_create Entries TABLE_NO_KEY
    column_create Entries content COLUMN_SCALAR Text
    
    table_create Terms TABLE_PAT_KEY ShortText   --default_tokenizer TokenNgram
    column_create Terms entries_content COLUMN_INDEX|WITH_POSITION Entries content
    load --table Entries
    [
      {"content": "ax1"},
      {"content": "axx1"}
    ]
    
    select Entries \
      --match_columns content \
      --query '*NPP1"(a) (2)"' \
      --output_columns 'content'
    [
      [
        0,
        1715224211.050228,
        0.001366376876831055
      ],
      [
        [
          [
            2
          ],
          [
            [
              "content",
              "Text"
            ]
          ],
          [
            "ax1"
          ],
          [
            "axx1"
          ]
        ]
      ]
    ]
    
  • Fixed a bug that rehash failed or data in a table broke when rehash occurred that the table with TABLE_HASH_KEY has 2^28 or more records.

  • Fixed a bug that highlight position slipped out of place in the following cases.

    • If full width space existed before highlight target characters as below.

      We expected that Groonga returned "Groonga <span class=\"keyword\">高</span>速!". However, Groonga returned "Groonga <span class=\"keyword\">高速</span>!" as below.

      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("report_source_offset", true)'
      column_create Terms document_index COLUMN_INDEX|WITH_POSITION Entries body
      
      load --table Entries
      [
        {"body": "Groonga 高速!"}
      ]
      select Entries \
        --output_columns \
        --match_columns body \
        --query '高' \
        --output_columns 'highlight_html(body, Terms)'
      [
        [
          0,
          1715215640.979517,
          0.001608610153198242
        ],
        [
          [
            [
              1
            ],
            [
              [
                "highlight_html",
                null
              ]
            ],
            [
              "Groonga <span class=\"keyword\">高速</span>!"
            ]
          ]
        ]
      ]
      
    • If we used TokenNgram("loose_blank", true) and if highlight target characters included full width space as below.

      We expected that Groonga returned "<span class=\"keyword\">山田 太郎</span>". However, Groonga returned "<span class=\"keyword\">山田 太</span>" as below.

      table_create Entries TABLE_NO_KEY
      column_create Entries body COLUMN_SCALAR ShortText
      
      table_create Terms TABLE_PAT_KEY ShortText \
        --default_tokenizer 'TokenNgram("loose_blank", true, "report_source_location", true)' \
        --normalizer 'NormalizerNFKC150("report_source_offset", true)'
      column_create Terms document_index COLUMN_INDEX|WITH_POSITION Entries body
      
      load --table Entries
      [
        {"body": "山田 太郎"}
      ]
      
      select Entries --output_columns \
        --match_columns body --query '山田太郎' \
        --output_columns 'highlight_html(body, Terms)' --output_pretty yes
      [
        [
          0,
          1715220409.096246,
          0.0004854202270507812
        ],
        [
          [
            [
              1
            ],
            [
              [
                "highlight_html",
                null
              ]
            ],
            [
              "<span class=\"keyword\">山田 太</span>"
            ]
          ]
        ]
      ]
      
    • If white space existed in the front of highlight target characters as below.

      We expected that Groonga returned " <span class=\"keyword\">山</span>田太郎". However, Groonga returned " <span class=\"keyword\">山</span>" as below.

      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("report_source_offset", true)'
      column_create Terms document_index COLUMN_INDEX|WITH_POSITION Entries body
      
      load --table Entries
      [
        {"body": " 山田太郎"}
      ]
      
      select Entries \
        --output_columns \
        --match_columns body \
        --query '山' \
        --output_columns 'highlight_html(body, Terms)' --output_pretty yes
      [
        [
          0,
          1715221627.002193,
          0.001977920532226562
        ],
        [
          [
            [
              1
            ],
            [
              [
                "highlight_html",
                null
              ]
            ],
            [
              " <span class=\"keyword\">山</span>"
            ]
          ]
        ]
      ]
      
    • If the second character of highlight target was full width space as below.

      We expected that Groonga returned "<span class=\"keyword\">山 田</span>太郎". However, Groonga returned "<span class=\"keyword\">山 田太</span>郎" as below.

      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("report_source_offset", true)'
      column_create Terms document_index COLUMN_INDEX|WITH_POSITION Entries body
      
      load --table Entries
      [
        {"body": "山 田太郎"}
      ]
      
      select Entries \
        --output_columns \
        --match_columns body \
        --query '山 田' \
        --output_columns 'highlight_html(body, Terms)'
      [
        [
          0,
          1715222501.496007,
          0.0005536079406738281
        ],
        [
          [
            [
              0
            ],
            [
              [
                "highlight_html",
                "<span class=\"keyword\">山 田太</span>郎"
              ]
            ]
          ]
        ]
      ]
      

Conclusion

Please refert to the following news for more details. News Release 14.0.3

Let's search by Groonga!

2024-03-29

Groonga 14.0.2 has been released

Groonga 14.0.2 has been released!

How to install: Install

Changes

Here are important changes in this release:

Improvements

  • Reduced a log level of a log when Groonga setting normalizers/tokenizer/token_filters against temporary table.

    For example, the target log of this modification is the following log.

    DDL:1234567890:set_normalizers NormalizerAuto
    

    PGroonga sets normalizers against temporary table on start. So, this log becomes noise. Because this log become output when PGroonga start because of PGroonga’s default log level is notice.

    Therefore, we reduce log level to debug for the log since this release. Thus, this log does not output when PGroonga start in default.

Conclusion

Please refert to the following news for more details. News Release 14.0.2

Let's search by Groonga!

2024-03-14

Groonga 14.0.1 has been released

Groonga 14.0.1 has been released!

How to install: Install

Changes

Here are important changes in this release:

Improvements

  • [load] Stopped reporting an error when we load key that becomes an empty key by normalization.

    "-" becomes "" with NormalizerNFKC150("remove_symbol", true). So the following case reports a "empty key" error.

    table_create Values TABLE_HASH_KEY ShortText \
      --normalizers 'NormalizerNFKC150("remove_symbol", true)'
    table_create Data TABLE_NO_KEY
    column_create Data value COLUMN_SCALAR Values
    load --table Data
    [
    {"value": "-"}
    ]
    

    However, if we many load in such data, many error log are generated. Because Groonga output many "empty key" error because of Groonga can't register empty string to index.

    No problem even if empty string can't register to index in such case. Because we don't match anything even if we search by empty string. So, we stop reporting an "empty key" error in such case.

Fixes

  • Fixed a crash bug if a request is canceled between or range search.

    This bug doesn't necessarily occur. This bug occur when we cancel a request in the specific timing. This bug occur easily when search time is long such as sequential search.

  • Fixed a bug that highlight_html may return invalid result when the following conditions are met.

    • We use multiple normalizers such as NormalizerTable and NormalizerNFKC150.
    • We highlight string include whitespace.

    For example, this bug occur such as the following case.

    table_create NormalizationsIndex TABLE_PAT_KEY ShortText --normalizer NormalizerAuto
    
    table_create Normalizations TABLE_HASH_KEY UInt64
    column_create Normalizations normalized COLUMN_SCALAR LongText
    column_create Normalizations target COLUMN_SCALAR NormalizationsIndex
    
    column_create NormalizationsIndex index COLUMN_INDEX Normalizations target
    
    
    table_create Lexicon TABLE_PAT_KEY ShortText \
      --normalizers 'NormalizerTable("normalized", \
                                     "Normalizations.normalized", \
                                     "target", \
                                     "target"), NormalizerNFKC150'
    
    table_create Names TABLE_HASH_KEY UInt64
    column_create Names name COLUMN_SCALAR Lexicon
    
    load --table Names
    [
    ["_key","name"],
    [1,"Sato Toshio"]
    ]
    
    select Names \
      --query '_key:1 OR name._key:@"Toshio"' \
      --output_columns 'highlight_html(name._key, Lexicon)
    
    [
      [
        0,
        1710401574.332274,
        0.001911401748657227
      ],
      [
        [
          [
            1
          ],
          [
            [
              "highlight_html",
              null
            ]
          ],
          [
            "sato <span class=\"keyword\">toshi</span>o"
          ]
        ]
      ]
    ]
    
  • [Ubuntu] We become able to provide package for Ubuntu again.

    We don't provide packages for Ubuntu in Groonga version 14.0.0. Because we fail makeing Groonga package for Ubuntu by problrm of build environment for Ubuntu package.

    We fixed problrm of build environment for Ubuntu package in 14.0.1. So, we can provide packages for Ubuntu again since this release.

  • Fixed build error when we build from source by using clang.

Conclusion

Please refert to the following news for more details. News Release 14.0.1

Let's search by Groonga!

2024-02-29

Groonga 14.0.0 has been released

Groonga 14.0.0 has been released!

How to install: Install

Changes

Here are important changes in this release:

Improvements

  • Added a new tokenizer TokenH3Index (experimental).

    TokenH3Indextokenizes WGS84GetPoint to UInt64(H3 index).

  • Added support for offline and online index construction with non text based tokenizer (experimental).

    TokenH3Index is one of non text based tokenizers.

  • [select] Added support for searching by index with non text based tokenizer (experimental).

    TokenH3Index is one of non text based tokenizers.

  • Added new functions distance_cosine(), distance_inner_product(), distance_l2_norm_squared(), distance_l1_norm().

    We can only get records that a small distance as vector with these functions and limit N

    These functions calculate distance in the output stage.

    However, we don't optimaize these functions yet.

    • distance_cosine(): Calculate cosine similarity.
    • distance_inner_product(): Calculate inner product.
    • distance_l2_norm_squared(): Calculate euclidean distance.
    • distance_l1_norm(): Calculate manhattan distance.
  • Added a new function number_round().

  • [load] Added support for parallel load.

    This feature only enable when the input_type of load is apache-arrow.

    This feature one thread per column. If there are many target columns, it will reduce load time.

  • [select] We can use uvector as much as possible for array literal in --filter.

    uvector is vector of elements with fix size.

    If all elements have the same type, we use uvector instead vector.

  • [status] Added n_workers to output of status.

  • Optimized a dynamic column creation.

  • [WAL] Added support for rebuilding broken indexes in parallel.

  • [select] Added support for Int64 in output_type=apache-arrow for columns that reference other table.

Fixes

  • [Windws] Fixed path for documents of groonga-normalizer-mysql in package for Windows.

    Documents of groonga-normalizer-mysql put under the share/ in this release.

  • [select] Fixed a bug that Groonga may crash when we use bitwise operations.

Conclusion

Please refert to the following news for more details. News Release 14.0.0

Let's search by Groonga!

2024-01-10

PGroonga (fast full text search module for PostgreSQL) 3.1.6 has been released

PGroonga 3.1.6 has been released! PGroonga makes PostgreSQL fast full text search for all languages.

Improvements

  • Added new option pgroonga.enable_row_level_security.

    This option can configure enable/disable setting of PGroonga'RLS(Row level security) support. Default value is enable. Disabling PGroonga`s RLS support may help to increase performance. However, PGroonga RLS support should not be disabled where PostgreSQL's RLS feature is applied. Disabling PGroonga RLS support in that environment would increase security risk.

    Thus, make sure to check the PostgreSQL's RLS feature is not applied in advance when you are planning to disable PGroonga's RLS support by this option.

    If you are willing to use the setting in the specific session, these SQL can switch enable/disable as follow.

    • Disable RLS support

      SET pgroonga.enable_row_level_security = off
      
    • Enable RLS support

      SET pgroonga.enable_row_level_security = on
      

      If you are willing to use the setting in the persistence, these SQL can switch enable/disable as follow.

    • Disable RLS support

      pgroonga.enable_row_level_security = off
      
    • Enable RLS support

      pgroonga.enable_row_level_security = on
      
  • Added new type pgroonga_condition. Also added related new function pgroonga_condition() .

    pgroonga_full_text_search_condition type and pgroonga_full_text_search_condition_with_scorers type are now deprecation. pgroonga_condition type is now recommended to use instead of pgroonga_full_text_search_condition type and pgroonga_full_text_search_condition_with_scorers type.

    Queries used with pgroonga full text_search condition type and pgroonga_full_text_search_condition_with_scorers type would change as follow.

    (Before-changes):

      column &@~ ('query', weights, 'scorers', index_name)::pgroonga_full_text_search_condition_with_scorers
      column &@~ ('query', weights, index_name)::pgroonga_full_text_search_condition
    

    (After changes):

      column &@~ pgroonga_conditon('query', weights, 'scorers', index_name => 'index_name')
      column &@~ pgroonga_conditon('query', weights, index_name => 'index_name')
    

    Note that 'index_name' requires designating argument name => 'value' style such as index_name => 'index_name'. Here is why 'index_name' is required to be designated as this way.

    Signature of pgroonga condition() is as follows. It is possible to leave out those arguments not required to be designated. Leaving out of the arguments would make unrecognizable where and what arguments are located. Therefore those arguments that has different location from the following signature are required to be designated by writing argument name => 'value' style.

      pgroonga_condition(query text,
                         weights int[],
                         scorers text[],
                         schema_name text,
                         index_name text,
                         column_name text)
    
  • [For Developers] Added new script to set up building environment. [GitHub#358][Patched by askdkc.]

    Here is how to use. It works in Debian/Ubuntu environment and doesn't work in those distributions delivered from Red Hat Enterprise Linux such as AlmaLinux.

      $ git clone https://github.com/pgroonga/pgroonga.git
      $ cd pgroonga
      $ ./setup.sh #create an environment to build PGroonga.
      $ ./build.sh SOURCE_DIRECTORY BUILD_DIRECTORY #Build PGroonga.
    

Fixes

  • Fixed the problem not used pgroonga_snippet_html() when update PGroonga 2.4.2 from 2.4.1[Reported by takadat]

  • Fixed the problem that PGroonga crashes when a first argument of pgroonga query expand() designate the tables not normal PostgreSQL.

    For example, PGroonga would crash if a first argument of pgroonga query expand() designate the foreign table as follow.

    CREATE EXTENSION IF NOT EXISTS postgres_fdw;
    
    CREATE SERVER remote_server
        FOREIGN DATA WRAPPER postgres_fdw
        OPTIONS (host 'localhost', port '5432', dbname 'remote_database');
    
    CREATE FOREIGN TABLE synonym_groups (
      synonyms text[]
    ) SERVER remote_server;
    
    SELECT pgroonga_query_expand('synonym_groups',
                                 'synonyms',
                                 'synonyms',
                                 'groonga');
    
    server closed the connection unexpectedly
    	This probably means the server terminated abnormally
    	before or while processing the request.
    The connection to the server was lost. Attempting reset: Failed.
    
  • Fixed the problem that PostgreSQL occurs PANIC by using up stacks to record the errors when there are too many errors within PGroonga.

    This problem occurs when using PGroonga 2.3.3 and later.

Thanks

  • askdkc
  • takadat

How to upgrade

If you're using PGroonga 2.0.0 or later, you can upgrade by steps in "Compatible case" in Upgrade document.

If you're using PGroonga 1.Y.Z, you can upgrade by steps in "Incompatible case" in Upgrade document.

Support service

If you need commercial support for PGroonga, contact us.

Conclusion

Try PGroonga when you want to perform fast full text search against all languages on PostgreSQL!