Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › ACF content not indexed/searched
- This topic has 26 replies, 2 voices, and was last updated 7 years, 2 months ago by
BorisWebdesign.
-
AuthorPosts
-
March 18, 2019 at 2:48 pm #21668
BorisWebdesign
ParticipantHello,
i just purchased the Ajax Search Pro WordPress plug-in. I recently asked you if it has support for ACF (Advanced Custom Fields), and the answer was yes. This is vital, as the website I am implementing it on, makes heavy use of ACF.So far, I have been unable to get the ACF fields content indexed and in the search results.
I have tried to find these settings: LINK TO KB, but that setting is no longer present in the plugin settings.
I’ve also tried by adding a code snippet to my functions.php, as suggested HERE, but that is also not helping. And even if it did, that would be a poor solution because I would need to manually add each repeater field.
I did find an option to index custom fields via Index Table > General, but that also means adding each custom field manually. There is no option to just add every custom field.
Can you help me fix this?
I’ve supplied WP credentials, but please send me your public IP address first, so I can add it to the access list. The website is not public yet.
Regards,
Boris HoekmeijerMarch 18, 2019 at 4:15 pm #21674Ernest Marcinko
KeymasterHi,
Please note that repeater fields are not supported – every other ACF text based field is, exceptions are the repeaters, as those are not stored as textual values and those does not have any fixed content layout to parse. The only possible solution is that knowledge base article unfortunately.
The ACF API does not have a way to get all repeater field subfieds to index, because of that there is no way for us to integrate a permanent solution. There is also no way to list only the repeater fields, which makes it even harder.
Do you have by any chance a list of the fields to index, or do you simply vant to index all fields there are? Indexing all custom fields is not implemented on purpose, as parsing every custom field on a post can easily cause the index process to fail, as in some cases people have 1000s of fields per post, and PHP usually cannot handle that amount of data.
Maybe I can suggest a modification to that code to index everything, let me know if that is what you want to try.
March 18, 2019 at 4:45 pm #21677BorisWebdesign
ParticipantHi Ernest,
thanks for clarifying the problem. Yes, I have a list of fields I want to index:
dagelijks,
rvt,
contact_gebouw,
contact_adres,
contact_email,
contact_telefoon,
contact_mobiel,
links_alg_kop,
links_alg,
links_rc_kop,
links_rcThe list will still be expanded while I’m building, but once the custom fields are in place, there will not be many changes to them. And if there are, I will be the one making them. So if you can help me get that code snippet working with this list, that would certainly be good enough for me.
Boris
March 19, 2019 at 9:38 am #21687Ernest Marcinko
KeymasterThank you Boris.
Okay, so based on the list, here is a modified version of that suggested code. Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!
The newly created custom fields you can add to the $field_names variable. This should also handle non-relationship and non-repeater fields as well. The repeater sub-fields should be automatically converted to non-arrays. There is still a chance that this may not work, as repeaters and relationship fields does not have a fixed structure, but I think this is as close as it gets.
March 19, 2019 at 2:27 pm #21697BorisWebdesign
ParticipantHi Ernest,
thanks very much. I added the script to functions.php. After that, I went to Index Table > Create new index.
When I then go to the front-end and do a search for something I know is in one of those fields, it still comes up with zero results. Am I missing a step?March 19, 2019 at 3:16 pm #21700Ernest Marcinko
KeymasterHi,
That should do the trick, unless there is something I’m missing here. Are all of these fields repeater/relationship fields you listed?
Can you please add temporary FTP details, I would like to debug through this code, maybe there is an error I didn’t notice. Also, I tried to log-in via the back-end details, but the URL is redirecting me to an empty page. Can you check that one as well? Thank you!
March 28, 2019 at 11:00 am #21861BorisWebdesign
ParticipantYou cannot access this content.
March 28, 2019 at 11:02 am #21862BorisWebdesign
ParticipantPlease note that the custom code we’ve talked about is in inc/functions-custom.php from line 213 onward.
March 28, 2019 at 3:11 pm #21872Ernest Marcinko
KeymasterYou cannot access this content.
March 28, 2019 at 3:15 pm #21873BorisWebdesign
ParticipantHi Ernest,
I’ve addded your IP. Let’s see how it goes. If it keeps changing, I’ll think of something else, but I don’t want to run the risk of Google indexing the site.March 28, 2019 at 4:26 pm #21879Ernest Marcinko
KeymasterHi,
That worked, thank you. There was a minor syntax error in the code, I have corrected that. Now I reindexed everything and tried a few phrases, and it seems to be returning results based on them.
I tried searching “[email protected]” and “+31712001220”, which are on the Contact page, and it was returned as a result now. I’m not sure if it indexes everything everywhere, but it should be much more in depth now.March 28, 2019 at 5:37 pm #21886BorisWebdesign
ParticipantHi,
may I ask how you do a search then? I don’t know what is going wrong, but when I do a search in the sidebar, it should display the results on the page content next to it. It keeps displaying 0 results now, even when searching for terms that are in the regular post content field.March 29, 2019 at 9:46 am #21890Ernest Marcinko
KeymasterHi,
You have an active date filter set, to restrict the results to a single day only: https://i.imgur.com/lGQsITn.png
Make sure to either disable that, or change the filter values accordingly, that will resolve the issue. I was testing on a temporary search instance, I didn’t notice that, sorry.March 29, 2019 at 10:18 am #21895BorisWebdesign
ParticipantAh, thanks! But how can I include the option of filtering by date in the search options without activating it by default?
March 29, 2019 at 11:32 am #21904Ernest Marcinko
KeymasterHi,
You can set date based exclusions under the Advanced Options -> Exclude/include results panel: https://i.imgur.com/9XWYoDv.png
-
AuthorPosts
- The topic ‘ACF content not indexed/searched’ is closed to new replies.