jemproject / JEM-Project

JEM - an Event Manager for Joomla
https://www.joomlaeventmanager.net
GNU General Public License v3.0
25 stars 37 forks source link

Error when Indexing for Smart Search/Finder #1605

Open Heklaterriol opened 1 year ago

Heklaterriol commented 1 year ago

We already had this error before (I couldn't finde the issue)

On a clean JEM 4.0.0 installation when trying to index for Smart Search I get the following message (and no events are indexed):

An Error Has Occurred

The following message was returned by the server:
A parse error has occurred while processing the following JSON data:
JSON.parse: unexpected character at line 1 column 1 of the JSON data

JEM    0 of 6
Categories    0 of 5
Contacts    0 of 1
Content    0 of 1
Newsfeeds    0 of 0
Tags    0 of 0

With JEM - Smart Search Plugin disabled I don't get any errors

in the error log I didn't find any useful information, just:

#Fields: datetime   priority clientip   category    message
2023-07-06T11:23:09+00:00   INFO 93.224.xx.xx   -   Starting the indexer
2023-07-06T11:23:09+00:00   INFO 93.224.xx.xx   -   Starting the indexer batch process
2023-07-06T11:23:09+00:00   INFO 93.224.xx.xx   -   Batch completed, peak memory usage: 29,360,128 bytes
mckillo commented 1 year ago

I have tried to simulate the error, but I didn't find it. Tell me any more details to see it (capture, envioroment, action, views).

Heklaterriol commented 1 year ago

I don't have much more information, see the screen capture. It is once with the JEM Smart Search plugin enabled (indexing error), once with the plugin disabled (index works fine)

https://github.com/jemproject/JEM-Project/assets/28540581/4e6e76e7-142f-48eb-93b5-97527694a25b

Heklaterriol commented 1 year ago

I would like to get this problem solves and did some research.

Issue: JEM events and categories are not indexed

With Error reporting off there is no error With Error reporting on maximum I get

An Error Has Occurred The following message was returned by the server: A parse error has occurred while processing the following JSON data: JSON.parse: unexpected character at line 1 column 1 of the JSON data jemsmartsearcherror

I found out that I can use the CLI (Command Line Interface) to get more information:

With the command php cli/joomla.php -v finder:index I get the following output:

 Starting Indexer
 Setting up Smart Search plugins

Setup 15 items in 0.012 seconds.

In route.php line 229:

[Error]                                                                        
Call to undefined method Joomla\CMS\Application\ConsoleApplication::getMenu()                                                                                   

Exception trace:

at /www/htdocs/w01374a6/subdomain-access/jem4dev.datenablage.info/components/com_jem/helpers/route.php:229

JEMHelperRoute::_findItem()
at /www/htdocs/w01374a6/subdomain-access/jem4dev.datenablage.info/components/com_jem/helpers/route.php:131

JEMHelperRoute::getEventRoute()
at /www/htdocs/w01374a6/subdomain-access/jem4dev.datenablage.info/plugins/finder/jem/jem.php:282

plgFinderJEM->index()
at /www/htdocs/w01374a6/subdomain-access/jem4dev.datenablage.info/administrator/components/com_finder/src/Indexer/Adapter.php:244

Joomla\Component\Finder\Administrator\Indexer\Adapter->onBuildIndex()
at /www/htdocs/w01374a6/subdomain-access/jem4dev.datenablage.info/libraries/src/Plugin/CMSPlugin.php:284

Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin\{closure}()
at /www/htdocs/w01374a6/subdomain-access/jem4dev.datenablage.info/libraries/vendor/joomla/event/src/Dispatcher.php:486

Joomla\Event\Dispatcher->dispatch()
at /www/htdocs/w01374a6/subdomain-access/jem4dev.datenablage.info/libraries/src/Application/EventAware.php:111

Joomla\CMS\Application\ConsoleApplication->triggerEvent()
at /www/htdocs/w01374a6/subdomain-access/jem4dev.datenablage.info/libraries/src/Console/FinderIndexCommand.php:388

Joomla\CMS\Console\FinderIndexCommand->index()
at /www/htdocs/w01374a6/subdomain-access/jem4dev.datenablage.info/libraries/src/Console/FinderIndexCommand.php:209

Joomla\CMS\Console\FinderIndexCommand->doExecute()
at /www/htdocs/w01374a6/subdomain-access/jem4dev.datenablage.info/libraries/vendor/joomla/console/src/Command/AbstractCommand.php:235

Joomla\Console\Command\AbstractCommand->execute()
at /www/htdocs/w01374a6/subdomain-access/jem4dev.datenablage.info/libraries/vendor/joomla/console/src/Application.php:1181

Joomla\Console\Application->runCommand()
at /www/htdocs/w01374a6/subdomain-access/jem4dev.datenablage.info/libraries/vendor/joomla/console/src/Application.php:403

Joomla\Console\Application->doExecute()
at /www/htdocs/w01374a6/subdomain-access/jem4dev.datenablage.info/libraries/src/Application/ConsoleApplication.php:206

Joomla\CMS\Application\ConsoleApplication->doExecute()
at /www/htdocs/w01374a6/subdomain-access/jem4dev.datenablage.info/libraries/vendor/joomla/console/src/Application.php:448

Joomla\Console\Application->execute()
at /www/htdocs/w01374a6/subdomain-access/jem4dev.datenablage.info/libraries/src/Application/ConsoleApplication.php:259

Joomla\CMS\Application\ConsoleApplication->execute()
at /www/htdocs/w01374a6/subdomain-access/jem4dev.datenablage.info/cli/joomla.php:76

I tried with my basic coder knowlegde to find the error – no success!

@mckillo Do you see anything?

jojo12 commented 1 year ago

https://docs.joomla.org/Creating_a_Smart_Search_plug-in

jojo12 commented 1 year ago

When I put the jem-finder plugin at the end of the finder plugins, then the indexer work and gives at the end the error. All the other finder plugins gave results!

Heklaterriol commented 1 year ago

https://docs.joomla.org/Creating_a_Smart_Search_plug-in

Yes, I know the document, but I lack the programming knowledge and expertise to make anything out of it.

Heklaterriol commented 1 year ago

I also saw that the other finder plugins have a indentical files structure, different from the JEM finder plugin.

finderplugins

I copied one of them and tried to modify it for JEM, but it didn't work.

mckillo commented 1 year ago

@Heklaterriol Received request. This weekend, I'll study this case and I 'll try to debug it (first simulation, second resolving). Sorry, I have returned this week of my vacations and I'm full in my work.

Heklaterriol commented 1 year ago

Yes, not hurry. It's just that you are the only real coder here :-)

mckillo commented 1 year ago

Thanks, but I'm not a pure coder, I'm a resolving problem engineer and parts of solutions are with code ;-) I like to debug error and give solution.

I have note to try it this weekend.

Heklaterriol commented 9 months ago

A coder friend of mine said, that he will have a look at it.

jojo12 commented 3 months ago

@mckillo; When I look into different finder plugins (I am testing with and without compat plugin), most of the finder plugins work without the new system! Perhaps this can help to bring to function the jem plugin: phoca has a lot of different working finder plugins: phocadownload, phocadownloadcategory, phocagallerycategory, phocagalleryimage, phocacartproduct. so there are finder plugins for different extensions. We can compare them to find, what jem needs.

Heklaterriol commented 3 months ago

I discussed this with my coder friend and he said, that JEM does not follow the recent Joomla code architecture and that's why it is difficult to just adapt an other finder plugin.

Since I'm not a programmer, I can't estimate to what extent this assessment is really correct.

jojo12 commented 3 months ago

For sure you can't use Joomla code, but other outside extension are interesting!

For me it seems interesting too, that phoca uses different finder plugins for different things (would say in our JEM: a plugin for events an other for venues!

jojo12 commented 3 months ago

I was comparing the different finder plugins. And suddenly I saw that jem was indexed. But it was too late, I just loosed this working file. But now I know, there must be a possibility to adapt it. (@hekla: So for me the info your dev gave, is much too easy. Sorry when I say that.)

jojo12 commented 3 months ago

grafik grafik

Heklaterriol commented 3 months ago

Cool, very nice! Can you please make a branch for that, so I can test it too.

(My dev friend was much more complicated, not easy - he may be too perfetionistic. He would have loved to rebuild the whole architecture and code Joomla 5 conform, if he had time.)

jojo12 commented 3 months ago

sorry, but I am not a dev and I am a bit stupid. I don't understand the whole thing, so I tried with comparing the different finder plugins (after all from outside extensions). And I did see that some change worked, I saw it too late. So I have nothing in my hands. I will retry to finde, but because I am not a dev. But this is important: Finder plugins in J!5 must not yet have the new structure. It's easier to update the old. (I am even testing without compatibility plugin.

Heklaterriol commented 3 months ago

But this is important: Finder plugins in J!5 must not yet have the new structure. It's easier to update the old. (I am even testing without compatibility plugin.

Tha's good news!

Can you just tell us, which plugin you modified and experimented? And if you have a working jem finder pluginon a Joomla site, you can get the code from there

jojo12 commented 3 months ago

It suddenly happened again, that I got a Index without noticing it. So in the branch jem-finder-plugin-jojo it put the jem.php I was working around, but it gives me errors, but it must be near! Please help, test and try! (I was comparing jem-finder with different phoca finder plugins.)

jojo12 commented 3 months ago

(it seems, there must be something which is searching for state. This causes a problem in JEM with saving) #1763