J3 Issue No Code Attached Yet
avatar Bakual
8 Nov 2016

Steps to reproduce the issue

  1. Make sure Smart Search (com_finder) is working before you start testing
  2. Create a custom field
  3. Edit an item and assign a value to that field and save.
  4. Search for the newly saved value using Smart Search

Expected result

The item shows up in the result list.

Actual result

The item doesn't show up.

Additional comments

Interesting enough, the item shows up if you run the indexer manually in com_finder. This tells me it is supposed to work and just fails during the save event somewhere.

avatar Bakual Bakual - open - 8 Nov 2016
avatar joomla-cms-bot joomla-cms-bot - change - 8 Nov 2016
Labels Added: No Code Attached Yet
avatar brianteeman brianteeman - change - 8 Nov 2016
Category com_fields com_finder
avatar laoneo
laoneo - comment - 8 Nov 2016

com_fields is hooking into the onPrepareFinderContent event here https://github.com/joomla/joomla-cms/blob/staging/plugins/system/fields/fields.php#L539. Must be done something different on the save event?

avatar Bakual
Bakual - comment - 8 Nov 2016

Looking at the supported events in the finder plugins I'd say it's the wrong event to use. But I don't know how finder works. @chrisdavenport is the master chief there 😄

avatar mbabker
mbabker - comment - 8 Nov 2016

Hook into onFinderAfterSave which is fired from the "Content - Smart Search" plugin when enabled. Check the "Smart Search - Content" (this naming still is goofy as all can be) for other Smart Search specific events that are triggered when the content plugin is enabled.

avatar laoneo
laoneo - comment - 14 Nov 2016

I'v just tested it and as soon as I'v enabled the "Content - Smart Search" plugin, it worked

avatar brianteeman
brianteeman - comment - 14 Nov 2016

@Bakual can you confirm that you had the plugin enabled? From my memory of smart search it makes perfect sense that this would have to be enabled

avatar Bakual
Bakual - comment - 14 Nov 2016

I think I had it enabled, but can't say for certain.
I did some more tests now (with the plugin enabled 😄).
I can confirm it's updating the fields, but not there are some bugs. Maybe that's what I experienced:

  • When pressing "Save" ("apply", not "Save & Close) it doesn't update Smart Search. Even after saving multiple times. It updates as soon as I change another field and save, but then the newly changed field isn't updated.
  • When pressing "Save & Close", it doesn't update Smart Search, however when opening the article again and saving again, it updates.

It acts real strange imho and I don't know why that is.

avatar laoneo
laoneo - comment - 22 Nov 2016

@chrisdavenport can you help out here?

avatar chrisdavenport
chrisdavenport - comment - 22 Dec 2016

I've had a look at this issue and I've fixed a number of problems and I have it mostly working now (PR to follow). However, the most basic problem is that this line: https://github.com/joomla/joomla-cms/blob/staging/plugins/system/fields/fields.php#L521 is returning the old value for the custom field, rather than the new value. That's why the first save doesn't update the index, but the second one does. Any idea how to fix that?

avatar laoneo
laoneo - comment - 23 Dec 2016

I guess we can close this one as there is a pr availabke.

avatar Bakual
Bakual - comment - 23 Dec 2016

If I understand @chrisdavenport right, it doesn't fix it fully. It still only updates on second save.

avatar chrisdavenport
chrisdavenport - comment - 23 Dec 2016

That's right. If someone can fix $fields = FieldsHelper::getFields($extension . '.' . $section, $tmp, true); so it returns the new field values rather than the old ones, then it could be considered a fix. Until then, I suggest we leave this open.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 1 Feb 2017

if Issue isn't fixable Users should get at "Fields" a Message about "Save Article 2 Times to index Field for Search in Frontend" (like in ACL about "Inherited", "Denied", ...).

avatar franz-wohlkoenig franz-wohlkoenig - change - 5 Apr 2017
Status New Confirmed
avatar franz-wohlkoenig franz-wohlkoenig - change - 8 Nov 2017
Status Confirmed Discussion
avatar brianteeman brianteeman - change - 25 Mar 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 25 Mar 2018
avatar jwaisner jwaisner - change - 12 Mar 2020
Status Discussion Confirmed
Build master staging

Add a Comment

Login with GitHub to post a comment