How to search embedded published google doc

Home Forums Product Support Forums Ajax Search Pro for WordPress Support How to search embedded published google doc

This topic contains 6 replies, has 2 voices, and was last updated by GuyWilson GuyWilson 5 years, 5 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #11585
    GuyWilson
    GuyWilson
    Participant

    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
    Guy

    #11591
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi 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:

    $content = $the_post->post_content;

    and replace it with this one:

    $content = apply_filters( 'asp_post_content_before_tokenize_clear', $the_post->post_content, $the_post );

    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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #11592
    GuyWilson
    GuyWilson
    Participant

    Hi 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
    Guy

    #11593
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #11594
    GuyWilson
    GuyWilson
    Participant

    Thanks 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 logic

    The options are:
    (1) At least one selected terms should match
    (2) All of the selected terms should match

    I did a test with these 2 categories:

    Videos
    Books

    When 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 book

    Thoughts?

    Thanks
    Guy

    #11595
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #11596
    GuyWilson
    GuyWilson
    Participant

    Thanks Ernest,
    appreciate your help

    Cheers
    Guy

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.