14

So lets say I am implementing a search feature that people would use to check fantasy football teams and their roster. A fantasy football team can have 8-12 players that each user selects from all of the available players in the NFL, thus you could have players who exist on the same NFL team or different NFL teams on your roster.

Lets say I want to see all the teams that have

(Ben Tate && Arian Foster) || (Adrian Peterson && Toby Gehert)

where && = and, || = or

i.e., the user wants to see teams where people commonly handcuff one player with their backup (in this case Foster & Tate are on the same team, Peterson & Gehert are on the same team).

If they have no knowledge of the AND (&&) and OR (||) symbol what is a way where you could illustrate that concept in a search feature?

7
  • 2
    I added boolean-search tag for you.
    – DA01
    Sep 11, 2013 at 23:30
  • @DA01 Oh well. I tried. I wish there was a way of getting a list of tags. Sep 12, 2013 at 7:06
  • 2
    A lot of people are really bad at understanding formal logic things - I'd try to represent it graphically (maybe with Venn Diagrams)
    – PhillipW
    Sep 12, 2013 at 9:47
  • 1
    @AndrewLeach Ta da!
    – AakashM
    Sep 12, 2013 at 9:48
  • 1
    Actually, in English "or" can also mean non-exclusive or. This usually depends on if the various cases are even feasible together or not. E.g. you can leave this building by exiting left or right ==> exclusive because you can't leave both ways at the same time. You can only enter if you have a membership card or a ticket ==> non-exclusive because you can have both and they'll still let you in. Sep 30, 2013 at 15:17

6 Answers 6

10
  • Any of the following instead of OR.
  • All of the following instead of AND.
  • Use a combination of brackets and indentation for nesting the two.
  • Provide a tooltip with examples.
2
  • "any" and "all" look too similar in that phrase, the difference would be subtle for an average user. I would be cautious with using those. Sep 12, 2013 at 3:42
  • I completely agree with 'Any' and 'All' instead of AND and OR. In my experience, indentation works much better than brackets. Indentation limits the available space as terms become more nested but it is unlikely anybody will create a query with terms nested 3 deep. Most people do not understand a query that complex nor would they create one. More than likely, they will create a more shallow query with redundant terms. Sep 12, 2013 at 12:26
15

This is, to say the least, something of a power feature, but OS X implements it thusly:

Boolean search operators in OS X

By default adding additional search criteria simply adds another row to the list (and they're each treated as AND filters).

If you hold the Option key while clicking the + button, it adds a boolean search row and one more search row nested beneath it.

In this way, users can nest boolean operators (that first drop-down can be set to "All", "Any" or "None").

It's a bit convoluted, but it can effectively represent any search logic you like. For instance, here's a more complex example (as per your comment), of A && B && (C || D):

More complex example demonstrating the nesting of boolean search filters

3
  • This is what I meant, except that the example does not include deeper levels e.g. A AND B AND (C OR D). Sep 12, 2013 at 14:20
  • @DannyVarod I've updated the answer to demonstrate exactly that, though it's worth pointing out that the top-most filter (the "All of the following are true" row) is implicit if it's not there.
    – Kit Grose
    Sep 12, 2013 at 15:33
  • Much better. The previous example also did not make sense mathematically. Sep 12, 2013 at 15:38
4

I would try and replicate natural language as closely as possible:

mockup

download bmml source – Wireframes created with Balsamiq Mockups

0
3

I can think of three options:

  • Include a (advance?) search examples link;
  • Show some search examples in a tooltip on focus;
  • Include a greyed text in the search field with and example (notice that often these come to replace labels, so may not be an ideal solution).

I would be inclined to pick the first option, but that depends on how likely people are to return to the site (repeating hints and labels are annoying once learnt, although in the case of a tooltip you can add 'don't show again' message), and how urgent it is for you that people know this.

Both the first two options are shown here:

a screenshot of wolfram alpha showing an examples link and a tooltip

And the last one here:

An image showing the iCloud Login Form

3

I would just use the words "and" and "or". Many programming languages use these instead of the more mathematical looking symbols like "&" and "|", in fact the query language SQL uses "AND" and "OR" (it sounds like you might be creating a query language here). Expressions built with the words "and" and "or" would be much more understandable by a larger group of people than those using alternative symbols.

You could require they be capitalized to make them stand out more as boolean operators and make the parsing of the expressions a little easier.

(Ben tate AND Arian Foster) OR (adrian peterson AND toby gehert)

Almost anyone can understand that and it should be explainable with just a few examples.

1
  • 6
    Only use AND and OR if the targeted user group knows Boolean logic. Otherwise avoid those terms. There is a body of research on this problem showing most people misinterpret the function of AND and OR in queries. See this paper as an example of this research. Having worked on this problem for many years, we've chosen a variation Danny's. In ours the user chooses Match All or Match Any before specifying the variables, operators, and values. Match All = AND Match Any = OR This works better than any AND and OR UI we've tried without a doubt. Sep 12, 2013 at 12:22
0

Heres my idea:

enter image description here

I realize the terms "and", "or" are completely different from the image in people's mind. And feels like or, and or feels like and. That's why people start to use "all of the following" to replace "and". But I am also against to have to read a whole line of texts. That's why I still wanna try to use image to present the concept.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.