? Language Change ? Pending

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
20 Jan 2022

Pull Request for Issue #12829.

Summary of Changes

This PR implements indexing of the custom fields for a component. This is controlled on a per field basis, where you can select if the content should be just added to the search index or handled as a taxonomy or both or actually none of the above. You can then implement this feature for your respective finder plugin with a single line of code.
Each custom field has a new option in its edit screen where you can select how the indexer should treat this field. The finder plugin then has to call Helper::addCustomFields($item, 'context'); and the rest is just magic. ;)
Right now this is implemented for com_content and com_contacts.

Testing Instructions

  1. Your installation should have some custom fields for com_content or com_contact in it.
  2. Edit a custom field and set the "Smart Search" option to "Make searchable and add as taxonomy".
  3. Run the indexing process either by running the mass indexer in the smart search component or by editing an item and saving it again.
  4. See that the custom field shows up as a taxonomy and can be find by searching for its value.

Documentation Changes Required

The documentation needs to be amended to contain how to implement this feature for third party finder plugins.

Notes

  1. Since 4.1 is in RC, this will have to go into 4.2. Since there is no 4.2-dev branch yet, I'm pointing this towards 4.1-dev for now.
avatar Hackwar Hackwar - open - 20 Jan 2022
avatar Hackwar Hackwar - change - 20 Jan 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 20 Jan 2022
Category Administration com_fields com_finder Language & Strings Front End Plugins
avatar Hackwar Hackwar - change - 20 Jan 2022
Labels Added: Language Change ?
avatar Hackwar
Hackwar - comment - 20 Jan 2022

This also solves #13338

avatar laoneo
laoneo - comment - 20 Jan 2022

Nice, how would the data be represented on the site part in a search result?

avatar Hackwar
Hackwar - comment - 20 Jan 2022

Nice, how would the data be represented on the site part in a search result?

If it is a taxonomy, it would simply use the given string in a dropdown. Otherwise it wouldn't display the custom fields by default. For output, you should create your own layout, maybe load custom fields again or similar stuff.

avatar Hackwar Hackwar - change - 24 Jan 2022
Labels Added: ?
Removed: ?
avatar drmenzelit
drmenzelit - comment - 17 May 2022

I have tested this item successfully on 92b39ea

Tested with three different fields:

  • Text field in Content
  • Text field in Contacts
  • List field in Contacts
    Tried the different parameters in the fields.
    It works as described.

Great PR! Thank you Hannes.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36747.

avatar drmenzelit drmenzelit - test_item - 17 May 2022 - Tested successfully
avatar Quy
Quy - comment - 17 May 2022

I have not checked all field types so should this setting be excluded such as media, list of images...?

36747

avatar coolcat-creations
coolcat-creations - comment - 19 May 2022

We installed this PR with the prebuilt package and smart search does not work at all (even not with normal content)

  • Plugins are enabled
  • Fields are setup
  • Menu item is set up
  • Content is successfully indexed

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36747.
avatar Hackwar
Hackwar - comment - 19 May 2022

Can you be a bit more specific? Does it return any search results or do you get a white screen in the frontend or backend? Since this only changes how stuff is indexed and doesn't do anything related to the actual searching, this might even be a new bug.

avatar coolcat-creations
coolcat-creations - comment - 19 May 2022

Article Content is for example cheeseburger and when you search for cheeseburger, the article can't be found at all. It says that there are no search results for that.

avatar Hackwar
Hackwar - comment - 19 May 2022

I think I found the issue and it is not related to this PR. I'm guessing that you wrote an article, saved it and then went to the frontend searching for it, right? We are storing the current time and date as publish_start date. In the SQL query to retrieve the results, we do compare that timestamp with the current time minus the seconds. That last part is done so that such a query doesn't change every second and the database has a chance to cache it. So if you wait a few more seconds until the next minute ticks around, the results should show up. I was able to recreate exactly that behavior. But: All of this is not related to this PR.

avatar webnet-assmann
webnet-assmann - comment - 19 May 2022

I have tested this item successfully on 92b39ea

testet with 3 different custome fields:
Content Field: tet and editor
contact field: text
Thanks a lot Hannes!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36747.

avatar webnet-assmann webnet-assmann - test_item - 19 May 2022 - Tested successfully
avatar chmst chmst - change - 20 May 2022
Status Pending Ready to Commit
avatar chmst
chmst - comment - 20 May 2022

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36747.

avatar roland-d roland-d - change - 20 May 2022
Labels Added: ?
avatar rdeutz rdeutz - change - 20 May 2022
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2022-05-20 10:46:09
Closed_By rdeutz
avatar rdeutz rdeutz - close - 20 May 2022
avatar rdeutz rdeutz - merge - 20 May 2022
avatar heelc29
heelc29 - comment - 21 May 2022

@rdeutz Can you add this to milestone

avatar joomdonation
joomdonation - comment - 21 May 2022

@Hackwar Look like we attempted to index custom fields before already in fields system plugin https://github.com/joomla/joomla-cms/blob/4.2-dev/plugins/system/fields/fields.php#L512

However, look like that code is not working at all. With the feature introduce in this PR, what should we do with that existing code ?

avatar Hackwar
Hackwar - comment - 22 May 2022

That code is pretty much useless. We should delete it entirely.

avatar roland-d
roland-d - comment - 5 Jul 2022

@Hackwar I have reverted this PR in light of the issues found in issue #38222 Please review the findings and propose a new PR which we can use. Thank you.

Add a Comment

Login with GitHub to post a comment