Closed (fixed)
Project:
Search API
Version:
8.x-1.x-dev
Component:
General code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
22 Feb 2017 at 00:48 UTC
Updated:
29 Nov 2022 at 14:41 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
drunken monkeyNo, there isn't. Since Search API supports a wide range of backends, it's not possible to require all of them to support the
LIKEoperator.This could be added as an optional feature for backends, though, maybe in a contrib module.
Otherwise, if you just need it for your own site, you'll have to use custom code to rewrite the database or Solr query of your search accordingly.
Comment #3
jmlavarenne commentedThanks for the quick reply. If you have the time, can you describe in quick terms, a sentence or two, of how to do that? Like implement this or that hook, implement a subscriber or listener that replaces this or that class, implements this or that interface. Or even a word or two about what terms to look for in the handbook would be amazing :)
Comment #4
drunken monkeyHow to do what? I provided two options in my reply.
For the custom solution, you can use
hook_search_api_db_query_alter()orhook_search_api_solr_query_alter(), depending on the backend (DB or Solr – others might have their own alter hooks).Comment #6
dmezquiaHi @drunken monkey @Jupiter, any update on this issue?, in the current version of the module is it possible to use LIKE easily.?
Comment #7
sgourebi commentedI made a patch for database server.
I hope it will help someone.
You just have to use like this:
$query->addCondition('property_name', 'value', 'LIKE');