Prefix Searching the PST

Here’s a neat trick:

  1. Load a PST into Outlook and pick a folder with some messages in it
  2. Go to Advance Find -> Advanced -> Field -> All mail Fields –> From
  3. Select condition”'word starts with”.
  4. Enter the last part of an e-mail address of a sender of a message in your folder.
  5. Click on Add to List
  6. Click on 'Find Now'.
  7. Observe the results.

Since our restriction is “word starts with”, our restriction won’t match and we won’t get results, as expected. Now – turn off indexing for this PST and try it again. Now you start getting matches!

What’s happening? In MAPI search, “word starts with”  doesn’t correspond to any of the traditional fuzzy flags. FL_PREFIX will only match the beginning of the block of text, and FL_SUBSTRING will match anything within the text, no matter where it is within a word (or even spanning words). So we had to invent a new fuzzy level: FL_PREFIX_ON_ANY_WORD to capture the intended search semantics.

When searching against Exchange, or when using the index against a PST, we understand this flag. However, we never implemented this flag for the PST (non-indexed), and other stores wouldn’t be aware of it either. So, as a compromise, when dealing with a store which we think won’t understand FL_PREFIX_ON_ANY_WORD, we remove the flag from the search and substitute FL_SUBSTRING. For searches of large blocks of text, such as Subject or Body, this is a good compromise. For searches of From or other fields which usually consist of one word (or, at least, no white space), we’ll see this side effect of the searches matching the middle or ends of the words.

BTW – support for this documentation ultimately got cut, but we did point out this substitution of FL_SUBSTRING for FL_PREFIX_ON_ANY_WORD here:

https://blogs.msdn.com/b/stephen_griffin/archive/2006/05/11/595338.aspx