Wildcards, Phrases, and Other Search Syntax Sundries

At Sherpa Software, we strive to make our products easy and intuitive, but we still get calls from customers wanting help crafting their keyword search syntax.

The key things to understand are the differences between the Word List (Any), Word List (All), and Search Expression options. For simple searches, the Word List options are the way to go:

danewsletter

Words or phrases are entered one per line; phrases do not need to be contained within quotation marks, and the asterisk functions as a wildcard. As the Word List (Any) name implies, if any single item on the list is present in a message or document, it will be returned as a hit. Likewise, with Word List (All), a message or document must contain all of the items on the list in order to be considered a hit. Pretty simple, right?

More involved searches, however, require the Search Expression option. Search Expressions allow you to craft complex syntax – using the AND and OR operators – to search for unique combinations of words or phrases. When combining AND’s and OR’s, though, it is vital is to be able control the order in which the components of your search calculate. This is when parentheses are brought to bear.

Without parentheses, AND calculates before OR, and that very well might not give you the results you want. Let’s say we have two lists: one of employees (Denny, Patty, Marta, Jeff) and one of software packages (Word, Excel, PowerPoint, Notepad). We’d like to run a search that returns anything with a member of List A (the employees) and anything from List B (the software). At least one member of each set must be present in order to return a hit.

Since we only require one member of each list, we know that within each list, we can use the OR operator. And since both sets must be represented, we know that we need an AND operator between the lists.

So, our search will take the form of *something* like this:

Denny OR Patty OR Marta OR Jeff AND Word OR Excel OR PowerPoint OR Notepad

But will that syntax get us the results we want? I bet you said, “No” – and you’re right. We need to isolate the two lists from one another:

(Denny OR Patty OR Marta OR Jeff) AND (Word OR Excel OR PowerPoint OR Notepad)


Behold the power of the parentheses! Had we omitted them, we would have had the logical equivalent of:

Denny OR Patty OR Marta OR (Jeff AND Word) OR Excel OR PowerPoint OR Notepad

… and that’s not what we want.

Think of it in the same way you would use parentheses when performing multiplication and division:

(3 x 4) / (2 x 5) yields a different result than 3 x (4/2) x 5. This is because calculations within parentheses conventionally calculate prior to those outside the parentheses. The placement of the parentheses is essential to the determination of the outcome.

Phrases are allowed in Search Expression searches, but they must be contained in quotes:

“The cow jumped over the moon”

Phrases and single words can be combined:

Patty AND “The cow jumped over the moon”

Wildcards are also permitted in Search Expression searches, but things can get complicated when combining wildcards and phrases. For example, if we add an asterisk to the search above:

INCORRECT:        “The cow jumped over the mo*”

… Discovery Attender treats the asterisk as an actual asterisk and not as a wildcard. This is because it’s contained within the quotation marks, and is therefore taken literally.

To circumvent this, we need to use the LIKE operator.

CORRECT:        LIKE(“The cow jumped over the mo*”)

This would return messages and/or documents containing phrases like, “The cow jumped over the moon” or “The cow jumped over the motorcycle.”

Discovery Attender has plenty of tools to help you create very narrow, specific searches, but sometimes some thought is required to work through the logic. And, as always, use the Test function or run your search against a small, sample dataset to be sure you are returning the values you are expecting, before committing to a “real” search against a vast amount of data. And, as always, if you still have questions, Sherpa’s outstanding support team is always available for your assistance!

Leave a Reply

Your email address will not be published. Required fields are marked *