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

Search for string field that contains only numbers doesn't work #163

Closed
lucasromanojf opened this issue Aug 24, 2018 · 5 comments
Closed

Comments

@lucasromanojf
Copy link

I have a model that has a string column. This column will mostly contain only numbers.

When I try to search in the search field (either global search or index search) by numbers contained in that field for some record, nothing is found. But if I search by text, the records that contain that text appear as expected.

Examples:

Record 1:
Field value: "43232424"
Searching: "4323" or "43232" or "43232424" -> nothing is found

Record 2:
Field value: "mock_terminal"
Search: "mock" or "mock_" or "mock_terminal" -> found as expected

@michaelchunn
Copy link

michaelchunn commented Aug 24, 2018

The resource 'users' has 'name' and 'email' searchable

    public static $search = [
        'name', 'email',
    ];

If you search for '1' it generates this query.

select count(*) as aggregate from users where users.id = ? and (users.name like ? or users.email like ?) ["1","%1%","%1%"]

@lucasromanojf
Copy link
Author

@michaelchunn try to add only numbers to the user's name for example (ex.: "252525") and then try to search "252525". Nothing will be found.

@Jam0r85
Copy link

Jam0r85 commented Aug 24, 2018

Another example of this is an address.

Storing the first line of an address eg. '123 Smith Street' and searching for '123' returns no results. However typing 'smi' gets the value no problem.

This is the same using both local and Scout searching

@mrmonat
Copy link

mrmonat commented Aug 24, 2018

Already mentioned in #23

@davidhemphill
Copy link
Contributor

This has been fixed in 1.0.15.

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

No branches or pull requests

5 participants