- This topic has 6 replies, 2 voices, and was last updated 7 years, 8 months ago by GuyWilson.
-
AuthorPosts
-
January 12, 2017 at 9:15 am #11585GuyWilsonParticipant
Hi,
I write my WordPress posts and pages as Google Docs, publish the Doc and then embed the doc in the WordPress page or post like this:
<iframe src=”https://docs.google.com/document/d/11w3J8-H8Oeib015-PcsQb_gfaRgU2cxvFKpDFJpA8iI/pub?embedded=true” height=”600″ width=”1200″></iframe>My question: Is there setting that will allow the content of the embedded document to be searched?
Your help would be greatly appreciated.
Thanks
GuyJanuary 12, 2017 at 3:26 pm #11591Ernest MarcinkoKeymasterHi Guy,
Well the short answer is no, the long answer is maybe. You will have to use the index table engine in order to try the solution below. You can read more about it here: https://goo.gl/ooNYPY
Once you got that, follow these steps:
1. We need to change 1 of the core plugin files, but this is going to be included in the upcoming version, so no worries about it. Open up the wp-content\plugins\ajax-search-pro\includes\classes\etc\indextable.class.php file on your server and scroll to line 412, which is this:
[php]$content = $the_post->post_content;[/php]
and replace it with this one:
[php]$content = apply_filters( ‘asp_post_content_before_tokenize_clear’, $the_post->post_content, $the_post );[/php]
This will allow us to temper with the post content before the tokenization process.
2. Put this into the functions.php file in the active theme directory:
3. Re-create the index table.
That’s it. On my test environment this is working, so let’s hope it works for you too.
January 13, 2017 at 10:22 am #11592GuyWilsonParticipantHi Ernest,
Thanks so much for your fast response and the effort you put in to help resolve this for me.
I tried it and it works!
The only small problem I had to overcome was as follows:
Line 11 of the code you suggested to put into functions.php is:
preg_match(‘/iframe src=[\'”]([^”\’]+)[“\’]/’, $str, $match);
The small problem here is that some of my posts had valid code between ‘iframe’ and ‘src’
For example: iframe height=”600” src=
Posts with this format were not being indexed so I changed them all to have nothing between iframe and src.
Could line 11 be somehow changed to cater for this?
(Maybe all it needs to recognise is “src=”?)Anyway, thanks again.
Cheers
GuyJanuary 13, 2017 at 10:32 am #11593Ernest MarcinkoKeymasterHi,
Yes, I believe so. Try changing that to:
This regular expression will allow any count of characters between the iframe opening and src tags. I’ve made the change on the original as well, in case the copy/paste quotes are not correct here.
January 13, 2017 at 12:03 pm #11594GuyWilsonParticipantThanks Ernest – I checked and it seems to now be work perfectly.
Also if you have a moment, could you please help me with this:
Front End Search Setting options
– Advanced
— Category/Taxonomy terms logicThe options are:
(1) At least one selected terms should match
(2) All of the selected terms should matchI did a test with these 2 categories:
Videos
BooksWhen I selected option (1), it behaved as I expected – the results list expanded when I ticked videos and expanded more when I selected books
However when I selected option (2) all results from all categories appeared. And it made no difference when I selected Videos and Books
What I expected is that nothing would be displayed as the content would not be both a video and a bookThoughts?
Thanks
GuyJanuary 13, 2017 at 12:17 pm #11595Ernest MarcinkoKeymasterHi!
I’m glad the frame parser works. I might add it as a feature to the upcoming version.
——
The problem is, that the logic does not work as you described. If a post is neither categorized as Video or Book, it will still be displayed, it does not restric only to the visible categories.If you want to restrict the results excplicitly to items from only the Videos and Books category, then on the Advanced Options -> Exclude results panel scroll to the:
Include posts (or cpt, attachments, comments) only from selected categories/taxonomy terms
..option, and select those two categories only.
This way the final sub-set of results is fully restricted to these two categories, and nothing else.
January 14, 2017 at 6:23 am #11596GuyWilsonParticipantThanks Ernest,
appreciate your helpCheers
Guy -
AuthorPosts
- You must be logged in to reply to this topic.