Before you can use lq-text to find things, you have to build an index.
This section describes how to do that,and then gives some more details on the ways in which you can configure the index.
To start with, choose a directory with some text files in it. You can add other files and directories to the index later, if you want.
The index will be a little over half the total size of all of the files; in other words, if you're going to make an index to five megabytes of text files, you should expect that index to be about two and a half to three megabytes in size.
The lqmkindex command will prompt you for the two directories you've chosen, and also ask you a few other questions. You're also given an opportunity to edit the configuration files before the index is made.
Here's an example session:
$ lqmkindex We will make a text retrieval index to all the files in a directory that you will choose. Files in subdirectories will also be indexed. You will be asked for the full path of the directory to index -- files in that directory and any subdirectories will be indexed too. You'll then be asked where to put the index. You will be given a chance to edit the configuration file, and also to say whether tests should be run or not, and then you can leave the program running. [1] Enter the full name of a directory you want to index, : /usr/man/man7 If you like, you can enter a pattern such as *.txt to restrict the index to files that match the pattern Enter a pattern, or press return to index all files: ** (index all files beneath /usr/man/man7) OK? [yes/no]: y If there's a pattern we can use with Unix sed to find a title for each file, we can do that. The titles will be displayed automatically when documents are retrieved. You can surrond part of the pattern with \(...\) to use only that part as the title of each document. The first line that matches the pattern will be used. Or, just press return to use the filename as the title. (you can edit the config files later to change this) Example (mail, news): ^Subject: *\(.*\)$ Example (HTML): ^<[tT][iI][tT][lL][eE]>\(.*\) pattern: ** Use file names as document titles OK? [yes/no]: y You should now choose a directory to contain the index. If the directory you give does not exist, LQTEXTDIR will be created in that directory. You can also enter ls to see all the files that will be indexed, or du to run the du command in the data directory, or df to run the df command. [Full path/du/ls/df] /tmp ** (directory is already there; adding LQTEXTDIR) Store the index in directory: /tmp/LQTEXTDIR OK? [yes/no]: y After making the index, you can have some tests run to check that it was OK. This may take some time. Run tests? [yes/no] y If you want, you can edit the two database configuration files before ths index is made. You don't have to change anything if you don't want to. edit config files? [yes/no] y ** generating configutation file, please wait ** press return to edit the configuration files... (the user edits the config files) Go ahead and run the index? [yes/no/bg] y **** Running tests Bye!
The simplest way to start using the index is with the lq command.
We give the command a -d option to say where the directory is that we used earlier; if you used LQTEXTDIR in your login directory, you won't need to use the -d option.
$ lq -d /tmp/LQTEXTDIR Using database in /tmp/LQTEXTDIR... | Type words or phrases to find, one per line, followed by a blank line. | Use control-D to quit. Type ? for more information. > indented paragraph man.7 == man.7 1:nce is remembered between successive indented paragraphs, and i 2:to default value upon reaching a non-indented paragraph. Default units fo 3:\&.TP \fIi\fR yes \fIi\fR=p.i. Begin indented paragraph, wit me.7 == me.7 4:s. .ti0 \&.ip \fIx y\fR no yes Start indented paragraph, with ha 5: \fB\s-1\&.IP\fR\s0 \*Y \- y,y indented paragraph, with hanging tag \*x; \*y= | Type words or phrases to find, one per line, followed by a blank line. | Use control-D to quit. Type ? for more information. > ^-D Quit