4 ms·
This is a very clever idea. There are a few limitations that I think would prevent this from being very usable in practice. One is that it only supports a singl
by mistercow 13y ago
This is a very clever idea. There are a few limitations that I think would prevent this from being very usable in practice. One is that it only supports a single word. If you type "Ona Bednar" into the field, you get nothing.
Another problem that would only start to show up on a larger dataset is that because the index is all concatenated directly together, it matches strings that span several words. A user searching for their pal Harry Mesbro in the list might be confused to find that typing in his last name also brings up Yvette Hammes.
- resu_nimda 13y ago"Ona" and "Bednar" are in separate data fields. Do standard JS implementations handle this case? Is that even desired - treating each word as an isolated search? Interestingly, because of the concatenated data issue, "onabednar" does return the record ("it's a feature!"). The example only supports single words because it contains only single-word data. If you edit one of the indexes to include a space it works.
- mistercow 13y agoI have never seen another search implementation that only allowed you to search one word. You don't treat each word as an isolated search, you simply check that each word is contained in a field. I guarantee that almost any user will be confused by a search that works like this demo the moment they try to search for someone's full name. But no, it won't work correctly just by adding spaces to the index. That will only work if the fields you enter are adjacent. So if you typed "Ona Bednar", it would work, but "Bednar Ona" won't. That's not how users expect search to work. For a more ordinary example of what I mean, suppose the dataset included the middle name. Users will expect to find Ona Justine Bednar if they type "Ona Bednar". If it doesn't work that way, it's broken.
- resu_nimda 13y agoWell, I was talking about live search filtering of a dataset on the page, like this demo. Most are simple Ctrl+F text searches (when I said adding spaces would work, that was intended to only cover the case of an unbroken substring within one field). After a quick look I didn't find any demos that support multi-field searches, though it would certainly be possible.
- mistercow 13y agoI didn't find any demos that involved multiple fields at all. But "multiple fields" is not a concept that exists in most users' worlds. Names exist, and email addresses exist. They wouldn't try to search for "ona schamberger.frank@wuckert.com", but they will try to search for "ona bednar".
- kbenson 13y agoThat's because the data-index field has been created with all whitespace removed. If the field was created with whitespace preserved, you could search with the original whitespace.
- mistercow 13y agoWith the original whitespace, yes, but not with fields reordered or omitted between other fields. Users expect search to work basically the same way that a simple Google search works, and that's not hard to implement.
- kbenson 13y agoIndeed it isn't. My other comment on this post actually outlined a simple method to do as much.