Fulltext search facet

Created on 8 November 2021, over 3 years ago
Updated 16 January 2023, over 2 years ago

Problem/Motivation

The motivation is that often requirements are for fulltext search boxes to be part of the same form as the other facets.
Without this proposed development it's extremely hard to implement.
So, for this module to be adopted and truly useful we need to provide this text filter as facet.

Proposed resolution

  • create a new query type
  • create a facet widget

Remaining tasks

  • create a new query type
  • create a facet widget
Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇷🇴Romania andras_szilagyi

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Needs review about 2 years ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update almost 2 years ago
    21 pass
  • Status changed to RTBC 11 months ago
  • 🇬🇷Greece vensires

    It's been a year I am using the patch in various projects so - now that we have a stable release - it's time I set it as RTBC.

  • 🇫🇷France Julien Tekrane

    Dear @vensires, thank you for your appreciation but my PR does not contain tests so the maintainers will not merge it. I don't have dedicated time to implement it, I leave the floor to whoever wants it

  • 🇬🇷Greece vensires

    Thank you for your effort nevertheless!
    I will keep it as RTBC until the maintainers decide otherwise. For now, I just add the tag "Needs tests".

  • 🇧🇷Brazil carolpettirossi Campinas - SP

    I'm using the MR code along with an Aggregate Fulltext field successfully
    Thank you so much for contributing =D

  • 🇬🇷Greece vensires

    For a website of ours, I use this fulltext facet filter to search for keywords. The client asked that whether user searches for "foo bar" or "bar foo" the returned result should be the same. I tried playing around tampering the query using proper Search API Events but instead fell back on changing the original patch from this issue's MR (attached) so that the 'LIKE' operator uses multiple conditions instead using AND.

    I'm sharing this here too in case we would like a different approach for this or propose a different operator... Maybe...

    if ($operator === 'LIKE') {
      $or_condition_group = $this->query->createConditionGroup('AND');
      $tokens = preg_split('/\s+/', trim($this->fulltext->getSearch()), -1, PREG_SPLIT_NO_EMPTY);
      foreach ($tokens as $token) {
        $or_condition_group->addCondition($this->facet->getFieldIdentifier(), $token);
       }
       $this->query->addConditionGroup($or_condition_group);
    }
    
Production build 0.71.5 2024