Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin panel/blueprint breaks indexer #132

Open
codebude opened this issue Jun 27, 2023 · 5 comments
Open

Admin panel/blueprint breaks indexer #132

codebude opened this issue Jun 27, 2023 · 5 comments

Comments

@codebude
Copy link

I may have found a bug. The value for the stemmer setting "Default" should be no. (At least as far as I can see from code.)

For the dropdown in the admin panel the value for stemmer->default is defined here:

Unfortunately the 'no' gets rendered as 0 in the admin ui (check "data-value"):

<div class="selectize-input items full has-options has-items">
     <div class="item" data-value="0">Disabled</div>
     <input type="select-one" autocomplete="off" tabindex="" style="width: 4px;">
</div>

If you click on save in admin ui, the value 0 will be stored in user/config/plugins/tntsearch.yaml which ultimately lead to the following exeception when you start the indexer:

Fatal error: Uncaught Error: Class "TeamTNT\TNTSearch\Stemmer\0Stemmer" not found in /var/www/html/user/plugins/tntsearch/vendor/teamtnt/tntsearch/src/Indexer/TNTIndexer.php:139
Stack trace:
#0 /var/www/html/user/plugins/tntsearch/classes/GravTNTSearch.php(237): TeamTNT\TNTSearch\Indexer\TNTIndexer->setLanguage('0')
// ...

To get an actual no into the config file via the admin ui, I propose to change the blueprint.yaml from

      default: no
      options:
        no: Disabled

to

      default: 'no'
      options:
        'no': Disabled
@Moonbase59
Copy link

Moonbase59 commented Nov 21, 2023

Confirm that, using Grav v1.7.43, Admin v1.10.43, TNT Search v3.4.0.

After having tried the German stemmer, I wanted to switch it off again and got a '0' in user/config/plugins/tntsearch.yaml as value for stemmer. And the error shown above.

My quick-n-dirty solution was to look up the original in user/plugins/tntsearch/tntsearch.yaml and use stemmer: default. This showed "Disabled" in the Admin panel and worked for reindexing.

I also tried your solution (quote the no’s), which works fine here.

@codebude
Copy link
Author

Glad to hear that you could solve your problem. Unfortunately there's no response from the package owner @trilby-bot
This would be really easy to fix.

@rhukster
Copy link
Member

@trilby-bot is just a bot, he's not going to be much help :)

I will look at this issue when i'm back next week.

@aasampaio
Copy link

Hi @rhukster !

Testing GRAV+TNT Search on two different VMs.
Both VMs have Grav v1.7.46 - Admin v1.10.46, TNT Search v3.4.0 + PHP 8.2

  • VM1 (Debian GNU/Linux 11 (bullseye) running on Cloudways) - GRAV + TNT Search work out of the box box - no update to blueprints.yaml is needed!

  • VM2 (Ubuntu 22.04.4 LTS on our corporate data-center) - Error while creating index when Stemmer is set to "disabled" - applied @codebude solution which corrected the issue.

No apparent differences in PHP config... Any ideas on why these two VMs behave differently? Can the OS difference be a factor here?
Maybe there are additional requirements for TNTSearch not listed in the docs?

@rhukster
Copy link
Member

rhukster commented Sep 2, 2024

That's strange, do you happen to know what the error was when the stemmer was disabled?

Was it a permissions issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants