Advanced Searches
FoxTrot Professional Search provides some extremely powerful search capabilities; some of them require a certain dexterity. Here are a few example cases:
FoxTrot Queries
You may use one or multiple basic criteria (e.g. [includes all of the words], [includes at least one of the words] etc) to express your query, but you can also use matches the FoxTrot query to express it in a single text string. The syntax of these queries is documented in the help menu.
Browse All Documents
Instead of searching for some specific keywords, you may want to browse your complete indexed dataset (or just a subfolder), and use the categorization pane to focus on certain files.
To do so, use the all items of type criterion, with any file or folder type.
This can be useful especially when using the thumbnails mode for the result list.
Search by File Name
You may use the file name criterion, but sometimes this is not precise or flexible enough. In this case, use then apply advanced filter instead (or as a complement). If you use no other search criterion, then FoxTrot will propose to add an any file or folder criterion, as filters can only be used in addition to another criterion, but this will be slower.
Once then apply advanced filter is selected, you may use some basic operators (contains, starts with, ends with…) or even some very powerful regular expressions1, either on the file name, on its extension, or on the full path (or even on the whole file contents).
Please note that file name filters, like other criteria, are executed on the the index and not directly on the filesystem; thus if some files have been added, deleted, moved or renamed since the index was updated, the results won't reflect these changes. Likewise, you can't search for files in an unindexed folder; but you can search an unmounted volume.
Here are a few examples:
- to search for any c++ source code file (there are different possible file name extensions), use:
[all items of type] [any file or folder], [then apply advanced filter] [extension] [is exactly one of the strings] [ignore case, multiple strings] [cpp—c++—cxx]
(use the em dash character, i.e. option-dash, to separate strings) - to search for a file inside a folder with a given name, wherever this folder is located, and regardless of the depth of the file inside the folder's hierarchy, use:
[file name] [includes consecutive words] [filename.pdf], [then apply advanced filter] [full path] [contains the string] [ignore case] [/folder name/]
- to search for any image (especially using the thumbnails view) contained inside any application package (assuming including: files inside packages is enabled in the indexed data pane of the manage indices window), use:
[all items of type] [image], [then apply advanced filter] [full path] [contains the string] [ignore case] [.app/]
- to search for any video file whose name starts with any formatted date (e.g. 1984-01-24 presentation.mp4), use:
[all items of type] [video], [then apply advanced filter] [file name] [contains the regular expression] [case insensitive] [^(19|20)?\d\d-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01]) ]
- to search for any file stored in a folder having the same name as the file itself (extension excluded) (e.g. /Users/me/Documents/Report/Report.pdf), use:
[all items of type] [any file or folder], [then apply advanced filter] [full path] [contains the regular expression] [case insensitive] [/([^/]+)/\1(\.[^/.]+)?$]
Neighboring Words
The includes neighboring words criterion can be used to find multiple words occurring in proximity to each other. You can either use single words, quoted strings, or wildcards, for example:
- to find documents containing the 3 expressions [john doe] [condominium] and [new york], with no more than 100 other words between them, use:
[contents, any metadata or file name] [includes neighboring words] [around a few lines - 100 words] ["john doe" condominium "new york"]
- to find documents containing [happiness] and any word starting with [slave], with no more than 100 other words between them, use:
[contents, any metadata or file name] [includes neighboring words] [around a few lines - 100 words] [happiness slave*]
Dates
There are two very different ways to search for files that were created, or modified, in a given date range: categorizing, and filtering.
Categorizing by Date
FoxTrot uses some predefined date ranges, like yesterday, this month, two years ago etc. All found documents are categorized according to these ranges, and a histogram chart shows how they are distributed. The height of each bar shows how many documents are found in this date range, and the saturation of the color of the bar shows the average relevance of these documents. Note that some documents may belong to multiple ranges: 6 months ago may overlap with last year. You may select one, or multiple predefined ranges in the chart. Use the contextual menu to toggle between modification and creation dates, and to choose the graph's vertical scale.
Filtering by Date
For more precise date searching, use then filter by date. You can then search for any arbitrary date range, either relative (e.g. less than 5 weeks ago) or absolute (e.g. after January 24, 2020).
Searching for Dates as Regular Expressions
In addition, you may also use the regular expression1 engine to search for some date strings inside document contents, or file names. For example:
- to search for the date [January 24, 1984] in any standard english format, in addition to the word [macintosh], use:
[contents, any metadata or file name] [includes all of the words] [macintosh], [then apply advanced filter] [contents] [contains the regular expression] [case insensitive, multiple strings] [\b0?1([/.-])24\1(19)?84\b—\bjan(uary)? +(24(th)?|twenty[- ]four(th)?),? +(19)?84\b]
Partial Words, Case, Accents, Punctuation and Special Characters
By default, FoxTrot only searches for whole words (i.e. whole strings of consecutive alphabetical and numerical characters) matching the words in your query. It ignores case and accents, and considers punctuation characters as word separators.
You may search for words starting, ending, or containing a substring by using the * wildcard as a prefix or suffix: [fox*], [*trot] and [*ox*] will all find the word [FoxTrot].
In some cases, you may want to take case or accents into consideration (e.g. you don't want to find [us] when searching for [US], or to find [resume] when searching for [résumé]). You may also want to search for a sequence of words containing some punctuation or other non-alphanumerical characters (e.g. you don't want to find [Rh-] when searching for [Rh+]; or you don't want to find [Sagittarius A] when searching for [Sagittarius A*] - and you actually want to find the * character, and not interpret it as a wildcard; or you don't want to find the IP address [12.34.56.78] when searching for the phone number [12-34-56-78]).
In these cases, use includes the exact string. However, there are some important restrictions that you should be aware of:
- the search string must contain at least one word (i.e. at least one alphabetical or numerical character)
- if the search strings starts with, or ends with, an alphabetical or numerical character, this character will only be found when it is the first, or the last, character of a word in the document. I.e., you can't use includes exact string to search for partial words (even when using the * character, which is searched literally)
An alternative to includes the exact string is to use then apply advanced filter with contains the string. It does not have these restrictions, but is much slower. For example:
- to find a smiley, use:
[all items of type] [any file or folder], [then apply advanced filter] [contents] [contains the string] [] [;-)].
Please note that for performance reasons, whenever possible you should reduce the number of files to apply the filter on, by using some restricting criteria instead of [all items of type]
Another alternative is to use regular expressions; see below.
Regular Expressions
FoxTrot performs almost instant searches because it looks for whole words (or partial words, when using * wildcards) in its index. In some situations, you can't express your query in term of whole or partial words, but you may express it using regular expressions1. Because FoxTrot stores a compressed version of the plain text content of your documents, it can also perform this kind of unindexed searches very efficiently; it typically takes only a few seconds to process gigabytes of documents. Whenever possible, use some restricting criteria before applying a regular expression filter, but if needed, use the [all items of type] [any file or folder]
criterion:
- to find one of the strings [Sagittarius A] or [Sgr A] not immediately followed by an asterisk character, use:
[contents] [includes at least one of the words] ["Sagittarius A" "Sgr A"], [then apply advanced filter] [contents] [contains the regular expression] [case insensitive] [(Sagittarius|Sgr) A(?!\*)]
- to find any word composed of 2 to 5 characters (including accented or non-roman letters) immediately followed by an asterisk character, use:
[all items of type] [any file or folder], [then apply advanced filter] [contents] [contains the regular expression] [\w, \d, \s and \b also apply to Unicode characters] [\b\w{2,5}\*]
- to find any group of 2 Han (Chinese) characters, neither immediately preceded nor immediately followed by another Han character:
[all items of type] [any file or folder], [then apply advanced filter] [contents] [contains the regular expression] [] [(?<!\p{Han})\p{Han}{2}(?!\p{Han})]
- to find all PDF documents whose indexed content length is 100 characters or less, use:
[all items of type] [PDF], [then apply advanced filter] [contents] [contains the regular expression] [. also applies to newlines] [^.{0,100}$]