Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › WPML, all languages in search results
This topic contains 4 replies, has 2 voices, and was last updated by silvanschaad 6 years, 10 months ago.
- AuthorPosts
- October 11, 2017 at 3:54 pm #15121
Hi there
I bought Ajax Search Pro to replace the search on a client’s project. Now I started testing locally and found an issues with wpml where I’d like your expertise:
At the moment a search shows the results in both languages (english and german). Ideally you have only the results in the language you’ve chosen. Is there a configuration I can do or how can I avoid that mistake?
Thanks for your feedback and best regards
Silvan
October 12, 2017 at 8:45 am #15127Hi Silvan,
By default the search should only display the results in the currently active language on the front-end. I have double checked if there is any issue there, but it works fine on my local (and online) test environments. I couldn’t find any similar tickets from the past couple of weeks, so this might be something new.
There are a few things you should check:
– That if the WPML compatibility is indeed enabled: https://i.imgur.com/clmyEgR.png
– If the custom ajax handler is enabled, try disabling it: https://i.imgur.com/csmcteT.pngIf those are okay, but no change, then one other thing you could try is to switch to the index table engine. It explicitly stores the language code along with the keywords, so it might do the trick.
Unfortunately I’m not sure I’m able to tell what exactly the problem might be, unless I can test it somehow. If none of these suggestions work, and you can arrange some sort of online test environment that I can access, please let me know.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 24, 2017 at 10:32 am #15272Hi Ernest
I put your search now on the live site: http://donativini.ch/shop/
It works, but
* I haven’t enabled the second language so far and
* I did local tests before and the only setting working was when I use the regular engine as search engine. If I use the indext table engine, I get all results from both languages displayed… Any experiences with that?I’m really curious what happens when we activate the second language…
Best
SilvanOctober 24, 2017 at 4:29 pm #15275Hi!
May I ask, are you using a WordPress multisite setup by any chance?
Usually the regular engine is the one that used to have issues, as with the index table the language code is requested from WPML tables during the indexing process.
I have looked at the index table source, where the language code is parsed, and there is actually something that might explain this issue. There is an existence check for a certain WPML function, whihc appears to be removed (I’m not sure).
Can you please try the following:
1. Open up the wp-content\plugins\ajax-search-pro\includes\classes\etc\indextable.class.php file
2. Scroll to lines 723, which should be this:if ( function_exists( 'wpml_get_language_information' ) && class_exists('SitePress') )
3. Change that line to:
if ( class_exists('SitePress') )
4. Save the file.
5. Re-create the index table. Just click on the Create new index button, and it will delete the existing one.It the problem was the missing function check, then there is a chance that this might resolve the problem. Please let me know, and I will incorporate this change to the latest release.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 31, 2017 at 7:33 am #15352Hi Ernest
Thanks for your reply and sorry for my late reply. I had to jump in to different projects…
I’ll try your suggested changes this week.
Best
Silvan
- AuthorPosts
You must be logged in to reply to this topic.