I'm designing a desktop application (boring accounting stuff) and I have a "search product" feature.

I want to have a nice but simple 'smart' search box. Currently, the search box works by splitting all words specified and looking all records that partially matches any of them.

Now I'm faced with the following dilemma: I really want to provide a way to specify if the user want to match any or all the words specified. What would be a good approach?

Another issue is that maybe a user wants to perform an exact match. Again, I want the app to be simple to use.

At the moment I just threw three radio buttons to the form, but I feel dirty inside... any opinions?

6 Answers 6


Google has solved this long ago - no use reinventing the wheel. ;)

I'd suggest you remove the need to choose, and do three searches at the same time: "exact phrase", "match all words", AND "match any". Then unite (SQL "union") those results in that order, and present them to the user.


  • more load on your database.


  • more natural for the user: if someone enters several words, most probably they know what they are looking for; they're not shooting in the dark trying to get at least one word right
  • matches experience on search engines
  • saves one click in the interaction=saves time.

Make sure to remove noise words from the search phrase and normalize cases/conjugations, etc.; it will help find the results your users need, even if they type the search words in the wrong case/tense/with the wrong article.

Also make sure the search works with keyboard only (i.e. without forcing user to use the mouse. <search phrase> <Enter> should be enough to get results).

  • 4
    @ChrisF I think the drop down is actually worse than the radio buttons from the UX point of view, because it requires two clicks/selections: one to open the list, one to select the right option, whereas the radio buttons require only one. Plus, they make it immediately visible what the options are.
    – Erion
    Commented Sep 25, 2010 at 23:21
  • 1
    I think this what I'm trying to achieve. I know Google does a lot of dark magic behind the scenes to bring up results; this is good feedback. I'll wait some more to see if there is any other ideas floating around... Commented Sep 26, 2010 at 3:22
  • Great suggestion. It might be good to subtly delimit the sections ("exact match", "all words present", "some words present") in case the user cares if there was an exact match.
    – dbkk
    Commented Sep 27, 2010 at 18:14
  • I love the idea of using unions in the database. Under normal use this shouldn't strain the server too much. Marking as accepted, thought the answer below by Dan Barak is a close second. Commented Sep 28, 2010 at 14:59
  • 1
    A small addition: If you are going to give the users a union of search results as mentioned above You might want to give them filters to narrow their search later (Ie after the results have been shown.). I'm assuming that below Dan Barak is talking about refining the search while the user enters the search query. Even in this scenario I think you might want to later show the user how he may change his customizations to the search results.
    – Viraj
    Commented Sep 23, 2011 at 22:29

My personal opinion is that you should provide a way for the user to refine the search, because:

  1. You stated it as your goal ("I really want to...") and no matter what automatic approach you take, you won't allow the user to choose.
  2. Gmail (which is an application - more similar to your own application than web search) does allow you to show and refine the search options.
  3. Even the regular Google search allows the user to refine the results manually, i.e. if the search string is in quotes, it'll search for it as a whole.
  4. As an experienced user, if I know my criteria, making automatic decisions for me and shuffling my results according to some algorithm I don't know, really works against me.

The way I'd suggest to do it is somewhat similar to what Chris suggested.

Taken from DeepDyve: alt text

Once you press the "refine", you can either open a drop list immediately, or even use a small dialog if in the future you intend to add more search options.

  • +1 For mentioning search refinement should be possible, but in a separate "bit" Commented Sep 26, 2010 at 19:05

If space is the primary concern have you thought of using a drop down? While perhaps not a brilliant solution (as it does require more clicks) it would take up less space than a set of radio buttons.

The current option would appear with the expander to allow the other choices.

       +-----------------+---+ +---------------------+ +----+
Search | exact phrase    | V | |                     | | Go |
       +-----------------+---+ +---------------------+ +----+
       | all words           |
       | any words           |
       | exact phrase        |

(excuse the bad ascii art)

A refinement could be to perform the drop down when the mouse hovers over the expander rather than the user having to click, but again it's not an ideal solution.

  • Well, I think this is basically the same as my solution. Uses less screen space, thought. Commented Sep 26, 2010 at 3:20
  • @Leonardo - I was thinking it would take less space, I should have made that clear in the answer.
    – ChrisF
    Commented Sep 26, 2010 at 12:53
  • 1
    Oh, yeah, I forgot - definitely +1 to our starving ASCII artists of today :-) Commented Sep 28, 2010 at 14:57

I'd kill the search options -- I don't think it's how your users think, but, as the UI mantra goes, test it with real users and see what they think.

Usually search engines prioritise like this:

  1. Try and find the whole thing (the AND)
  2. Try and find presence of individual words together
  3. Try and find fragments of the words (stems -- you type 'kicking' it matches 'kick' too)

Definitely agree with Erion - no need for having the user choose that sort of thing - have your search engine (whatever it is) do it for you.

No matter what technology your back-end is using for searching, there are ways for it to prioritize the results according to whatever criteria you want (i.e. just like Google does). Some may be more difficult to set up than others for this sort of thing, but even a basic SQL Server full-text indexing can provide this level of search results organization.

Just make the decision for the best user experience and have your engineers (or developers, if you must) make it work. That's what they're there for. Since I am an engineer too, I can say that :)


If you're curious, full text search engines work most commonly by using TD-IDF scoring. This stands for Term Frequency-Inverse Document Frequency. The gist is that a document is more relevant if the search term appears in it very frequently, this is discounted by the number of documents that the word appears in overall.

  • I'm somewhat familiar with this, having integrated a full text search engine software (proprietary) in the past to a web SQL application (we had to unload the data, feed it to the full text search engine and use it "off-site." But in this case, I'm searching simple things like invoices, companies, products, etc., and I'm just using simple filters. I'm using Delphi if you are curious... Commented Sep 26, 2011 at 15:21

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.