What is the Embed Any Document add-on
The Embed Any Document add-on allows you to use WPSOLR search to look for words contained in the pdf uploaded with the plugin. This can allow you to add additional details to your products and search them.
Install the Embed Any Document plugin
On the admin area of you website click on “Plugins” > “Add New”.
Type in “Embed Any Document” to search for the plugin.
Adding a PDF in a product
Click on “Products” in the sidebar.
Edit a product.
Then click on “Add Document” and add your pdf.
Then click on an option. I’m going to select Upload Document.
Drag the file on the page.
You should see this window. Select the width and height. You choose to show a download link and select the viewer. I chose the browser based viewer. When you’re done click on insert.
You should see the shortcode appear on the page. When you’re done save.
Head on to the front part of your website and click on the product we just created.
As you can see the pdf is displayed correctly.
Create a WPSOLR index
Click on “WPSOLR PRO” in the sidebar in the WordPress admin.
Click on “Connect you indexes” in the menu bar
Then click on “Connect to your search server or search service”.
Then fill in the fields. Choose a search engine and the hosting service it will use. Then choose a language and pick a WPSOLR index name. Fill in the endpoint url you got from your hosting service. Leave the default number of shards and replicas if you’re unsure how many to use. Then fill in the user and the password you got from the hosting service. Then save.
Next click on “Activate extensions” in the menu bar.
Click on “Embed Any Document” in the sidebar.
Then click on the first checkbox to activate the plugin. Click on the second checkbox to index pdfs imbedded in posts.
Then click on “Theme” in the sidebar.
Then click on the first checkbox to activate the extension. This will grant you additional customization options when adding search filters. When you’re done save.
Click on “Define your search” in the sidebar.
Click on “Search” then choose the search engine index we created earlier.
Then click on “Data” in the sidebar.
Then select the data to search in. I selected the “Products” checkbox and then I chose which taxonomies to use.
Then select the fields you want to use.
You can also change the type of the field. Here I chose the floating point number type for the price field and the integer number for the stock field. Since I am going to be using these fields as sliders, the text field will not work so I have to choose a number field.
Click on “Filter” in the sidebar.
Then select the fields we chose before. These will be used as search filters. Then save.
Stay on the page and fill in the sections for the different fields. Choose a label for the price field and a layout. I chose the range slider layout in this picture, but you will only be able to choose it if you have activated the “Theme” add-on from the earlier section.
Scroll down and repeat what you did before. Here I chose the label stock.
Then fill in the label for the stock status field. I decided to use the default layout this time so it will be a bit different.
Then scroll down and click on the “Override each item label” button. This will allow you to change the label next to the checkbox. In my case I changed it to available. Then save.
After you saved, you’ll be able to change the skin of the range slider. Here I chose to use the “Nice” skin.
Do the same field for the stock field as well.
Then click on “Send your data” in the menu bar to index the content.
Then click on “Index selected post types in index” to index content.
Add the WPSOLR facet widget
Click on Customize at the top of the website on the frontside.
Then click on “Widgets” in the sidebar that appears.
Then click on “Sidebar”.
And click on “Add a widget”.
Then type in “WPSOLR” and select “WPSOLR Facets”. When you’re done publish your changes
Test website search
Next test website search. As you can see the filters are displayed correctly and working well.
Here I searched for the title of the pdf before I added it. This yielded no results.
After adding it, I land on the correct product.