4.4 Mappings ¶
Mappings in p-search serve the purpose of modifying documents created
by candidate generators. Mappings can be used in a number of situations:
- They can be used to extract data from the content as special fields. For example, extracting an author or publication date from a document’s front matter.
- They can be used as filters. For example, filtering files that are considered Denote notes.
- They can be used to split a document into smaller sub documents. For example, they can split a source file by function definitions.
- They can replace the document entirely with a more detailed representation. For example, a mapping could replace a PDF file’s binary contents with a markdown representation of the PDF.
The more specialized you want to create your search engine, the more
likely you will need to use mappings. If you are using p-search as a
more intelligent grep however, you will likely not need mappings.
It is also likely that a pre-existing mapping will not suit your needs
and would will have to create a new one. This is explained a later
chapter (see Creating Mappings).