I want to create a search API view that can search Content and Files based on keywords. I can search content fine but I am having difficulty making it search filenames. This is a Drupal 8 site.

I am using the built-in Database.

I have created a Database and an Index. That index includes the filename and mime type. Both are set as type "FullText". The index has been updated.

I have created a stripped back view using that index that just shows filenames and exposes a filter that searches only the filename fulltext and filters out anything that isn't a PDF. If I search without parameters I see all the pdfs so the index can see them, however when I try to filter on any actual filename it fails to find even exact matches.

For example; I have a pdf called: 'Debts.pdf'. Even with stemming, tokenization and capitalisation removal no variation of the word "Debt" returns any result.

If I search the full name of the filename as a filter "Debts.pdf" as it's own filter that works, but not the FULLTEXT search of the filename.

Is there some other step that is needed to search filenames with Search API? I was trying to avoid installing other software to be able to look inside the files themselves and only search the filenames. I had assumed that would be easier...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.