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.

database settings

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.

database results

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.

Command icon 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

keiserjb created an issue. See original summary.

keiserjb’s picture

Issue summary: View changes
keiserjb’s picture

Issue summary: View changes
keiserjb’s picture

Issue summary: View changes

keiserjb’s picture

Something happened when I rebased and pushed my changes. It stopped working. I'm trying to get it sorted out.

keiserjb’s picture

It should be working again but I've left console.log in the js for testing.

keiserjb changed the visibility of the branch ai_search_block-3544712-3544712-add-option-to to hidden.

wouters_f made their first commit to this issue’s fork.

wouters_f’s picture

Status: Active » Reviewed & tested by the community

Merged into the dev branch 1.0.0
keiserjb will you please test if everything still works as expected in the dev branch?

jonas139’s picture

StatusFileSize
new31.67 KB

I 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.

Only local images are allowed.

wouters_f’s picture

Status: Reviewed & tested by the community » Fixed

The 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.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.