Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
The SearchApiPageController currently hard-codes the parse mode to "direct". In combination with search_api_solr this behaviour is not always desired: direct mode means no escaping of values leaving the possibility of user input causing errors in solr.
Proposed resolution
Let's make the parse-mode configurable per page.
User interface changes
A new select list is shown in the "page" fieldset, with options: direct, terms and phrase (the default search API options).
API changes
We leave the default to "direct" causing no backwards incompatible changes.
Comment | File | Size | Author |
---|---|---|---|
#18 | 3056363-18.patch | 7.17 KB | borisson_ |
|
Comments
Comment #2
jsst CreditAttribution: jsst commentedComment #3
legolasboThis needs an
@return string
Comment #4
marcoweijenborg CreditAttribution: marcoweijenborg at Ordina Digital Services commentedLast patch didn't apply anymore. I created a new patch and added the @return to the comment.
Comment #5
marcoweijenborg CreditAttribution: marcoweijenborg at Ordina Digital Services commentedComment #6
legolasboLooks good to me.
Comment #7
borisson_I was just about to commit this. We did not add a test for this yet. I'd like to have a test that checks that this behavior works, it does not need to be covering everything, as this is tested really well in Search API proper, but at the very least we should test that the admin form works as expected.
Comment #8
marcoweijenborg CreditAttribution: marcoweijenborg at Ordina Digital Services commentedAttached is a patch which adds the test for the admin form.
Comment #9
marcoweijenborg CreditAttribution: marcoweijenborg at Ordina Digital Services commentedComment #10
borisson_Yup! That looks great.
Comment #11
borisson_We should not do this like that, we should get the
Parse mode plugin manager (
plugin.manager.search_api.parse_mode
) and list all the plugins here. That way we can use the correct labels for all of them + we don't have to adapt when a new or custom one is added.See \Drupal\search_api\Plugin\views\filter\SearchApiFulltext::buildOptionsForm for inspiration.
The documentation here should be updated to reflect that as well, and we should add @return string + docs.
Comment #12
marcoweijenborg CreditAttribution: marcoweijenborg at Ordina Digital Services commentedI totally agree with you. I created a new patch for this.
Comment #13
marcoweijenborg CreditAttribution: marcoweijenborg at Ordina Digital Services commentedComment #15
borisson_pageTextContains looks at the visible html, so we either use responseContains that looks are raw html OR use the label here as well.
The update also introduced some coding standards issues, those should be fixed as well.
Comment #16
marcoweijenborg CreditAttribution: marcoweijenborg at Ordina Digital Services commentedThanks for your help :) I addressed the issues in the next patch.
Comment #17
marcoweijenborg CreditAttribution: marcoweijenborg at Ordina Digital Services commentedComment #18
borisson_This conflicted with #3013111: Allow selecting view mode per entity on edit form.. Reroll attached.
Comment #19
borisson_