Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Search in content file
This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko 3 years, 4 months ago.
- AuthorPosts
- January 27, 2020 at 9:07 pm #25521
Hello,
Even following all the steps to index the contents of PDF files, I can’t get it to work.
My index brought the file but not when I search for the content.
January 28, 2020 at 10:54 am #25531Hi!
May I ask, which search instance (name or ID) is used for searching attachments? Make sure that the search in attachments is enabled, and the index table engine is selected for searching: https://i.imgur.com/SCzV6Bd.png
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
January 28, 2020 at 12:13 pm #25533Hello,
even with this configuration still does not seek.
Attachments:
You must be logged in to view attached files.January 28, 2020 at 4:26 pm #25536Hi,
Okay, I have checked the index table, and try to debug the extracted contents. There seems to be something wrong with either the PDF encryption, or the parser I am not sure. I tried multiple scripts to get the contents but none of them worked, so it might be some sort of a PDF encoding issue.
Anyways, I noticed that most of text is present, but there are duouble spaces here and there between the words, and some random characters.
There might be a way to bypass that via a custom code, but I am not sure. Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
add_filter("asp_indexing_string_pre_process", "asp_fix_indexing_string_pre_process", 10, 1); function asp_fix_indexing_string_pre_process($s) { if ( substr_count($s, " ") > 10 ) { $s = str_replace(' ', '||||', $s); $s = str_replace(' ', '', $s); $s = str_replace('||||', ' ', $s); } return $s; }
Once the code is added, please try to re-create the index table. There is a small chance, that some comlete words will be indexed from the PDF files.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.