Active
Project:
Search API
Version:
8.x-1.x-dev
Component:
Plugins
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
20 Aug 2021 at 01:36 UTC
Updated:
24 Oct 2022 at 17:21 UTC
Jump to comment: Most recent
Comments
Comment #3
amjad1233Comment #7
drunken monkeyThanks a lot for suggesting this feature and creating a first draft! Great work so far.
I went through the changes and fixed a few things, but (apart from the failing tests) I still have a few concerns:
ORsub-query. So, for instance,IT jobwould (conceptually – it would of course need to be an array) become(IT OR "information technology") job. This is, fortunately, easily possible with the Search API keys structure – you can just replace'IT'with['#conjunction' => 'OR', 'IT', 'information technology']. (See\Drupal\search_api\ParseMode\ParseModeInterface::parseInput()for the syntax of parsed key arrays.@todocomments to the code accordingly.Also, please note that due to #3190024: Problem with test dependencies when testing issue forks the test bot will fail for the issue fork, so we’ll need to upload a patch instead once we consider this ready to go. (I’m therefore setting this back to “Active”, so the test bot will not attempt to test for every new commit we push.)
Comment #8
amjad1233Hi @drunken monkey Thanks for your detailed feedback.
I like the suggestion #3 you mentioned in your comment. @larowlan suggested similar sort of logic as well.
I deliberately chose IT as an example to demonstrate it's conflict with stopwords. I understand the limitations but in a way I was imagining the plugin to match exact case and expand it to the receiving query and therefore IT, "I.T." and "it" would all be different pieces. Like input was imagining was mostly being capital letters as they are abbreviations for example https://en.wikipedia.org/wiki/List_of_computing_and_IT_abbreviations
I understand doing a "redirect" approach is not the best one, I will try my best to refactor the code to do as you mentioned in #3.
Comment #10
mstrelan commentedA lot of the logic that was in
preprocessSearchQueryis actually handled by the parent\Drupal\search_api\Processor\FieldsProcessorPluginBase::preprocessSearchQueryand instead we can just implement theprocessmethod.I noticed however that we are doing a case-insensitive
preg_replacebut the unit test was not expectingitto be replaced byInformation Techonology. In this case I've updated the test expectation.Comment #11
damienmckenna