Opened 3 years ago
Closed 20 months ago
#1486564 closed Feature Patches (fixed)
Patch to remove leading wildcard search in auto-complete
| Reported by: | serpico7456 | Owned by: | |
|---|---|---|---|
| Priority: | 7 | Milestone: | 0.7-beta |
| Component: | Addressbook | Version: | 0.3.1 |
| Severity: | minor | Keywords: | wildcard, autocomplete |
| Cc: |
Description
Here is a simple patch to prevent auto-complete from doing leading wildcard searches. eg a search for 'ran' only returns RANdy and RANdall, not bRANdi, bertRANd or bRANdenburg. It is my opinion that that RC will be an improved and more intuitive product if it implements the functionality that people are used to. This will mimic the results of most email clients like, mail.app, thunderbird, gmail, outlook, et al.
There are two patches, one for the SQL address book, and one for LDAP. SQL patch courtesy of skaero
Attachments (2)
Change History (9)
Changed 3 years ago by serpico7456
comment:1 Changed 3 years ago by serpico7456
For this to make sense you would have to be searching firstname and surname fields in auto-complete as well, or the surname will be ignored since it only does trailing wildcard.
--- autocomplete.inc.orig 2010-03-19 10:43:40.850998671 -0500
+++ autocomplete.inc 2010-03-19 10:44:02.109309629 -0500
@@ -28,7 +28,7 @@
foreach ($book_types as $id) {
$abook = $RCMAIL->get_address_book($id);
$abook->set_pagesize($MAXNUM);
- if ($result = $abook->search(array('email','name'), $search)) {
+ if ($result = $abook->search(array('email','name', 'firstname','surname'), $search)) {
while ($sql_arr = $result->iterate()) {
$contacts[] = format_email_recipient($sql_arr['email'], $sql_arr['name']);
if (count($contacts) >= $MAXNUM)
comment:2 Changed 3 years ago by alec
-1 from me.
comment:3 Changed 3 years ago by thomasb
- Milestone changed from 0.4-beta to 0.5-beta
What most email clients do is searching by word. In order to improve this feature in the way you suggest we should create a fulltext index and search this (without the leading wildcards). Unfortunately not all database backends support this.
comment:4 Changed 2 years ago by alec
As you see in patches, there's no need for fulltext searching. This feature if implementend should be optional.
comment:5 Changed 2 years ago by alec
#1486956 marked as a duplicate of this request.
comment:6 Changed 21 months ago by alec
I'd like to see a patch that merges this solution with #1487907 and a user-configurable preference for this behaviour.
comment:7 Changed 20 months ago by alec
- Resolution set to fixed
- Status changed from new to closed
Implemented in [f21a04c0].

patch for SQL address books