Flowpack.ElasticSearch.ContentRepositoryAdaptor icon indicating copy to clipboard operation
Flowpack.ElasticSearch.ContentRepositoryAdaptor copied to clipboard

BUGFIX: ElasticSearchQueryBuilder removes json encode generated quotes

Open gjwnc opened this issue 1 year ago • 1 comments

By default the ES CR Adaptor uses query_string which allows some search syntax in query string.

In the current implementation, json_encode is used on the query string which adds double quotes around the search term, e.g. brown fox is json encoded to "brown fox". Then trim is used to remove the ".

Since one can use double quotes in the search term itself, e.g. quick "brown fox" this results in json encoded "quick \"brown fox\"". If you use trim you get invalid json which causes an exception because of invalid syntax in the ES query: quick \"brown fox\.

This PR, just removes the outer quotes created by json_encode.

gjwnc avatar Dec 06 '22 08:12 gjwnc