You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use of RegEx circumvents MongoDB's ability to rely on indexes. Maybe its better to add lowercase: true to the schema of the email address field and simply check against the lower-case value?
Here the use of RegEx is a major performance hit, making the application feel sluggish. Besides this, it also limits usability; if a ticket contains companyname 123caseid (accidental double space when the ticket was created), a search for companyname 123caseid (single space) or 123caseid companyname won't yield any results.
In the example above I have given more weight to the display name, so that anything that matches the display name is prioritized.
Full text search also yields results when mistyping "companie" instead of "company". Not sure on the latest of MongoDB, but also might yield results when dealing with diacritics.
The text was updated successfully, but these errors were encountered:
apboon
changed the title
Use of RegEx is high performance hit (doesn' and unnecessary
Use of RegEx is high performance hit and unnecessary.
Jan 22, 2019
Perfect timing. I'm in the process right now of refactoring a lot of old outdated code from years back. You've spotted two great examples of that old code. I will get these refactored.
polonel
changed the title
Use of RegEx is high performance hit and unnecessary.
[BUG] Use of RegEx is high performance hit and unnecessary.
Jan 28, 2019
Use of RegEx circumvents MongoDB's ability to rely on indexes. Maybe its better to add
lowercase: true
to the schema of the email address field and simply check against the lower-case value?trudesk/src/models/user.js
Line 330 in 520a62b
Here the use of RegEx is a major performance hit, making the application feel sluggish. Besides this, it also limits usability; if a ticket contains
companyname 123caseid
(accidental double space when the ticket was created), a search forcompanyname 123caseid
(single space) or123caseid companyname
won't yield any results.https://github.com/polonel/trudesk/blob/master/src/models/ticket.js#L916
I recommend using MongoDB's full text search. Here's an example for creating an index:
In the example above I have given more weight to the display name, so that anything that matches the display name is prioritized.
Full text search also yields results when mistyping "companie" instead of "company". Not sure on the latest of MongoDB, but also might yield results when dealing with diacritics.
The text was updated successfully, but these errors were encountered: