Google Vision api is an advanced AI that can identify a lot things in images. It can detect faces and read text in images. It can even recognise celebrities. Google Vision can also group images in different categories. Combined with WPSolr, This can significantly improve search performance on your website as now both text and images are used by WPSolr.
To get started with Google Vision API you have to first connect to the Google Cloud Dashboard.
Search for “api dashboard” and select “Dashboard (APIs & Services)”.
Then click on “Enable APIs and Services”.
Search for “vision” in the new window, then select “Cloud Vision API”.
Click on “Enable”.
Then select “Credentials”.
Click on “Create Credentials” then choose “Service account”.
Fill in the Service account information.
You can select a role for your service account but if you’re not sure what you want exactly just leave the default settings.
You can just click on “Done” here as well.
Edit the Service account.
Click on “Add key” then select the JSON Key type.
The key is then saved on your computer.
You can open the key in your favourite source code editor or IDE.
Create an index
activate the WPSOLR plugin then enter the licence. You can now create an index.
Go to “Connect your indexes” and choose your preferred option. I am going to create a test index.
Then create a free test index.
To activate the extension go in “Activate extensions”.
select “Text, Image, Video AI”.
Click on “Activate the AI extension” checkbox and choose Save Options.
Click on “Add an AI” step from the above image.
Then fill in the relevant information. Be sure to click on “this ai_api will pre-process indexed documents”. You can check the options you want below JSON key like extracting text from images for example. if you have problems with your search later on you may need to to change the confidence level. Typing 0(zero) may solve these issues.
Click on “Define your search with ‘your_index_name'”, and click on The “Search” checkbox.
Click on “Data” in the sidebar and select the data which you want to index.
Select the types of content you want to index. Google Vision only accepts jpeg, jpg, png, gif, bmp, webp, raw, ico, pdf and tiff images.
select the fields that you prefer. You can leave default fields if you don’t know what to choose.
Select the fields you would want to use as filters.
Send Data to index
Click on “Index selected post types in index ‘Test index from Elastic Cloud'”.