Adding advanced search to the document library
Document Library Pro comes with an instant AJAX search box which appears above the list of documents, as well as a standalone search box. You can add more advanced logic to either or both searches by using it with the SearchWP plugin.
We have integrated Document Library Pro with SearchWP so that the two plugins will work perfectly together with no special configuration. This allows you to use all of SearchWP's powerful search functionality, including:
- Choose which data is searchable, including data that isn't usually indexed such as attributes and custom fields, and the content of supported file types.
- Control how search results are ordered and prioritized.
- Analytics and reporting on how people are using the search.
Note: Since we built this integration, SearchWP have released a free version which is very different from their premium plugin. Document Library Pro only integrates with the premium version.
Limitations
Add the present time, the integration is supported using the default SearchWP plugin, i.e. without any customisations. Customisations to SearchWP are not supported in Document Library Pro.
The current known limitations are:
- Strict search (or exact phrase match search) is not supported. This is enabled in SearchWP using the filter
searchwp\query\logic\phrase\strict
Search box above the document library
This is how to use SearchWP to power the search box that appears above the list of documents in the document library:
- Install Document Library Pro. Enable the lazy load option if you are displaying your document libraries in a table layout.
- Install SearchWP and make sure you have added the 'Documents'
dlp_document
post type as a Source on the default SearchWP engine. - Follow these instructions if you would like to index the content of your file downloads (e.g. PDFs) with SearchWP.
Standalone search
You can also use SearchWP to power the standalone search that is built into Document Library Pro.
This is how to do it:
- Install Document Library Pro. Enable the lazy load option if you are displaying your document libraries in a table layout.
- Install SearchWP and make sure you have added the 'Documents'
dlp_document
post type as a Source on the default SearchWP engine. - Finally, add the 'Document Library Pro: Search Box' widget or
[doc_search]
shortcode anywhere on your site, e.g. the homepage or a sidebar.
Once you have done this, customers can use the search box (which will be powered by SearchWP) wherever it appears on your site. The results will appear within a document library.
Indexing downloadable file content with SearchWP
SearchWP supports indexing the content of certain file types, for example PDFs or Office documents.
In order to allow SearchWP to index downloadable files that you have added, you can perform the following steps:
- Go to the SearchWP Engine settings and click 'Add/Remove Attributes' on the Documents source.
- In the Custom Fields dropdown, select the 'Document Library Pro: Document Downloads' option.
- Click 'Done' and rebuild your SearchWP index.
Please note that SearchWP tries its best to index the content of PDFs and other text documents, however successful parsing is not guaranteed and depends on the structure of the files.