Custom fields not searchable after J4 upgrade

Need help upgrading your Joomla! website or converting to Joomla! 4.x?

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
joomhoo
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Tue Oct 05, 2021 10:14 am

Custom fields not searchable after J4 upgrade

Post by joomhoo » Tue Oct 05, 2021 10:33 am

Hi there,

I've migrated an existing site from 3.10.x to 4.0.3, and it is mostly going well except for custom fields for articles in the site search.
  • I use Smart Search/com_finder
  • I can see the expected custom field values in the 'fields_values' database table.
  • However, the custom field values are nowhere to be found in the 'finder_terms' database table (before or after re-index).
  • But if I look in the 3.10.x table, the custom field values are in the 'finder_terms' database table.
It seems that custom field values are no longer being indexed in the 4.0.3 upgrade, and not finding their way into the 'finder_terms' table. Has anyone else experienced this?

joomhoo
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Tue Oct 05, 2021 10:14 am

Re: Custom fields not searchable after J4 upgrade, OR fresh J4 install

Post by joomhoo » Wed Oct 06, 2021 7:31 am

It looks like custom fields aren't searchable in a fresh Joomla! 4 install either. (Tested on WAMPSERVER, PHP 7.4.10)

Here's what I did...
  • Create Content 'Field Group' called 'Test' (Articles) > Save and Close
  • Create Content 'Fields' called 'Test for Search' (Articles) > Text type, assign to Field Group: 'Test' > Save and Close
  • Create Content 'Article' called 'Home';
    • - Featured: Yes
    • - Content tab: type "Hello, this is a test."
    • - Test tab: type "Ambulance" in 'Test for Search' field.
    • - Save and Close
  • Create Module 'Smart Search' called 'Search' > assign to Position: 'Search' > Save and Close
  • Run 'Index' for 'Smart Search'
  • Search on frontend;
    • - "Hello" returns 1 result
    • - "Ambulance" returns 0 results
So "Ambulance", that is stored in a custom field, isn't being found by the Smart Search.

Am I correct in thinking that they should be searchable, as they are in 3.10.x ? Is this a bug?

joomhoo
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Tue Oct 05, 2021 10:14 am

Re: Custom fields not searchable after J4 upgrade

Post by joomhoo » Fri Nov 05, 2021 1:51 pm

I've been thinking about this differently and have realised that you can make custom fields searchable by inserting them into the article they're attached to.

So in the editor window, I used the 'Fields' button underneath to insert my custom fields into the article body like this;

Code: Select all

<p>{fieldgroup 1}{fieldgroup 2}{fieldgroup 3}{fieldgroup 4}{fieldgroup 5}{fieldgroup 6}{fieldgroup 7}</p>
After I save, the content stored within them can be found by Smart Search.

Of course, they are rendered in the article pages, but they can be visually hidden with CSS;

Code: Select all

.fields-container { display:none }
Needs more investigation, but I *think* this works for my needs. Hope it helps somebody else.

joomhoo
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Tue Oct 05, 2021 10:14 am

Re: Custom fields not searchable after J4 upgrade

Post by joomhoo » Mon Dec 06, 2021 10:19 am

While adding {fieldgroup X} into the Content tab of the Articles editor makes custom fields searchable, having to remember to add them to each article is proving to be a bit of a bind.

Does anyone know how to add them into content automatically? And preferably make it so they cannot be removed again?

User avatar
brian
Joomla! Master
Joomla! Master
Posts: 12461
Joined: Fri Aug 12, 2005 7:19 am
Location: Leeds, UK
Contact:

Re: Custom fields not searchable after J4 upgrade

Post by brian » Mon Dec 06, 2021 12:25 pm

are you sure you weren't using an extension to support searching of custom fields in j3. fairly sure it wasnt possible in j3 either
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/

joomhoo
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Tue Oct 05, 2021 10:14 am

Re: Custom fields not searchable after J4 upgrade

Post by joomhoo » Mon Dec 06, 2021 3:20 pm

Hi - Yes I'm sure I have no extensions that helped the search in Joomla! 3.

I only have about 5 extensions installed (such as JCE editor, Helix Ultimate, JL Sitemap, JS CSS Control and JCH Optimize) and as far as I'm aware, none impact upon the search. The only difference between the sites is the Joomla! version.

I built it mostly using template overrides and took my cues from this post regarding custom fields search when I built it viewtopic.php?p=3569858#p3569858


Post Reply

Return to “Migrating and Upgrading to Joomla! 4.x”