New Features
- Optional database-backed results beneath AI answers, loaded via AJAX with a “Loading database results...” state, synchronized pagination, and smooth scrolling.
- Block settings include a toggle and selector to enable/choose DB results; native Views results can be embedded alongside AI output.
In order to use the database results, create a view for a search index and add an exposed filter for a fulltext search. There is a new setting in the block configuration to add db search results.

The search terms entered in the AI Search Block get used for a full text search and the database results appear under the streamed response.

I also have another module that puts a search box in the header and uses those terms to perform the searches.
There were more javascript changes than I wanted, getting the pager to work in the database results without a page refresh was challenging.
Many AI tools did help with my changes. I'm using this adaptation on two sites and like it.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | Screenshot from 2025-12-01 16-04-45.png | 31.67 KB | jonas139 |
| db-results.png | 353.7 KB | keiserjb | |
| db-settings.png | 28.99 KB | keiserjb |
Issue fork ai_search_block-3544712
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
keiserjb commentedComment #3
keiserjb commentedComment #4
keiserjb commentedComment #6
keiserjb commentedSomething happened when I rebased and pushed my changes. It stopped working. I'm trying to get it sorted out.
Comment #7
keiserjb commentedIt should be working again but I've left console.log in the js for testing.
Comment #10
wouters_f commentedMerged into the dev branch 1.0.0
keiserjb will you please test if everything still works as expected in the dev branch?
Comment #11
jonas139 commentedI already have talked to keiserjb about this feature because this is something that I need in a project but I was wondering if the exposed filter is the correct way instead of contextual filters? I'm using a view with other exposed filters and they are now hidden because of the changes of this feature.
I did some local changes so it can also work with contextual filters but it's not 100% perfect already (if other contextual filters are used, it would still be a problem).
I would like to know what the vision is on that matter? Are we only going to use exposed filters and do I need to patch the JS file by only hiding the search field or are we also going to allow contextual filters (which would be the most user-friendly way in my opinion).
If needed I can already create an MR or sub-issue for the contextual filter changes.
For me it's still working in dev but I see there are some console.log messages left in the code.
Comment #12
wouters_f commentedThe console log's were there on purpose.
One client had JS issues, I will remove them later on (or make them optional).
I also intuitively expected it to be contextual filters actually. I asked him for extra docs.
Please use a different issue for the switching to contextual filters and add the code there.
This branch was merged so let's close this here.