Skip to content

Make ML similarity contextual filter and facets work #459

@DiegoPino

Description

@DiegoPino

What?

Facts: we refresh the View on a passed encoded Image + Node + File and fetch a vector from the NLP. We alter the query, we get the similarity results. This all happens via Ajax. We refresh the View and we refresh the Facets. Because these are different HTTP requests the facets don't have the results object anymore available, so they re-query (I dislike this a lot, so inefficient ..) and call the View again.
The view, if not cached, will re-query, but the original Contextual filter is no longer present in the request (bc we are filtering/making sure the requests are only done via Ajax/not public, etc) so the facets run without the KNN filter and that means in fact we always get the same facets back. As if KNN would have never run

Options we have:

  • If Ajax enabled for the View we can "remember" in a session the Contextual filter parameters. ideally already the vector, so we do less backend processing. This is possible since All this ML tricks really can only run for logged in users.
  • Then on re-query we fetch the session. I can here check if the request was done via AJAX. so a "reload" of the page will never use the session. Good
  • We need to be sure we actually clear the session on RESET.

Metadata

Metadata

Assignees

Labels

Drupal ViewsAsk and you should receiveFacetsSafely navigating the too many choicesSearch APISearch and DiscoveryMess around and find outSub ModulesWhen you need more .info.yml files to keep life organizedenhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions