Bigint should provide data type to search_api module

Created on 12 February 2021, over 3 years ago
Updated 20 March 2024, 3 months ago

Problem/Motivation

In order to index fields with bigint into Elasticsearch, one needs to create data type mapping for search_api. The patch is very simple, but question remains which module should implement this. My propose is to add data_type plugin into bigint module.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇫🇮Finland sokru

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇧🇪Belgium tim-diels Belgium 🇧🇪

    This looks good, but there must be steps to test this or maybe even an automated test?

  • Status changed to Postponed: needs info 3 months ago
  • 🇧🇪Belgium tim-diels Belgium 🇧🇪

    I'm testing this with the search_api module and to my testing, it doesn't need a bigint data_type for search_api.

    Steps I took:

    • Intall bigint
    • Install search_api
    • Add bigint field to a content type
    • Add an index with a database backend
    • Add the bigint field
    • Index the content

    You can see in the database, the field is indexed as a bigint datatype.

    So we'll need more info on why it is not working for you and what is not working.

  • Status changed to Active 3 months ago
  • 🇫🇮Finland sokru

    The Search API backend also needs to support the Bigint datatype. The referenced issue for Elasticsearch #3198497: Support 64-bit integer numeric value → has a patch for Elasticsearch and for search_api_db the search_api module needs following patch (for 8.x-1.13 release)

    diff --git a/modules/search_api_db/src/Plugin/search_api/backend/Database.php b/modules/search_api_db/src/Plugin/search_api/backend/Database.php
    index a7ed3c7f..ee631d42 100644
    --- a/modules/search_api_db/src/Plugin/search_api/backend/Database.php
    +++ b/modules/search_api_db/src/Plugin/search_api/backend/Database.php
    @@ -945,6 +945,7 @@ class Database extends BackendPluginBase implements AutocompleteBackendInterface
           case 'uri':
             return ['type' => 'varchar', 'length' => 255];
    
    +      case 'bigint':
           case 'integer':
           case 'duration':
           case 'date':
    @@ -1683,6 +1684,7 @@ class Database extends BackendPluginBase implements AutocompleteBackendInterface
             }
             return $value;
    
    +      case 'bigint':
           case 'integer':
           case 'date':
             return (int) $value;
    

    Adding the tests is a bit cumbersome since currently it would require an above patch for search_api module.

  • 🇧🇪Belgium tim-diels Belgium 🇧🇪

    I see. Thanks for the information. I'm not able to test for the elasticsearch part for now.

    And in my understanding, 2 other modules need patches to get this working:
    * elasticsearch_connector
    * search_api => search_api_db (submodule)

    So the maintainers of those modules will need to be willing to include the patch before we can think to implement this in our module as otherwise it is very hard to maintain.

Production build 0.69.0 2024