views:

135

answers:

4

I have a list control in GTK+ (a gtk.TreeView with one column), with "find-as-you type" enabled (so typing any text will open a small search field for searching through the list entries). Now, if the user enters some search text like "abc", should I search only for entries starting with "abc", or should I search for entries that contain "abc" somewhere in their text?

(links to relevant Human Interface Guidelines appreciated)

A: 

As a user, I appreciate a "contains" search rather than a "starts with". Sometimes you can't remember exactly what you're looking for and it's more helpful to suggest things that are similar to your search query rather than using it as a straight filter.

There are times when there are multiple way to list something as well, ie:

Shining, The - King, Stephen
The Shining - Stephen King
King, Stephen - The Shining

etc.. In my opinion, typing in "Shining" should return any of those results.

Wayne
A: 

Surely the correct answer is it depends? What is your subject matter?

I'd vote for anywhere in the text or matching any whole word in the text (i.e. not having to match the middle of words) if you are feeling lazy.

Although there are some instances where and exact match from the first word is preferable.

Omar Kooheji
A: 

ideally, a find as you type will do partial matching on ordered characters until a word boundary is reached. For example (in pseudo-code):

var input =  getInput();
    input =~ s/(.)/$1.*/g;
return find_items(input); // Assuming this takes a regexp as its input

This means that for input = "Shing"

And a database containing {..., Sine, Shining, 'The Shining', ...}

The output will be {Shining, 'The Shining'}

When a word boundary is reached, the matching should change to match contiguous word parts. Roughly:

var input =  getInput();
    input =~ s/(\w+)/$1.*/g;
return find_items(input); // Assuming this takes a regexp as its input

Such that for input = "Th Shi"

And the same database as above

The output will be {'The Shining'}

Edit (Addressing the UI Guidelines request): You could do worse than watching this video

dsm
+1  A: 

As Omer Kooheji said, the correct answer depends a lot on what the listbox contains. However, on the basis of the Principle of least astonishment, I would recommend matching at the start of an entry; that's the way it happens with most list boxes (in the Web, in time zone selection in Linux installations, etc. for example), so that is the behaviour that most users would expect.

However, that is a generic advice without knowing the exact application. If your application is such that people might not know the exact start but might know some substring in between, it obviously makes much more sense to match the input anywhere.

sundar