Home

Glossary

  Application Icon   Designing a search query

Writing your query as simply and as precisely as possible is the key to good search results. Following are some tips on how to write a good query.

Designing a good query

Suppose you want to search for information about the mercury contamination of fish, and to focus on information released by or referring to the United States Environmental Protection Agency.

One problem with trying a simple AND search for a group of words is that the Environmental Protection Agency is referred to in various ways: Environmental Protection Agency, EPA and E.P.A.

If we tried the search string

Example: Environmental AND Protection AND Agency AND EPA AND E.P.A. AND fish AND mercury

we would probably get no results at all, as no single article would use all three terms for the environmental agency. And even if we were to get search results, we would get irrelevant results stemming from the terms environmental, protection and agency.

Here's a better way to design the query:

Example: ("Environmental Protection Agency" OR EPA OR "E.P.A.")

which will pick up the variants in naming the agency in articles. Note that the two strings enclosed in quotation marks will now be treated as phrases. This reduces ambiguity. Also note the use of parentheses and the OR operator. We have now covered all three variants of common names used for the environmental agency. DEVONagent Express will look for pages containing any one of those names.

Another potential ambiguity is created because it's possible that a large reference source might contain the word 'fish' in one section dealing with fishery resources, and contain the word 'mercury' in another section dealing with the history of barometers. We're simply not interested in that item. But if we use the NEAR operator between 'fish' and 'mercury' it's likely that we will get useful results, since this query places the space between the two terms at 10 words or less.

The refined query now becomes:

Example: ("Environmental Protection Agency" OR EPA OR "E.P.A.") AND (fish NEAR mercury)

Notice that a second set of parentheses was used so that DEVONagent Express doesn't wrongly interpret the query as requiring that both the environmental agency name and 'fish' must be NEAR 'mercury'. That confusion would be created if we wrote the query as:

Example: ("Environmental Protection Agency" OR EPA OR "E.P.A." AND fish) NEAR mercury

Indeed, the refined search returned highly relevant pages. Of course, this search focused on literature about mercury contamination of fish in the United States. To change the geographical focus, one would simply replace the search strings in the first set of parentheses with, e.g., ("European Union" OR EU).

Improving your query

Besides the typical Boolean operators AND, OR and NOT, DEVONagent Express provides much more powerful NEAR, BEFORE and AFTER operators. Typically, only scientific high-end databases feature these operators, but DEVONagent Express makes them available for Web research.

Note: Because almost none of the Web search engines support these operators, DEVONagent Express sends the simpler AND query to them and applies the more sophisticated operators to the resulting pages.

All three operators connect two search terms closer together than AND, but not as tightly as the phrase operator (double quotes). With the additional distance parameter (e.g., NEAR/5) you can fine tune search results until you get only the results you are looking for.

Example: (steve NEAR/2 jobs) BEFORE (intel NEAR (imac OR macbook)) AND "San Francisco"

Connecting 'steve' and 'jobs' with NEAR/2 prevents getting result pages of some Steve looking for a job in his page footer. BEFORE makes sure it is a page that mentions Steve Jobs first, followed by the Intel Macs. Finally, the quotes around 'San Francisco' find only pages dealing with the city of San Francisco, not the city San Jose or a Brother Francisco mentioned elsewhere on the page.

Use the proprietary NEAR, BEFORE and AFTER operators when AND delivers too many results and quote marks delivers too few. Another example:

Example: document AND management AND mac

This query run with the Web plugin deliveres good results. But, many are not what we are looking for. Among good pages, it also presents the Wikipedia article about OS X because it contains all three words. But, of course, this article is not at all about document management on the Mac. We can refine this query, however, using the special DEVONagent Express operators:

Example: document NEAR/2 management NEAR mac

This time, DEVONagent Express returns fewer results, all of them dealing exactly with our search subject, document management for the Macintosh, because the three words must appear near each other in the text. In most cases, NEAR delivers more accurate results than AND.

First principle of a successful query

Make the query precise and unambiguous. DEVONagent Express' tools for clarifying your query are clear and simple and will help you obtain a high percentage of useful results.