The Search API Attachments module indexes the content of attached files (.txt, .pdf, etc.) using Solr. In this video, I will show you how to configure the Search API Attachment module to do that.

Install module

Enable module

  • Go to "Modules" (admin/modules) and enable:
    • Search API attachments
  • (Save Configuration)

Configure Search API Attachments

  • Go to "Configuration => Search and metadata => Search API => Search API attachments"
    • Extraction method: Solr
  • (Save configuration)

Now, we need to add the attachment field to the list of fields to index.

  • Go to "Configuration = > Search and Metadata => Search API (/admin/config/search/search_api)
  • Node index
    • Click the dropdown arrow
    • Choose "Fields"
    • Add related fields
      • File attachments
    • (Add fields)
    • [x] Attachment ยป The file
  • (Save changes)

Enabled data alterations

  • Click "Filters"
  • Data alterations
    • [x] File attachments (This will access the content of attached files and index it.)
  • (Save configurations)

Index node

  • Click "View" tab
  • (Index now)

In video 10, I attached a text file to Item #1 that simply contains the text "Monday to Friday 8:00 am to 5:00 pm". Let's go home and search for the keyword "Monday" and click the "Search" button. As expected, it returns "Item #1" in the results. The word "Monday" isn't anywhere in any of the text fields, it's just in the file. So, this just shows that files can be indexed and searched.