Drupal AI Search on Opensolr

Your Opensolr Index as the search of the Drupal AI module

Drupal AI Search

Opensolr Search makes your Opensolr Index the search of the Drupal AI module. Drupal AI Search reads the very same content Data Ingestion or the Data Crawler already sent, so nothing is indexed twice, and every result shows its title, a highlighted snippet and the pages of its PDFs that match.

Your Drupal site sends its content once to your Opensolr Index; Drupal AI Search and the Opensolr search page both search it. Your Drupal site Pages and products Attached PDFs Every language sent once Your Opensolr Index Keywords and meaning Every page of every PDF Written once Drupal AI Search A View at /ai-search PDF pages per result Search page /opensolr-search Optional: on or off Your Drupal site sends its content once to your Opensolr Index; Drupal AI Search and the Opensolr search page both search it. Your Drupal site Pages, products, PDFs Every language sent once Your Opensolr Index Keywords and meaning Every page of every PDF Written once read by both Drupal AI Search A View at /ai-search PDF pages per result Search page /opensolr-search Optional: on or off
One Opensolr Index, written once by Data Ingestion or the Data Crawler. Drupal AI Search and the Opensolr search page both read it.

See it live on our demo site (it asks for a one-time human check on your first visit):

  • clamp meter 771: an article with the four matching pages of its PDF under it
  • Stromzange: the same in German, from a German PDF
  • サーマルカメラ: thermal cameras, in Japanese
  • The admin side: log in as demo with password opensolr-demo. Every setting is there to look at; nothing you change is saved.

What your visitors get

Words and meaning together

The exact words people type and what they mean count in one ranking, in every language your site speaks. The same search engine as your Opensolr search page.

The right page of the PDF

When a PDF attached to a page matches, the result lists the pages that match, each with its own snippet, and each link opens the PDF at that page.

Highlighted matches

The words that matched are highlighted in the title and in the snippet, so visitors see at a glance why a result is there.

One result per page

A page and its attached documents come back as one result, never as duplicates, and showing it loads no content from your database.

Set it up

  1. Add the AI module. Run composer require drupal/ai.
  2. Enable Opensolr AI Search. It comes with Opensolr Search: enable it on the Extend page, or run drush en opensolr_search_ai.
  3. Send your content. Use the Data Ingestion or the Data Crawler tab, as usual. If your index already held content from an earlier version of the module, press Reset Index first, then ingest or crawl again.
  4. Click Set up AI Search. In Configuration → Search and metadata → Opensolr Search, open the AI Search tab. It shows your index and how many of your pages it can search; one click does the rest.
  5. Search. Your AI search page is ready at /ai-search.

Your AI search page is a View

The setup creates the view AI Search, with its page at /ai-search. Change it like any other view: the path, the number of results per page, the fields and their order. Everything a result shows comes straight from Opensolr:

  • Opensolr title and Opensolr URL: the title of the result and its link
  • Excerpt: the highlighted snippet
  • Opensolr matching pages: the pages of its PDFs that match, each linked to its page

On a multilingual site, visitors see the results in the language they are browsing in. Running the setup again later keeps the changes you made to the view.

Keep one search page, or both

Your Opensolr search page at /opensolr-search keeps working next to Drupal AI Search. To keep only Drupal AI Search, untick Search page at the top of the Search Page tab: the page, its search box block and the redirect of the Drupal search forms all go away.

What it needs

  • Opensolr Search 5.2.0 or newer, with the Drupal AI module
  • An Opensolr Index with vector search, on a plan with AI features (the module creates a vector index by default; see AI Features)
  • Your content sent with Data Ingestion or the Data Crawler: Drupal AI Search shows what an anonymous visitor may see, and only that
Your content stays in sync

Unpublish or delete a page and it leaves the results right away. With real-time sync in Data Ingestion, a page you save is searchable again in moments, and a PDF you attach to it or take off it follows it the same way.