Forum Replies Created

Viewing 15 replies - 1 through 15 (of 46 total)
  • Thread Starter flaviopv

    (@flaviusv)

    Hi,

    Plugin version 2.0.16, PHP 8.1.33.

    Meanwhile we have found a solution to solve that empty array, we added the code below. Maybe will consider to include it in next patch to update the plugin:


    home/hostname/public_html/wp-content/plugins/search-with-typesense/includes/Frontend/Frontend.php : public function load_scripts()

    public function load_scripts()

    {

    $admin_settings = Admin::get_default_settings();

    $search_config_settings = Admin::get_search_config_settings();

    $build_path = CODEMANAS_TYPESENSE_ROOT_URI_PATH . '/build/';



    $instant_search_script = @include CODEMANAS_TYPESENSE_ROOT_DIR_PATH . '/build/frontend/instant-search.asset.php';

    $autocomplete_script = @include CODEMANAS_TYPESENSE_ROOT_DIR_PATH . '/build/frontend/autocomplete.asset.php';

    $popup_script = @include CODEMANAS_TYPESENSE_ROOT_DIR_PATH . '/build/frontend/popup.asset.php';

    // --------- INSTANT SEARCH: deps + version safe ----------

    $instant_deps = [ 'wp-util' ];

    $instant_version = false;

    if ( is_array( $instant_search_script ) ) {

    if ( ! empty( $instant_search_script['dependencies'] ) && is_array( $instant_search_script['dependencies'] ) ) {

    $instant_deps = array_merge(

    $instant_search_script['dependencies'],

    [ 'wp-util' ]

    );

    }

    if ( ! empty( $instant_search_script['version'] ) ) {

    $instant_version = $instant_search_script['version'];

    }

    }

    // --------------------------------------------------------

    // --------- AUTOCOMPLETE: deps + version safe ------------

    $autocomplete_deps = [ 'wp-util' ];

    $autocomplete_version = false;

    if ( is_array( $autocomplete_script ) ) {

    if ( ! empty( $autocomplete_script['dependencies'] ) && is_array( $autocomplete_script['dependencies'] ) ) {

    $autocomplete_deps = array_merge(

    $autocomplete_script['dependencies'],

    [ 'wp-util' ]

    );

    }

    if ( ! empty( $autocomplete_script['version'] ) ) {

    $autocomplete_version = $autocomplete_script['version'];

    }

    }

    // --------------------------------------------------------

    // --------- POPUP: deps + version safe -------------------

    $popup_deps = [ 'wp-util' ];

    $popup_version = false;

    if ( is_array( $popup_script ) ) {

    if ( ! empty( $popup_script['dependencies'] ) && is_array( $popup_script['dependencies'] ) ) {

    $popup_deps = array_merge(

    $popup_script['dependencies'],

    [ 'wp-util' ]

    );

    }

    if ( ! empty( $popup_script['version'] ) ) {

    $popup_version = $popup_script['version'];

    }

    }

    // --------------------------------------------------------

    // === JS: INSTANT SEARCH ===

    wp_register_script(

    'cm-typesense-instant-search',

    $build_path . 'frontend/instant-search.js',

    $instant_deps,

    $instant_version,

    true

    );

    wp_localize_script(

    'cm-typesense-instant-search',

    'cm_typesense_instant_search_default_settings',

    [

    'debug' => SCRIPT_DEBUG,

    'search_api_key' => $admin_settings['search_api_key'] ?? '',

    'port' => $admin_settings['port'] ?? '',

    'node' => $admin_settings['node'] ?? '',

    'protocol' => $admin_settings['protocol'] ?? '',

    'enabled_post_types' => $search_config_settings['enabled_post_types'] ?? [],

    'available_post_types' => $search_config_settings['available_post_types'] ?? [],

    'search_config' => $search_config_settings['config'] ?? [],

    'date_format' => apply_filters( 'cm_typesense_date_format', get_option( 'date_format' ) ),

    'localized_strings' => [

    'load_more' => __( 'Load More', 'search-with-typesense' ),

    'show_less' => __( 'Show less', 'search-with-typesense' ),

    'show_more' => __( 'Show more', 'search-with-typesense' ),

    ],

    'elementor_edit_mode' => (

    Bootstrap::getInstance()->is_plugin_active( 'elementor/elementor.php' )

    && \Elementor\Plugin::$instance->preview->is_preview_mode()

    ) ? 'true' : 'false',

    ]

    );

    // === JS: AUTOCOMPLETE ===

    wp_register_script(

    'cm-typesense-autocomplete',

    $build_path . 'frontend/autocomplete.js',

    $autocomplete_deps,

    $autocomplete_version,

    true

    );

    wp_localize_script(

    'cm-typesense-autocomplete',

    'cm_typesense_autocomplete_default_settings',

    [

    'debug' => SCRIPT_DEBUG,

    'search_api_key' => $admin_settings['search_api_key'] ?? '',

    'port' => $admin_settings['port'] ?? '',

    'node' => $admin_settings['node'] ?? '',

    'protocol' => $admin_settings['protocol'] ?? '',

    'enabled_post_types' => $search_config_settings['enabled_post_types'] ?? [],

    'available_post_types' => $search_config_settings['available_post_types'] ?? [],

    'search_config' => $search_config_settings['config'] ?? [],

    'hijack_wp_search__type' => $search_config_settings['hijack_wp_search__type'] ?? '',

    'autocomplete_input_delay' => $search_config_settings['autocomplete_input_delay'] ?? 0,

    'autocomplete_submit_action' => $search_config_settings['autocomplete_submit_action'] ?? '',

    'elementor_edit_mode' => (

    Bootstrap::getInstance()->is_plugin_active( 'elementor/elementor.php' )

    && \Elementor\Plugin::$instance->preview->is_preview_mode()

    ) ? 'true' : 'false',

    ]

    );

    // === JS: POPUP ===

    wp_register_script(

    'cm-typesense-popup',

    $build_path . 'frontend/popup.js',

    $popup_deps,

    $popup_version,

    true

    );

    wp_localize_script(

    'cm-typesense-popup',

    'cm_typesense_popup_default_settings',

    [

    'hijack_wp_search__type' => $search_config_settings['hijack_wp_search__type'] ?? '',

    ]

    );

    // === CSS ===

    wp_register_style(

    'algolia-satellite',

    CODEMANAS_TYPESENSE_ROOT_URI_PATH . 'assets/vendor/css/algolia-satellite.min.css',

    false,

    $instant_version

    false

    );

    wp_register_style(

    'cm-typesense-frontend-style',

    CODEMANAS_TYPESENSE_ROOT_URI_PATH . 'build/frontend/style-instant-search.css',

    [ 'algolia-satellite' ],

    $instant_version,

    false

    );

    wp_enqueue_style( 'cm-typesense-frontend-style' );

    }
    Thread Starter flaviopv

    (@flaviusv)

    Many thanks!

    Thread Starter flaviopv

    (@flaviusv)

    We all learn something new every day 🙂 Thanks for your kind support.

    Best!

    Thread Starter flaviopv

    (@flaviusv)

    About the suggestion to disable Composer’s platform check ("platform-check": false):
    This may allow the WordPress site to install or load dependencies even if the hosting PHP version doesn’t meet the declared requirements.
    However, it can lead to serious runtime issues.

    Risk:
    The code or plugins may use functions or constants only available in PHP 8.1+ (e.g. enum, readonly, str_contains(), etc.).
    At runtime, this can result in:

    • syntax errors (if newer PHP syntax is used),
    • undefined function/class errors,
    • incompatibilities with certain PHP extensions.

    In short, disabling the platform check only bypasses Composer’s validation — it doesn’t make the code or plugins actually compatible with the current PHP version.

    For WordPress environments, the safer approach is to make sure the hosting PHP version matches the one required in composer.json (e.g. PHP 8.2+).

    Best,

    Thread Starter flaviopv

    (@flaviusv)

    You had the obligation to inform users about the issues related to updating to the newest version, in changelog: “Be aware that updating will broke your website and for a correct functionng the php 8.2 is required.”

    When a plugin or theme update can break site functionality, especially because of increased PHP version requirements, that information must be clearly and prominently communicated. Ideally:

    1. In the changelog, with an explicit warning (e.g., “Requires PHP 8.2+; earlier versions will cause fatal errors”).
    2. In the update notice, so WordPress displays it before users click “Update.”
    3. In the plugin’s “Requires PHP” field in the WordPress repository metadata — this triggers the WordPress core to block incompatible updates automatically.

    Unfortunately, many developers fail to update these fields correctly, or WordPress doesn’t enforce these metadata strongly enough, so users end up discovering the problem after their sites go down.

    It should be a main concern of WordPress to enforce these disclosures and compatibility checks automatically. The platform could, for example, prevent updates when the active PHP version is lower than the plugin requires — or at least display a large red warning banner.

    .

    Thread Starter flaviopv

    (@flaviusv)

    HI,

    we don’t want to update the php version to 8.2 just for make your plugin work. We have an entire tech stack to check. Better uninstall your plugin.

    Thread Starter flaviopv

    (@flaviusv)

    Hi,

    our mem limit is set as below:

    define('WP_MEMORY_LIMIT', '2048M' );
    define('WP_MAX_MEMORY_LIMIT', '4096M');
    Thread Starter flaviopv

    (@flaviusv)

    Hi,

    I ran some checks and found that the TS index is up to date, the last post was sent to the TS server, leaving aside the discrepancy between the number of posts in the database and the number of documents in the TS index.

    Another problem I discovered is that certain posts in the TS index are associated with the Uncategorized category, instead of having their own category assigned to them. Do you know how could we fix this?

    Thread Starter flaviopv

    (@flaviusv)

    HI,

    it is disabled, it has always been.

    Thread Starter flaviopv

    (@flaviusv)

    I cannot access Tutor support portal as we didn’t renewed the Pro subscription:

    Unlock with Subscription. You must have an active subscription to open a ticket.

    We didn’t renewed the Pro license, because we had a lot of problems with Tutor and nobody has solved them. We paid a Pro version and we get no support. 90% of our tickets has been closed without solving the reported problem.

    Thread Starter flaviopv

    (@flaviusv)

    Hi,

    meanwhile will wait for the parser to load new content tomorrow, we have found this logs in error log:

    PHP Fatal error:  Uncaught Error: Undefined constant “Codemanas\Typesense\CODEMANAS_TYPESENSE_ROOT_DIR_PATH” in /home/HOST/public_html/wp-content/plugins/search-with-typesense/includes/Bootstrap.php:81
    Stack trace:

    0 /home/HOST/public_html/wp-content/plugins/search-with-typesense/includes/Bootstrap.php(42): Codemanas\Typesense\Bootstrap->autoload()

    1 /home/HOST/public_html/wp-content/plugins/search-with-typesense/includes/Bootstrap.php(26): Codemanas\Typesense\Bootstrap->__construct()

    2 /home/HOST/public_html/wp-content/plugins/search-with-typesense/includes/Bootstrap.php(163): Codemanas\Typesense\Bootstrap::getInstance()

    3 phar:///home/HOST/public_html/wp/vendor/wp-cli/wp-cli/php/utils.php(160): require_once(‘/home/HOST/pub…’)

    4 phar:///home/HOST/public_html/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LoadRequiredCommand.php(56): WP_CLI\Utils\load_file(‘/home/HOST/pub…’)

    5 phar:///home/HOST/public_html/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(84): WP_CLI\Bootstrap\LoadRequiredCommand->process(Object(WP_CLI\Bootstrap\BootstrapState))

    6 phar:///home/HOST/public_html/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(35): WP_CLI\bootstrap()

    7 phar:///home/HOST/public_html/wp/php/boot-phar.php(20): include(‘phar:///home/HOST…’)

    8 /home/HOST/public_html/wp(4): include(‘phar:///home/HOST…’) 9 {main}

      thrown in /home/HOST/public_html/wp-content/plugins/search-with-typesense/includes/Bootstrap.php on line 81

     PHP Warning:  Undefined property: stdClass::$fields in /home/HOST/public_html/wp-content/plugins/search-with-typesense/templates/instant-search.php on line 33

    Thread Starter flaviopv

    (@flaviusv)

    Hi,

    I will pass to our dev this, and will see what is happening on Monday when the parser will run again.

    Meanwhile, how we can send to TS index the remained, not indexed, aprox 1100 posts?

    regards,

    Thread Starter flaviopv

    (@flaviusv)

    Hi,

    we are adding new articles as posts from parsing the Official Journal, every morning. But it seems the plugin can;t send all the articles to the TS index.

    Here is a breakdown:

    08.10

    07:41 312691 (sent to TS index)

    11:16 312791

    14:30 312825 stop wp cli total: 312.918

    23:19 312879

    09.10 total: 313.222

    07:44 312924

    15:07 312970

    10.10

    08:35 313057 total: 313.470

    15.10

    09:47 313627 total: 314.590

    16:10

    09:23 313774 total: 314.836

    17.10

    09:27 313827 total: 314.964

    Thread Starter flaviopv

    (@flaviusv)

    Hi,

    Than you for clarification. We have successfully indexed all 310,000 posts from our DB, but now we face another challenge: there are more new articles than new articles sent to the TS index, on daily basis. And this situation created a gap between the number of articles from database and the number of articles from TS index.

    For example, in a day there are 400 new articles, but only 100 are being sent to TS index during that day. By doing this, the gap is increasing each day.

    Could you please help us figure out what we should do to successfully sent all new articles from our WP database to TS index on daily basis – for adding the new content, not for reindexing from scratch – in a way we would have the TS index up to date?

    Do we need to send to the index manually by actioning the Index button from “…?page=codemanas-typesense&tab=search-configuration”, or we should run on daily basis the index WP CLI command (by raising a daily ticket to our hosting)? Or maybe there is other solution.

    Many thanks!

    Thread Starter flaviopv

    (@flaviusv)

    Hi,

    Thank you very much, your solution is working. Now we are able to send in avg. 10k posts/hr.

Viewing 15 replies - 1 through 15 (of 46 total)