Custom Types

< back to parent page

This feature is currently only available in DocFetcher Pro, not in DocFetcher Server. Server

The Problem

In DocFetcher, there’s a Document Types pane on the left side:

This is a checkbox list of the kinds of files you can filter the search results by, e.g., “exclude all PDF files”, or “include HTML files”. As was pointed out in various feature requests over the years, certain kinds of filter operations are not possible in DocFetcher due to the fixed nature of the file types list:

  • Filter by types not predefined in the list, e.g., “hide all exe files” or “show only exe files”.
  • Splitting an existing type into subtypes and filtering by the latter. For instance, programmers may wish to split the “Text” type into “java”, “cpp”, “py”, “php”, “js”, etc., so they can filter by these subtypes separately.
  • Grouping two or more existing types into a bigger supertype and filtering by the latter, e.g., combining “doc”, “docx”, “odt”, “rtf” and “txt” into a single “Documents” type.

The Solution

In DocFetcher Pro, the above use cases and more are covered by a new concept called Custom Types. The basic idea is as follows. Below the Document Types pane, there’s now another pane, the Custom Types pane:

The Custom Types pane works just like the Document Types pane, except it allows you to define your own file types based on matching patterns against filenames. For instance, to define a new “Documents” type, basically all it takes is entering the type label “Documents” and the filename patterns to detect the files that should be included in the new “Documents” type:

The dialog shown above is opened by right-clicking into the Custom Types pane and selecting “Add Type…”.

Further Explanation

Wildcards vs. regular expressions: Filename patterns can be either wildcards or regular expressions. The latter are quite powerful, but also relatively difficult to understand. By comparison, wildcards are limited, but also relatively easy to understand: There are only the two wildcards * and ?, which are essentially placeholders for ‘zero or more characters’ and ‘exactly one character’, respectively.

The special “Other” type: When you start DocFetcher Pro for the first time, there are no types in the Custom Types pane except the “Other” type. This special type cannot be removed and acts as a catch-all entry for files not matching any other custom types.

Arbitrary filename patterns: You may have noticed that the Custom Types pane matches patterns not just against file extensions, but against entire filenames. This gives the Custom Types pane power well beyond the three use cases described above: You can define custom types based on any filename pattern. For instance, if you happen to have files named
report_2020_01.docx
report_2020_02.docx
report_2019_all.docx
– etc.
scattered across various folders, you can use the wildcard pattern report_*.docx to combine them all into a single custom type named “Reports”.

Document Types as a starting point: You may be wondering why DocFetcher Pro still has a Document Types pane when it has the clearly more powerful Custom Types pane. The answer is that the Document Types pane provides a starting point for new users, allowing them to filter by types right away without having to mess around with custom types first.

Interaction between Document Types and Custom Types pane: Another question that may have popped into your head is how the Document Types and Custom Types pane interact with one another, i.e., what happens if you check and uncheck boxes in both panes? The answer is that all the left-hand filter controls in DocFetcher and DocFetcher Pro form a chain of filters, with Document Types being one stage of the chain, and Custom Types another. Every document in the initial, “internal” search results has to go through the whole filter chain, and is only included in the final, visible search results if it “survives” all stages of the filter chain. This is equivalent to a logical “AND” combination of all the filter stages.

Import and export: The Custom Types feature comes with import and export functionality so you don’t have to laboriously redefine all your existing custom types when installing DocFetcher Pro in a new environment.