Skip to content
New issue

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

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

Already on GitHub? # to your account

Unexpted search results when looking for exact match #3474

Closed
3dgroup opened this issue Nov 17, 2018 · 2 comments
Closed

Unexpted search results when looking for exact match #3474

3dgroup opened this issue Nov 17, 2018 · 2 comments
Assignees

Comments

@3dgroup
Copy link

3dgroup commented Nov 17, 2018

Description

When doing an exact search unexpected results appear. EG if i have a field with OSCA3 but search 'sku::"OSCA"' i shouldn't expect the entry with OSCA3 to appear but it does. Having looked at the DB query craft adds a % to the end of the string resulting in the search returning anything starting with OSCA. But the double quotes should return only fields that have an exact match.

Steps to reproduce

  1. Add text field called sku and add to section
  2. Create multiple entries with data such as OSCA1, OSCA2, OSCA3
  3. PHP Query: \craft\elements\Entry::find()->search('sku::"osca"')->all()
  4. Should return nothing, but instead it will return all 3 entries due to resulting query:
    SELECT elementId
    FROM searchindex
    WHERE ((fieldId = '35') AND (keywords LIKE ' osca%')) AND (siteId=1)

Additional info

  • Craft version: Craft Pro 3.0.31
  • PHP version: 7.0.32
  • Database driver & version: MySQL

Possible Cause

Setting subRight to false resolves the issue but that might cause an issue for non-quoted searches, so the bug is probably "subLeft and subRight should be ignored for exact match searches"

@angrybrad
Copy link
Member

Guessing the issue is that subLeft and subRight should be ignored in exact match tokens.

@angrybrad angrybrad self-assigned this Nov 17, 2018
@brandonkelly
Copy link
Member

Fixed for tomorrow’s release. Thanks for reporting!

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

No branches or pull requests

3 participants