Next: Searching, Previous: Introduction, Up: Tutorial

### 1.2 Indexing

Here is a simple indexing command (‘`$`’ is the UNIX prompt):

         $ af -i -d mydb -C -v *.txt

The `-i` option indicates that we want to index files, and the list of files is expected to be at the end of the line (`*.txt`). The `-d` option specifies the database name, in this case, `mydb`. The `-C` option indicates that we want to create a new database (overwriting any existing database called `mydb`). Finally, the `-v` option tells `af` to print information about the indexing process as it goes along. (Another option, `-m`, may be added to increase the amount of memory used for indexing, which will generally reduce indexing time.)

The indexing process creates a group of files beginning with `mydb` (i.e. `mydb.db`, `mydb.dt`, and several others). These are the index files that make up the database. We can use the `af` tool with this database to search the files we have indexed.

Note: As an optional step after indexing, the database can be linearized. In the example above, this would be done with the command, `af -L -d mydb`. Linearizing improves search time but has the disadvantage of being a very slow process. Another disadvantage is that it fixes the database so that no more documents can be added.