Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove "<" and ">" as they cannot be escaped #1415

Merged
merged 4 commits into from
Nov 30, 2017

Conversation

martin-georgiev
Copy link
Contributor

@martin-georgiev martin-georgiev commented Nov 21, 2017

< and > cannot be escaped according to the documentation, that's why try to remove them.

@ruflin
Copy link
Owner

ruflin commented Nov 22, 2017

Thanks for the PR. I wonder if it had any side effects that we tried to escape it? All tests are still green ...

Could you update the changelog?

@martin-georgiev
Copy link
Contributor Author

Changelog updated.

As < and > were first reported to be inescapable in v5.1 documentation, it made sense before that point in time to escape them. I can only blindly speculate that this somehow relates to the fact that < and > are Elastic specific and as such they are not inherited from Lucene's special character list.

// @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters
$nonEscapableChars = ['<', '>'];

foreach ($nonEscapableChars as $char) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should update line

* escapes the following terms: + - && || ! ( ) { } [ ] ^ " ~ * ? : \.
in some way? Interestingly it already doesn't list < and >.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would drop the list of characters in the description of replaceBooleanWordsAndEscapeTerm. My reasoning is that it exposes the internal behaviour of the used submethods. The character list creates maintenance backlog as it is not something that the wrapper method replaceBooleanWordsAndEscapeTerm has control over at present.
Yet if you believe it adds value then it needs updating too. Are you looking at any particular wording?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on removing it. I'm good with most wordings :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method description is updated. I believe we can move this PR forward now.

@ruflin ruflin merged commit 9bc2eaf into ruflin:master Nov 30, 2017
@ruflin
Copy link
Owner

ruflin commented Nov 30, 2017

@martin-georgiev Thanks a lot for the contribution.

@martin-georgiev martin-georgiev deleted the patch-1 branch November 30, 2017 10:45
@martin-georgiev
Copy link
Contributor Author

@ruflin It was my pleasure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants