Skip to content

Remove spaces before numbers in order to avoid search errors #3

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

Merged
merged 6 commits into from
May 4, 2017

Conversation

avstudnitz
Copy link
Contributor

Exact matches for searches like "Omega 3" or "Jura Giga 5" returned no exact results as Solr has problems with numbers. With this PR, we change the search query to "Omega3" or "Jura Giga5", which results in direct matches.

@avstudnitz avstudnitz requested a review from schmengler April 18, 2017 12:42
Copy link
Contributor

@schmengler schmengler left a comment

Choose a reason for hiding this comment

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

Please adjust unit tests for the content_type:product change (a test case for "remove spaces" would be great too)

public function getEscapedString()
{
if ($this->escapedString === null) {
$this->escapedString = $this->escape($this->getRawString());
$this->escapedString = preg_replace('/\s([0-9])/', '$1', $this->escape($this->getRawString()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe change \s to \s+ to also cover repeated whitespace characters?

@avstudnitz
Copy link
Contributor Author

Could you check again @schmengler?

@avstudnitz avstudnitz merged commit 8bd6bbd into master May 4, 2017
@avstudnitz avstudnitz deleted the number-queries branch May 4, 2017 06:21
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