ext-solr
ext-solr copied to clipboard
FlexForm filter values are force quoted
Version: 8.1.2
When trying to add more complex filter rules to the FlexForm filter section, all values are quoted which prevents them to work.
Examples:
Works:
Does not work:
Reason: https://github.com/TYPO3-Solr/ext-solr/blob/8.1.2/Classes/System/Service/ConfigurationService.php#L135
Maybe the quotes should not be applied at all and the user should just be aware of that. If using a phrase that contains spaces, the user could apply quotes himself
I can confirm this behaviour, it breaks the autosuggest functionality in my project sind the value of filter gets quoted and breaks the request.
also found that this was intentionally implemented, see https://github.com/TYPO3-Solr/ext-solr/issues/1742
i think this fix broke the functionality more than it helped.
@markuskobligk if you want to fix this, just XCLASS the class mentioned in my issue description and remove the quoting. That's how i solved this problem for now
I would propose to add functional tests for this AND for #1742 instead of just removing it.
@timohund whats the plan of combining both? i'd be willing to send you a pull request to resolve this issue but i can't think of an implementation which does automatic quoting and allows to enter more complex filter rules that should not be quoted.
@timohund @dkd-kaehm I think the best way would be to remove the force quoting entirely and update the documentation accordingly that string values with spaces have to be quoted. This would add the most flexibility, and users can completely rely on the lucene query parser syntax when inserting custom filters. https://lucene.apache.org/core/3_0_3/queryparsersyntax.html
I make a PR: https://github.com/TYPO3-Solr/ext-solr/pull/3703
I add a regex to prevent a too big breaking change. The old behaviour is still working, so if a string value contains space(s) and no special characters of the solr query parser, the string is always wrapped with double quotes.
But if the string contains special characters no wrapping happen.
There is some cases where this PR can break, for example if the filter value is something like toto AND tata
or music (rock)
or my "flow" is
. Here the wrapping and the escaping of the inner double quote have to be manually updated like this "toto AND tata"
, "music (rock)"
and "my \"flow\" is"
. But I think this is not usual use case, so the breaking is as little than possible.