SearchWP and XPDF support

Introduction

SearchWP is a nice WordPress plugin which allows to extend WordPress search capabilities to various content format beyond just page text.
Here I am focusing on PDF indexing specifically. If you have any PDF files published and want them be indexed SearchWP-XPDF extension can be deployed.

Issue

Problem is that SearchWP developers decided to rely on deployment of direct code from FooLabs.  If it is not deployed as a drop-in, functionality would be disabled.
Drop-in option is not always possible and in fact unnecessary for this plugin to function.

In distros like CentOS  PHP XPDF support is available out of the box and can be enabled by installing poppler_utils.

Solution

    • Install SearchWP Xpdf extension as you would normally do
    • In WP Dashboard warning would appear – “SearchWP Xpdf Integration requires you to download and install Xpdf…”
    • SSH to your server
    • Install poppler_utils using yum# yum install poppler_utils
    • Refresh your WP Dashboard page. Warning would not go away because code specifically looking for physical location instead of verifying XPDF support by OS
    • Now we do some hacking:
      • in your WP installation, navigate to /plugins/searchwp-xpdf/ and open searchwp-xpdf.php for edit
      • Look for “// see if Xpdf exists”
      • Comment out what follows
        /*
        // see if Xpdf exists
        if ( $continue && file_exists( $this->xpdfPath ) ) {
        echo 'Xpdf (pdftotext) was found, continuing<br />';
        } elseif ( $continue ) {
        echo 'Xpdf (pdftotext) was not found, aborting<br />';
        $continue = false;
        }
        */
        
      • Next look for function admin_notice()
      • Comment out content of the function to suppress Admin notice
        function admin_notice() {
        /*
        ...
        <?php }
        */
        }
        
    • Refresh WP Dashboard
    • Warning would now go away
    • Run indexing, PDF files should now be indexed properly

Footnote

I did actually reach out to SearchWP team back in May 2017 and solution was acknowledged, but almost year later plugin still relies on custom drop-ins.

Enjoy.

This entry was posted in CentOS Maintenance, Scratch Pad and tagged , , , , . Bookmark the permalink.

Leave a Reply

  • About

    From being a junior developer all the way to Development Manager position, I was always interested in new technologies. Passionate speaker, IT junky, developer, architect, team lead, and development manager - many hats, one goal - making software better and closer to people’s needs. For the most part I am using my blog as a scratch pad, writing small articles on things which I came across, was asked about more then once, and which would otherwise require additional research again and again.

    View Serguei Dosyukov's profile on LinkedIn
  • Testimonials

    I’m a huge fan of this theme. I’ve got more than 90,000 pictures in my gallery3 running on a Ubuntu...

    Jklobo

    I've been using this [theme] since the start. It is by far the most attractive, feature packed and stable of...

    Rhyull

    The greydragon theme is fantastic. It’s clean, stable and feature rich. It took me a while to decide to move...

    Ed

    more...

  • Categories