home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume27 / qt / part01 next >
SHell self-extracting ARchive  |  1993-10-18  |  68.9 KB

view JSON data     |     view as text     |     open on a Mac     |     open on a PC

This file was processed as: SHell self-extracting ARchive (archive/shar).

You can browse this item here: part01

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert SHell self-extracting ARchive (archive/shar) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/329 Shell Archive Format default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 4e 65 77 73 67 72 6f 75 | 70 73 3a 20 63 6f 6d 70 |Newsgrou|ps: comp|
|00000010| 2e 73 6f 75 72 63 65 73 | 2e 75 6e 69 78 0a 46 72 |.sources|.unix.Fr|
|00000020| 6f 6d 3a 20 6a 6f 68 6e | 40 6a 6f 68 6e 63 6f 6e |om: john|@johncon|
|00000030| 2e 63 6f 6d 20 28 4a 6f | 68 6e 20 43 6f 6e 6f 76 |.com (Jo|hn Conov|
|00000040| 65 72 29 0a 53 75 62 6a | 65 63 74 3a 20 76 32 37 |er).Subj|ect: v27|
|00000050| 69 30 37 35 3a 20 71 74 | 20 2d 20 66 75 6c 6c 2d |i075: qt| - full-|
|00000060| 74 65 78 74 20 72 65 74 | 72 69 65 76 61 6c 20 70 |text ret|rieval p|
|00000070| 72 6f 67 72 61 6d 2c 20 | 50 61 72 74 30 31 2f 30 |rogram, |Part01/0|
|00000080| 31 0a 4d 65 73 73 61 67 | 65 2d 69 64 3a 20 3c 31 |1.Messag|e-id: <1|
|00000090| 2e 37 35 30 39 38 34 38 | 37 30 2e 31 32 36 38 36 |.7509848|70.12686|
|000000a0| 40 67 77 2e 68 6f 6d 65 | 2e 76 69 78 2e 63 6f 6d |@gw.home|.vix.com|
|000000b0| 3e 0a 53 65 6e 64 65 72 | 3a 20 75 6e 69 78 2d 73 |>.Sender|: unix-s|
|000000c0| 6f 75 72 63 65 73 2d 6d | 6f 64 65 72 61 74 6f 72 |ources-m|oderator|
|000000d0| 40 67 77 2e 68 6f 6d 65 | 2e 76 69 78 2e 63 6f 6d |@gw.home|.vix.com|
|000000e0| 0a 41 70 70 72 6f 76 65 | 64 3a 20 76 69 78 69 65 |.Approve|d: vixie|
|000000f0| 40 67 77 2e 68 6f 6d 65 | 2e 76 69 78 2e 63 6f 6d |@gw.home|.vix.com|
|00000100| 0a 0a 53 75 62 6d 69 74 | 74 65 64 2d 42 79 3a 20 |..Submit|ted-By: |
|00000110| 6a 6f 68 6e 40 6a 6f 68 | 6e 63 6f 6e 2e 63 6f 6d |john@joh|ncon.com|
|00000120| 20 28 4a 6f 68 6e 20 43 | 6f 6e 6f 76 65 72 29 0a | (John C|onover).|
|00000130| 50 6f 73 74 69 6e 67 2d | 4e 75 6d 62 65 72 3a 20 |Posting-|Number: |
|00000140| 56 6f 6c 75 6d 65 20 32 | 37 2c 20 49 73 73 75 65 |Volume 2|7, Issue|
|00000150| 20 37 35 0a 41 72 63 68 | 69 76 65 2d 4e 61 6d 65 | 75.Arch|ive-Name|
|00000160| 3a 20 71 74 2f 70 61 72 | 74 30 31 0a 0a 51 74 20 |: qt/par|t01..Qt |
|00000170| 73 74 61 6e 64 73 20 66 | 6f 72 20 51 75 65 72 79 |stands f|or Query|
|00000180| 20 54 65 78 74 2c 20 61 | 20 74 65 78 74 20 69 6e | Text, a| text in|
|00000190| 66 6f 72 6d 61 74 69 6f | 6e 20 72 65 74 72 69 65 |formatio|n retrie|
|000001a0| 76 61 6c 20 73 79 73 74 | 65 6d 2e 20 51 74 0a 63 |val syst|em. Qt.c|
|000001b0| 72 65 61 74 65 73 2c 20 | 6d 61 69 6e 74 61 69 6e |reates, |maintain|
|000001c0| 73 2c 20 61 6e 64 20 71 | 75 65 72 69 65 73 20 61 |s, and q|ueries a|
|000001d0| 20 66 75 6c 6c 20 74 65 | 78 74 20 64 61 74 61 62 | full te|xt datab|
|000001e0| 61 73 65 2e 20 54 68 65 | 20 64 61 74 61 62 61 73 |ase. The| databas|
|000001f0| 65 0a 66 69 6c 65 20 73 | 79 73 74 65 6d 20 69 73 |e.file s|ystem is|
|00000200| 20 6f 72 67 61 6e 69 7a | 65 64 20 61 73 20 61 6e | organiz|ed as an|
|00000210| 20 69 6e 76 65 72 74 65 | 64 20 69 6e 64 65 78 2e | inverte|d index.|
|00000220| 20 54 68 65 20 70 72 6f | 67 72 61 6d 20 69 73 20 | The pro|gram is |
|00000230| 77 72 69 74 74 65 6e 0a | 61 73 20 61 20 73 69 6e |written.|as a sin|
|00000240| 67 6c 65 20 73 63 72 69 | 70 74 2c 20 69 6e 20 42 |gle scri|pt, in B|
|00000250| 6f 75 72 6e 65 20 53 68 | 65 6c 6c 2c 20 61 6e 64 |ourne Sh|ell, and|
|00000260| 20 70 65 72 6d 69 74 73 | 20 73 69 6d 70 6c 65 20 | permits| simple |
|00000270| 6e 61 74 75 72 61 6c 0a | 6c 61 6e 67 75 61 67 65 |natural.|language|
|00000280| 20 71 75 65 72 69 65 73 | 2e 0a 0a 45 6e 76 69 72 | queries|...Envir|
|00000290| 6f 6e 6d 65 6e 74 3a 20 | 55 6e 69 78 2c 20 53 79 |onment: |Unix, Sy|
|000002a0| 73 56 2e 20 72 65 6c 2e | 20 34 2e 78 2c 20 52 36 |sV. rel.| 4.x, R6|
|000002b0| 30 30 30 2c 20 44 45 43 | 20 41 4c 50 48 41 20 33 |000, DEC| ALPHA 3|
|000002c0| 30 30 30 2c 20 6f 74 68 | 65 72 73 2e 0a 0a 09 6a |000, oth|ers....j|
|000002d0| 6f 68 6e 40 6a 6f 68 6e | 63 6f 6e 2e 63 6f 6d 0a |ohn@john|con.com.|
|000002e0| 0a 23 21 2f 62 69 6e 2f | 73 68 0a 23 20 54 68 69 |.#!/bin/|sh.# Thi|
|000002f0| 73 20 69 73 20 61 20 73 | 68 65 6c 6c 20 61 72 63 |s is a s|hell arc|
|00000300| 68 69 76 65 20 28 70 72 | 6f 64 75 63 65 64 20 62 |hive (pr|oduced b|
|00000310| 79 20 73 68 61 72 20 33 | 2e 34 39 29 0a 23 20 54 |y shar 3|.49).# T|
|00000320| 6f 20 65 78 74 72 61 63 | 74 20 74 68 65 20 66 69 |o extrac|t the fi|
|00000330| 6c 65 73 20 66 72 6f 6d | 20 74 68 69 73 20 61 72 |les from| this ar|
|00000340| 63 68 69 76 65 2c 20 73 | 61 76 65 20 69 74 20 74 |chive, s|ave it t|
|00000350| 6f 20 61 20 66 69 6c 65 | 2c 20 72 65 6d 6f 76 65 |o a file|, remove|
|00000360| 0a 23 20 65 76 65 72 79 | 74 68 69 6e 67 20 61 62 |.# every|thing ab|
|00000370| 6f 76 65 20 74 68 65 20 | 22 21 2f 62 69 6e 2f 73 |ove the |"!/bin/s|
|00000380| 68 22 20 6c 69 6e 65 20 | 61 62 6f 76 65 2c 20 61 |h" line |above, a|
|00000390| 6e 64 20 74 79 70 65 20 | 22 73 68 20 66 69 6c 65 |nd type |"sh file|
|000003a0| 5f 6e 61 6d 65 22 2e 0a | 23 0a 23 20 6d 61 64 65 |_name"..|#.# made|
|000003b0| 20 30 39 2f 31 36 2f 31 | 39 39 33 20 30 32 3a 35 | 09/16/1|993 02:5|
|000003c0| 38 20 55 54 43 20 62 79 | 20 6a 6f 68 6e 40 6a 6f |8 UTC by| john@jo|
|000003d0| 68 6e 63 6f 6e 0a 23 20 | 53 6f 75 72 63 65 20 64 |hncon.# |Source d|
|000003e0| 69 72 65 63 74 6f 72 79 | 20 2f 68 6f 6d 65 2f 6a |irectory| /home/j|
|000003f0| 6f 68 6e 0a 23 0a 23 20 | 65 78 69 73 74 69 6e 67 |ohn.#.# |existing|
|00000400| 20 66 69 6c 65 73 20 77 | 69 6c 6c 20 4e 4f 54 20 | files w|ill NOT |
|00000410| 62 65 20 6f 76 65 72 77 | 72 69 74 74 65 6e 20 75 |be overw|ritten u|
|00000420| 6e 6c 65 73 73 20 2d 63 | 20 69 73 20 73 70 65 63 |nless -c| is spec|
|00000430| 69 66 69 65 64 0a 23 0a | 23 20 54 68 69 73 20 73 |ified.#.|# This s|
|00000440| 68 61 72 20 63 6f 6e 74 | 61 69 6e 73 3a 0a 23 20 |har cont|ains:.# |
|00000450| 6c 65 6e 67 74 68 20 20 | 6d 6f 64 65 20 20 20 20 |length |mode |
|00000460| 20 20 20 6e 61 6d 65 0a | 23 20 2d 2d 2d 2d 2d 2d | name.|# ------|
|00000470| 20 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 20 2d 2d 2d 2d | -------|--- ----|
|00000480| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000490| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000004a0| 2d 2d 2d 2d 2d 2d 0a 23 | 20 20 36 35 34 30 34 20 |------.#| 65404 |
|000004b0| 2d 72 77 78 72 77 2d 72 | 77 2d 20 71 74 2f 71 74 |-rwxrw-r|w- qt/qt|
|000004c0| 0a 23 20 20 20 31 38 34 | 34 20 2d 72 77 2d 72 2d |.# 184|4 -rw-r-|
|000004d0| 2d 72 2d 2d 20 71 74 2f | 52 45 41 44 4d 45 0a 23 |-r-- qt/|README.#|
|000004e0| 0a 23 20 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |.# =====|========|
|000004f0| 20 71 74 2f 71 74 20 3d | 3d 3d 3d 3d 3d 3d 3d 3d | qt/qt =|========|
|00000500| 3d 3d 3d 3d 3d 0a 69 66 | 20 74 65 73 74 20 21 20 |=====.if| test ! |
|00000510| 2d 64 20 27 71 74 27 3b | 20 74 68 65 6e 0a 20 20 |-d 'qt';| then. |
|00000520| 20 20 65 63 68 6f 20 27 | 78 20 2d 20 63 72 65 61 | echo '|x - crea|
|00000530| 74 69 6e 67 20 64 69 72 | 65 63 74 6f 72 79 20 71 |ting dir|ectory q|
|00000540| 74 27 0a 20 20 20 20 6d | 6b 64 69 72 20 27 71 74 |t'. m|kdir 'qt|
|00000550| 27 0a 66 69 0a 69 66 20 | 74 65 73 74 20 2d 66 20 |'.fi.if |test -f |
|00000560| 27 71 74 2f 71 74 27 20 | 2d 61 20 58 22 24 31 22 |'qt/qt' |-a X"$1"|
|00000570| 20 21 3d 20 58 22 2d 63 | 22 3b 20 74 68 65 6e 0a | != X"-c|"; then.|
|00000580| 09 65 63 68 6f 20 27 78 | 20 2d 20 73 6b 69 70 70 |.echo 'x| - skipp|
|00000590| 69 6e 67 20 71 74 2f 71 | 74 20 28 46 69 6c 65 20 |ing qt/q|t (File |
|000005a0| 61 6c 72 65 61 64 79 20 | 65 78 69 73 74 73 29 27 |already |exists)'|
|000005b0| 0a 65 6c 73 65 0a 65 63 | 68 6f 20 27 78 20 2d 20 |.else.ec|ho 'x - |
|000005c0| 65 78 74 72 61 63 74 69 | 6e 67 20 71 74 2f 71 74 |extracti|ng qt/qt|
|000005d0| 20 28 54 65 78 74 29 27 | 0a 73 65 64 20 27 73 2f | (Text)'|.sed 's/|
|000005e0| 5e 58 2f 2f 27 20 3c 3c | 20 27 53 48 41 52 5f 45 |^X//' <<| 'SHAR_E|
|000005f0| 4f 46 27 20 3e 20 27 71 | 74 2f 71 74 27 20 26 26 |OF' > 'q|t/qt' &&|
|00000600| 0a 23 21 2f 62 69 6e 2f | 73 68 0a 23 0a 56 45 52 |.#!/bin/|sh.#.VER|
|00000610| 53 49 4f 4e 3d 22 71 74 | 20 2d 20 56 65 72 73 69 |SION="qt| - Versi|
|00000620| 6f 6e 20 30 2e 31 2e 20 | 28 71 74 20 2d 68 2c 20 |on 0.1. |(qt -h, |
|00000630| 66 6f 72 20 64 65 73 63 | 72 69 70 74 69 6f 6e 20 |for desc|ription |
|00000640| 61 6e 64 20 68 65 6c 70 | 2e 29 22 0a 23 0a 23 20 |and help|.)".#.# |
|00000650| 51 74 20 73 74 61 6e 64 | 73 20 66 6f 72 20 51 75 |Qt stand|s for Qu|
|00000660| 65 72 79 20 54 65 78 74 | 2c 20 61 20 74 65 78 74 |ery Text|, a text|
|00000670| 20 69 6e 66 6f 72 6d 61 | 74 69 6f 6e 20 72 65 74 | informa|tion ret|
|00000680| 72 69 65 76 61 6c 20 73 | 79 73 74 65 6d 2e 20 51 |rieval s|ystem. Q|
|00000690| 74 0a 23 20 63 72 65 61 | 74 65 73 2c 20 6d 61 69 |t.# crea|tes, mai|
|000006a0| 6e 74 61 69 6e 73 2c 20 | 61 6e 64 20 71 75 65 72 |ntains, |and quer|
|000006b0| 69 65 73 20 61 20 66 75 | 6c 6c 20 74 65 78 74 20 |ies a fu|ll text |
|000006c0| 64 61 74 61 62 61 73 65 | 2e 20 54 68 65 20 64 61 |database|. The da|
|000006d0| 74 61 62 61 73 65 0a 23 | 20 66 69 6c 65 20 73 79 |tabase.#| file sy|
|000006e0| 73 74 65 6d 20 69 73 20 | 6f 72 67 61 6e 69 7a 65 |stem is |organize|
|000006f0| 64 20 61 73 20 61 6e 20 | 69 6e 76 65 72 74 65 64 |d as an |inverted|
|00000700| 20 69 6e 64 65 78 2e 20 | 54 68 65 20 70 72 6f 67 | index. |The prog|
|00000710| 72 61 6d 20 69 73 20 77 | 72 69 74 74 65 6e 0a 23 |ram is w|ritten.#|
|00000720| 20 61 73 20 61 20 73 69 | 6e 67 6c 65 20 73 63 72 | as a si|ngle scr|
|00000730| 69 70 74 2c 20 69 6e 20 | 42 6f 75 72 6e 65 20 53 |ipt, in |Bourne S|
|00000740| 68 65 6c 6c 2c 20 61 6e | 64 20 70 65 72 6d 69 74 |hell, an|d permit|
|00000750| 73 20 73 69 6d 70 6c 65 | 20 6e 61 74 75 72 61 6c |s simple| natural|
|00000760| 0a 23 20 6c 61 6e 67 75 | 61 67 65 20 71 75 65 72 |.# langu|age quer|
|00000770| 69 65 73 2e 0a 23 0a 23 | 20 41 73 20 61 20 73 69 |ies..#.#| As a si|
|00000780| 6d 70 6c 65 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |mple app|lication|
|00000790| 20 65 78 61 6d 70 6c 65 | 2c 20 74 68 69 73 20 70 | example|, this p|
|000007a0| 72 6f 67 72 61 6d 20 63 | 61 6e 20 62 65 20 75 73 |rogram c|an be us|
|000007b0| 65 64 20 74 6f 20 73 65 | 61 72 63 68 0a 23 20 74 |ed to se|arch.# t|
|000007c0| 68 65 20 22 63 61 74 6d | 61 6e 22 20 70 61 67 65 |he "catm|an" page|
|000007d0| 73 20 66 6f 72 20 61 20 | 63 6f 6d 6d 61 6e 64 20 |s for a |command |
|000007e0| 74 68 61 74 20 70 65 72 | 66 6f 72 6d 73 20 61 20 |that per|forms a |
|000007f0| 73 70 65 63 69 66 69 63 | 20 66 75 6e 63 74 69 6f |specific| functio|
|00000800| 6e 2c 0a 23 20 65 76 65 | 6e 20 74 68 6f 75 67 68 |n,.# eve|n though|
|00000810| 20 74 68 65 20 63 6f 6d | 6d 61 6e 64 27 73 20 6e | the com|mand's n|
|00000820| 61 6d 65 20 69 73 20 6e | 6f 74 20 6b 6e 6f 77 6e |ame is n|ot known|
|00000830| 2d 65 2e 67 2e 2c 20 69 | 66 20 79 6f 75 20 6b 6e |-e.g., i|f you kn|
|00000840| 65 77 20 77 68 61 74 0a | 23 20 79 6f 75 20 77 61 |ew what.|# you wa|
|00000850| 6e 74 65 64 20 74 6f 20 | 64 6f 2c 20 79 6f 75 20 |nted to |do, you |
|00000860| 63 6f 75 6c 64 20 66 69 | 6e 64 20 74 68 65 20 63 |could fi|nd the c|
|00000870| 6f 6d 6d 61 6e 64 20 74 | 68 61 74 20 77 6f 75 6c |ommand t|hat woul|
|00000880| 64 20 64 6f 20 69 74 2e | 0a 23 0a 23 20 54 68 65 |d do it.|.#.# The|
|00000890| 20 70 72 6f 67 72 61 6d | 2c 20 71 74 2c 20 69 73 | program|, qt, is|
|000008a0| 20 66 72 65 65 20 73 6f | 66 74 77 61 72 65 2c 20 | free so|ftware, |
|000008b0| 61 6e 64 20 63 61 6e 20 | 62 65 20 72 65 64 69 73 |and can |be redis|
|000008c0| 74 72 69 62 75 74 65 64 | 20 61 6e 64 2f 6f 72 0a |tributed| and/or.|
|000008d0| 23 20 6d 6f 64 69 66 69 | 65 64 2c 20 77 69 74 68 |# modifi|ed, with|
|000008e0| 6f 75 74 20 61 6e 79 20 | 72 65 73 74 72 69 63 74 |out any |restrict|
|000008f0| 69 6f 6e 73 2e 20 49 74 | 20 69 73 20 64 69 73 74 |ions. It| is dist|
|00000900| 72 69 62 75 74 65 64 20 | 77 69 74 68 20 6e 6f 0a |ributed |with no.|
|00000910| 23 20 77 61 72 72 61 6e | 74 79 20 6f 66 20 61 6e |# warran|ty of an|
|00000920| 79 20 6b 69 6e 64 2c 20 | 69 6d 70 6c 69 65 64 20 |y kind, |implied |
|00000930| 6f 72 20 6f 74 68 65 72 | 77 69 73 65 2e 20 20 53 |or other|wise. S|
|00000940| 70 65 63 69 66 69 63 61 | 6c 6c 79 2c 20 74 68 65 |pecifica|lly, the|
|00000950| 72 65 20 69 73 0a 23 20 | 6e 6f 20 77 61 72 72 61 |re is.# |no warra|
|00000960| 6e 74 79 20 6f 66 20 66 | 69 74 6e 65 73 73 20 66 |nty of f|itness f|
|00000970| 6f 72 20 61 6e 79 20 70 | 61 72 74 69 63 75 6c 61 |or any p|articula|
|00000980| 72 20 70 75 72 70 6f 73 | 65 20 61 6e 64 2f 6f 72 |r purpos|e and/or|
|00000990| 0a 23 20 6d 65 72 63 68 | 61 6e 74 61 62 69 6c 69 |.# merch|antabili|
|000009a0| 74 79 2e 0a 23 0a 23 20 | 43 6f 6d 6d 65 6e 74 73 |ty..#.# |Comments|
|000009b0| 20 61 6e 64 2f 6f 72 20 | 62 75 67 20 72 65 70 6f | and/or |bug repo|
|000009c0| 72 74 73 20 73 68 6f 75 | 6c 64 20 62 65 20 61 64 |rts shou|ld be ad|
|000009d0| 64 72 65 73 73 65 64 20 | 74 6f 3a 0a 23 0a 23 09 |dressed |to:.#.#.|
|000009e0| 6a 6f 68 6e 40 6a 6f 68 | 6e 63 6f 6e 2e 63 6f 6d |john@joh|ncon.com|
|000009f0| 20 28 4a 6f 68 6e 20 43 | 6f 6e 6f 76 65 72 29 0a | (John C|onover).|
|00000a00| 23 0a 23 20 4b 6e 6f 77 | 6e 20 63 61 76 65 61 74 |#.# Know|n caveat|
|00000a10| 73 3a 20 54 68 65 72 65 | 20 69 73 20 6e 6f 20 63 |s: There| is no c|
|00000a20| 6f 6e 63 75 72 72 65 6e | 63 79 20 63 6f 6e 74 72 |oncurren|cy contr|
|00000a30| 6f 6c 2d 69 74 20 77 6f | 75 6c 64 20 62 65 0a 23 |ol-it wo|uld be.#|
|00000a40| 20 69 6c 6c 2d 61 64 76 | 69 73 65 64 20 74 6f 20 | ill-adv|ised to |
|00000a50| 75 73 65 20 74 68 69 73 | 20 70 72 6f 67 72 61 6d |use this| program|
|00000a60| 20 61 73 20 61 20 63 6f | 6e 63 75 72 72 65 6e 74 | as a co|ncurrent|
|00000a70| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 2e 0a 23 20 | applica|tion..# |
|00000a80| 41 64 64 69 74 69 6f 6e | 61 6c 6c 79 2c 20 74 68 |Addition|ally, th|
|00000a90| 65 20 6e 61 74 75 72 61 | 6c 20 6c 61 6e 67 75 61 |e natura|l langua|
|00000aa0| 67 65 20 71 75 65 72 79 | 20 64 6f 65 73 20 6e 6f |ge query| does no|
|00000ab0| 74 20 73 75 70 70 6f 72 | 74 20 67 72 6f 75 70 69 |t suppor|t groupi|
|00000ac0| 6e 67 0a 23 20 6f 70 65 | 72 61 74 6f 72 73 2e 0a |ng.# ope|rators..|
|00000ad0| 23 0a 23 20 46 6f 72 20 | 61 20 71 75 69 63 6b 20 |#.# For |a quick |
|00000ae0| 73 74 61 72 74 2c 20 65 | 78 65 63 75 74 65 20 71 |start, e|xecute q|
|00000af0| 74 20 2d 68 20 66 6f 72 | 20 68 65 6c 70 2c 20 77 |t -h for| help, w|
|00000b00| 68 69 63 68 20 6d 61 79 | 20 62 65 20 72 65 2d 64 |hich may| be re-d|
|00000b10| 69 72 65 63 74 65 64 20 | 74 6f 0a 23 20 73 74 64 |irected |to.# std|
|00000b20| 69 6f 2e 20 41 74 20 74 | 68 65 20 22 74 61 69 6c |io. At t|he "tail|
|00000b30| 20 2d 32 33 22 20 6f 66 | 20 74 68 69 73 20 68 65 | -23" of| this he|
|00000b40| 6c 70 20 66 69 6c 65 20 | 61 72 65 20 73 6f 6d 65 |lp file |are some|
|00000b50| 20 73 69 6d 70 6c 65 20 | 63 6f 6d 6d 61 6e 64 73 | simple |commands|
|00000b60| 20 74 6f 0a 23 20 65 76 | 61 6c 75 61 74 65 20 74 | to.# ev|aluate t|
|00000b70| 68 69 73 20 73 63 72 69 | 70 74 2e 0a 23 0a 23 20 |his scri|pt..#.# |
|00000b80| 49 6e 73 74 61 6c 6c 61 | 74 69 6f 6e 3a 0a 23 0a |Installa|tion:.#.|
|00000b90| 23 20 54 68 65 20 63 6f | 6d 6d 65 6e 74 73 20 69 |# The co|mments i|
|00000ba0| 6e 20 74 68 69 73 20 73 | 63 72 69 70 74 20 61 72 |n this s|cript ar|
|00000bb0| 65 20 76 65 72 62 6f 73 | 65 2c 20 61 6e 64 20 73 |e verbos|e, and s|
|00000bc0| 68 6f 75 6c 64 20 62 65 | 20 73 74 72 69 70 70 65 |hould be| strippe|
|00000bd0| 64 20 70 72 69 6f 72 0a | 23 20 74 6f 20 61 6e 79 |d prior.|# to any|
|00000be0| 20 69 6e 73 74 61 6c 6c | 61 74 69 6f 6e 20 77 69 | install|ation wi|
|00000bf0| 74 68 20 73 6f 6d 65 74 | 68 69 6e 67 20 6c 69 6b |th somet|hing lik|
|00000c00| 65 3a 0a 23 0a 23 09 73 | 65 64 20 27 2f 5e 20 2a |e:.#.#.s|ed '/^ *|
|00000c10| 23 2f 64 3b 2f 5e 24 2f | 64 27 20 71 74 20 3e 20 |#/d;/^$/|d' qt > |
|00000c20| 71 74 2e 6e 65 77 0a 23 | 0a 23 20 61 6e 64 20 69 |qt.new.#|.# and i|
|00000c30| 6e 73 74 61 6c 6c 69 6e | 67 20 71 74 2e 6e 65 77 |nstallin|g qt.new|
|00000c40| 20 61 73 20 71 74 20 69 | 6e 20 74 68 65 20 65 78 | as qt i|n the ex|
|00000c50| 65 63 75 74 61 62 6c 65 | 20 70 61 74 68 2e 20 4c |ecutable| path. L|
|00000c60| 69 6b 65 77 69 73 65 2c | 0a 23 20 70 6f 73 73 69 |ikewise,|.# possi|
|00000c70| 62 6c 79 2c 20 74 68 65 | 20 66 75 6e 63 74 69 6f |bly, the| functio|
|00000c80| 6e 2c 20 68 65 6c 70 28 | 29 2c 20 73 68 6f 75 6c |n, help(|), shoul|
|00000c90| 64 20 62 65 20 65 6c 69 | 6d 69 6e 61 74 65 64 2e |d be eli|minated.|
|00000ca0| 09 20 54 68 65 20 66 75 | 6e 63 74 69 6f 6e 2c 0a |. The fu|nction,.|
|00000cb0| 23 20 66 69 6e 64 5f 70 | 72 6f 67 72 61 6d 28 29 |# find_p|rogram()|
|00000cc0| 2c 20 69 73 20 6e 6f 74 | 20 65 66 66 69 63 69 65 |, is not| efficie|
|00000cd0| 6e 74 20 61 6e 64 20 73 | 68 6f 75 6c 64 20 62 65 |nt and s|hould be|
|00000ce0| 20 65 6c 69 6d 69 6e 61 | 74 65 64 2c 20 62 79 20 | elimina|ted, by |
|00000cf0| 68 61 72 64 0a 23 20 63 | 6f 64 69 6e 67 20 74 68 |hard.# c|oding th|
|00000d00| 65 20 70 61 74 68 73 20 | 74 6f 20 74 68 65 20 76 |e paths |to the v|
|00000d10| 61 72 69 6f 75 73 20 70 | 72 6f 67 72 61 6d 73 20 |arious p|rograms |
|00000d20| 69 6e 20 79 6f 75 72 20 | 73 79 73 74 65 6d 2e 20 |in your |system. |
|00000d30| 20 54 68 65 72 65 20 61 | 72 65 0a 23 20 74 61 62 | There a|re.# tab|
|00000d40| 20 63 68 61 72 61 63 74 | 65 72 73 20 75 73 65 64 | charact|ers used|
|00000d50| 20 69 6e 20 74 68 69 73 | 20 73 63 72 69 70 74 2c | in this| script,|
|00000d60| 20 28 77 68 69 63 68 20 | 61 72 65 20 72 65 66 65 | (which |are refe|
|00000d70| 72 65 6e 63 65 64 20 61 | 73 20 74 68 65 0a 23 20 |renced a|s the.# |
|00000d80| 76 61 72 69 61 62 6c 65 | 2c 20 22 24 7b 54 41 42 |variable|, "${TAB|
|00000d90| 7d 22 29 20 72 65 71 75 | 69 72 69 6e 67 20 74 68 |}") requ|iring th|
|00000da0| 61 74 20 74 68 65 20 73 | 63 72 69 70 74 20 62 65 |at the s|cript be|
|00000db0| 20 73 61 76 65 64 20 77 | 69 74 68 20 74 61 62 73 | saved w|ith tabs|
|00000dc0| 2e 0a 23 0a 23 20 41 70 | 70 6c 69 63 61 62 69 6c |..#.# Ap|plicabil|
|00000dd0| 69 74 79 3a 0a 23 0a 23 | 20 41 70 70 6c 69 63 61 |ity:.#.#| Applica|
|00000de0| 62 69 6c 69 74 79 20 6f | 66 20 71 74 20 76 61 72 |bility o|f qt var|
|00000df0| 69 65 73 20 6f 6e 20 63 | 6f 6d 70 6c 65 78 69 74 |ies on c|omplexit|
|00000e00| 79 20 6f 66 20 73 65 61 | 72 63 68 2c 20 73 69 7a |y of sea|rch, siz|
|00000e10| 65 20 6f 66 20 64 61 74 | 61 62 61 73 65 2c 0a 23 |e of dat|abase,.#|
|00000e20| 20 73 70 65 65 64 20 6f | 66 20 68 6f 73 74 20 65 | speed o|f host e|
|00000e30| 6e 76 69 72 6f 6e 6d 65 | 6e 74 2c 20 65 74 63 2e |nvironme|nt, etc.|
|00000e40| 2c 20 68 6f 77 65 76 65 | 72 2c 20 61 73 20 73 6f |, howeve|r, as so|
|00000e50| 6d 65 20 67 65 6e 65 72 | 61 6c 20 67 75 69 64 65 |me gener|al guide|
|00000e60| 6c 69 6e 65 73 3a 0a 23 | 0a 23 09 31 29 20 46 6f |lines:.#|.#.1) Fo|
|00000e70| 72 20 74 65 78 74 20 66 | 69 6c 65 73 20 77 69 74 |r text f|iles wit|
|00000e80| 68 20 61 20 74 6f 74 61 | 6c 20 73 69 7a 65 20 6f |h a tota|l size o|
|00000e90| 66 20 6c 65 73 73 20 74 | 68 61 6e 20 35 20 4d 42 |f less t|han 5 MB|
|00000ea0| 2c 0a 23 09 73 74 61 6e | 64 61 72 64 20 65 67 72 |,.#.stan|dard egr|
|00000eb0| 65 70 28 31 29 20 71 75 | 65 72 69 65 73 20 6f 66 |ep(1) qu|eries of|
|00000ec0| 20 74 68 65 20 74 65 78 | 74 20 66 69 6c 65 73 20 | the tex|t files |
|00000ed0| 77 69 6c 6c 20 70 72 6f | 62 61 62 6c 79 0a 23 09 |will pro|bably.#.|
|00000ee0| 70 72 6f 76 65 20 61 64 | 65 71 75 61 74 65 2e 0a |prove ad|equate..|
|00000ef0| 23 0a 23 09 32 29 20 46 | 6f 72 20 74 65 78 74 20 |#.#.2) F|or text |
|00000f00| 66 69 6c 65 73 20 77 69 | 74 68 20 61 20 74 6f 74 |files wi|th a tot|
|00000f10| 61 6c 20 73 69 7a 65 20 | 6f 66 20 35 20 4d 42 20 |al size |of 5 MB |
|00000f20| 74 6f 20 35 30 20 4d 42 | 2c 20 71 74 20 73 65 65 |to 50 MB|, qt see|
|00000f30| 6d 73 0a 23 09 61 64 65 | 71 75 61 74 65 20 66 6f |ms.#.ade|quate fo|
|00000f40| 72 20 6d 6f 73 74 20 71 | 75 65 72 69 65 73 2e 20 |r most q|ueries. |
|00000f50| 54 68 65 20 73 69 67 6e | 69 66 69 63 61 6e 74 20 |The sign|ificant |
|00000f60| 69 73 73 75 65 20 69 73 | 20 74 68 61 74 2c 0a 23 |issue is| that,.#|
|00000f70| 09 61 6c 74 68 6f 75 67 | 68 20 74 68 65 20 72 65 |.althoug|h the re|
|00000f80| 74 72 69 65 76 61 6c 20 | 65 78 65 63 75 74 69 6f |trieval |executio|
|00000f90| 6e 20 74 69 6d 65 73 20 | 61 72 65 20 70 72 6f 62 |n times |are prob|
|00000fa0| 61 62 6c 79 20 61 64 65 | 71 75 61 74 65 0a 23 09 |ably ade|quate.#.|
|00000fb0| 77 69 74 68 20 71 74 2c | 20 74 68 65 20 64 61 74 |with qt,| the dat|
|00000fc0| 61 62 61 73 65 20 77 72 | 69 74 65 20 74 69 6d 65 |abase wr|ite time|
|00000fd0| 73 20 61 72 65 20 6e 6f | 74 20 69 6d 70 72 65 73 |s are no|t impres|
|00000fe0| 73 69 76 65 2e 0a 23 0a | 23 09 33 29 20 46 6f 72 |sive..#.|#.3) For|
|00000ff0| 20 74 65 78 74 20 66 69 | 6c 65 73 20 77 69 74 68 | text fi|les with|
|00001000| 20 61 20 74 6f 74 61 6c | 20 73 69 7a 65 20 74 68 | a total| size th|
|00001010| 61 74 20 69 73 20 6c 61 | 72 67 65 72 20 74 68 61 |at is la|rger tha|
|00001020| 6e 20 35 30 20 4d 42 2c | 0a 23 09 6f 72 20 77 68 |n 50 MB,|.#.or wh|
|00001030| 65 72 65 20 63 6f 6e 63 | 75 72 72 65 6e 63 79 20 |ere conc|urrency |
|00001040| 69 73 20 61 6e 20 69 73 | 73 75 65 2c 20 69 74 20 |is an is|sue, it |
|00001050| 77 6f 75 6c 64 20 62 65 | 20 61 70 70 72 6f 70 72 |would be| appropr|
|00001060| 69 61 74 65 20 74 6f 0a | 23 09 63 6f 6e 73 69 64 |iate to.|#.consid|
|00001070| 65 72 20 6f 6e 65 20 6f | 66 20 74 68 65 20 61 6c |er one o|f the al|
|00001080| 74 65 72 6e 61 74 69 76 | 65 73 20 6c 69 73 74 65 |ternativ|es liste|
|00001090| 64 20 69 6e 20 22 52 65 | 6c 61 74 65 64 0a 23 09 |d in "Re|lated.#.|
|000010a0| 69 6e 66 6f 72 6d 61 74 | 69 6f 6e 20 72 65 74 72 |informat|ion retr|
|000010b0| 69 65 76 61 6c 20 73 6f | 66 74 77 61 72 65 3a 2c |ieval so|ftware:,|
|000010c0| 22 20 62 65 6c 6f 77 2e | 0a 23 0a 23 20 52 65 66 |" below.|.#.# Ref|
|000010d0| 65 72 65 6e 63 65 73 3a | 0a 23 0a 23 09 31 29 20 |erences:|.#.#.1) |
|000010e0| 22 49 6e 66 6f 72 6d 61 | 74 69 6f 6e 20 52 65 74 |"Informa|tion Ret|
|000010f0| 72 69 65 76 61 6c 2c 20 | 44 61 74 61 20 53 74 72 |rieval, |Data Str|
|00001100| 75 63 74 75 72 65 73 20 | 26 20 41 6c 67 6f 72 69 |uctures |& Algori|
|00001110| 74 68 6d 73 2c 22 0a 23 | 09 57 69 6c 6c 69 61 6d |thms,".#|.William|
|00001120| 20 42 2e 20 46 72 61 6b | 65 73 2c 20 52 69 63 61 | B. Frak|es, Rica|
|00001130| 72 64 6f 20 42 61 65 7a | 61 2d 59 61 74 65 73 2c |rdo Baez|a-Yates,|
|00001140| 20 45 64 69 74 6f 72 73 | 2c 20 50 72 65 6e 74 69 | Editors|, Prenti|
|00001150| 63 65 0a 23 09 48 61 6c | 6c 2c 20 45 6e 67 6c 65 |ce.#.Hal|l, Engle|
|00001160| 77 6f 6f 64 20 43 6c 69 | 66 66 73 2c 20 4e 65 77 |wood Cli|ffs, New|
|00001170| 20 4a 65 72 73 65 79 20 | 30 37 36 33 32 2c 20 31 | Jersey |07632, 1|
|00001180| 39 39 32 2c 20 49 53 42 | 4e 0a 23 09 30 2d 31 33 |992, ISB|N.#.0-13|
|00001190| 2d 34 36 33 38 33 37 2d | 39 2e 0a 23 0a 23 09 54 |-463837-|9..#.#.T|
|000011a0| 68 65 20 73 6f 75 72 63 | 65 73 20 66 6f 72 20 74 |he sourc|es for t|
|000011b0| 68 65 20 6d 61 6e 79 20 | 6f 66 20 74 68 65 20 61 |he many |of the a|
|000011c0| 6c 67 6f 72 69 74 68 6d | 73 20 70 72 65 73 65 6e |lgorithm|s presen|
|000011d0| 74 65 64 20 69 6e 20 31 | 29 20 61 72 65 0a 23 09 |ted in 1|) are.#.|
|000011e0| 61 76 61 69 6c 61 62 6c | 65 20 62 79 20 66 74 70 |availabl|e by ftp|
|000011f0| 2c 20 66 74 70 2e 76 74 | 2e 65 64 75 3a 2f 70 75 |, ftp.vt|.edu:/pu|
|00001200| 62 2f 72 65 75 73 65 2f | 69 72 63 6f 64 65 2e 74 |b/reuse/|ircode.t|
|00001210| 61 72 2e 5a 0a 23 0a 23 | 09 32 29 20 22 54 65 78 |ar.Z.#.#|.2) "Tex|
|00001220| 74 20 49 6e 66 6f 72 6d | 61 74 69 6f 6e 20 52 65 |t Inform|ation Re|
|00001230| 74 72 69 65 76 61 6c 20 | 53 79 73 74 65 6d 73 2c |trieval |Systems,|
|00001240| 22 20 43 68 61 72 6c 65 | 73 20 54 2e 20 4d 65 61 |" Charle|s T. Mea|
|00001250| 64 6f 77 2c 0a 23 09 41 | 63 61 64 65 6d 69 63 20 |dow,.#.A|cademic |
|00001260| 50 72 65 73 73 2c 20 49 | 6e 63 2c 20 53 61 6e 20 |Press, I|nc, San |
|00001270| 44 69 65 67 6f 2c 20 31 | 39 39 32 2c 20 49 53 42 |Diego, 1|992, ISB|
|00001280| 4e 20 30 2d 31 32 2d 34 | 38 37 34 31 30 2d 58 2e |N 0-12-4|87410-X.|
|00001290| 0a 23 0a 23 09 33 29 20 | 22 46 75 6c 6c 20 54 65 |.#.#.3) |"Full Te|
|000012a0| 78 74 20 44 61 74 61 62 | 61 73 65 73 2c 22 20 43 |xt Datab|ases," C|
|000012b0| 61 72 6f 6c 20 54 65 6e | 6f 70 69 72 2c 20 4a 75 |arol Ten|opir, Ju|
|000012c0| 6e 67 20 53 6f 6f 6e 20 | 52 6f 2c 0a 23 09 47 72 |ng Soon |Ro,.#.Gr|
|000012d0| 65 65 6e 77 6f 6f 64 20 | 50 72 65 73 73 2c 20 4e |eenwood |Press, N|
|000012e0| 65 77 20 59 6f 72 6b 2c | 20 31 39 39 30 2c 20 49 |ew York,| 1990, I|
|000012f0| 53 42 4e 20 30 2d 33 31 | 33 2d 32 36 33 30 33 2d |SBN 0-31|3-26303-|
|00001300| 35 2e 0a 23 0a 23 09 34 | 29 20 22 54 65 78 74 20 |5..#.#.4|) "Text |
|00001310| 61 6e 64 20 43 6f 6e 74 | 65 78 74 2c 20 44 6f 63 |and Cont|ext, Doc|
|00001320| 75 6d 65 6e 74 20 50 72 | 6f 63 65 73 73 69 6e 67 |ument Pr|ocessing|
|00001330| 20 61 6e 64 20 53 74 6f | 72 61 67 65 2c 22 20 53 | and Sto|rage," S|
|00001340| 75 73 61 6e 0a 23 09 4a | 6f 6e 65 73 2c 20 53 70 |usan.#.J|ones, Sp|
|00001350| 72 69 6e 67 65 72 2d 56 | 65 72 6c 61 67 2c 20 4e |ringer-V|erlag, N|
|00001360| 65 77 20 59 6f 72 6b 2c | 20 31 39 39 31 2c 20 49 |ew York,| 1991, I|
|00001370| 53 42 4e 20 30 2d 33 38 | 37 2d 31 39 36 30 34 2d |SBN 0-38|7-19604-|
|00001380| 38 2e 0a 23 0a 23 09 35 | 29 20 66 74 70 20 74 68 |8..#.#.5|) ftp th|
|00001390| 69 6e 6b 2e 63 6f 6d 3a | 2f 77 61 69 73 2f 77 61 |ink.com:|/wais/wa|
|000013a0| 69 73 2d 63 6f 72 70 6f | 72 61 74 65 2d 70 61 70 |is-corpo|rate-pap|
|000013b0| 65 72 2e 74 65 78 74 0a | 23 0a 23 09 36 29 20 66 |er.text.|#.#.6) f|
|000013c0| 74 70 20 63 73 2e 74 6f | 72 6f 6e 74 6f 2e 65 64 |tp cs.to|ronto.ed|
|000013d0| 75 3a 2f 70 75 62 2f 6c | 71 2d 74 65 78 74 2e 52 |u:/pub/l|q-text.R|
|000013e0| 45 41 44 4d 45 2e 31 2e | 31 30 0a 23 0a 23 09 37 |EADME.1.|10.#.#.7|
|000013f0| 29 20 22 55 6e 69 78 20 | 53 68 65 6c 6c 20 50 72 |) "Unix |Shell Pr|
|00001400| 6f 67 72 61 6d 6d 69 6e | 67 2c 22 20 4c 6f 77 65 |ogrammin|g," Lowe|
|00001410| 6c 6c 20 4a 61 79 20 41 | 72 74 68 75 72 2c 20 4a |ll Jay A|rthur, J|
|00001420| 6f 68 6e 20 57 69 6c 65 | 79 20 26 0a 23 09 53 6f |ohn Wile|y &.#.So|
|00001430| 6e 73 2c 20 49 6e 63 2e | 2c 20 4e 65 77 20 59 6f |ns, Inc.|, New Yo|
|00001440| 72 6b 2c 20 31 39 39 30 | 2c 20 49 53 42 4e 20 30 |rk, 1990|, ISBN 0|
|00001450| 2d 34 37 31 2d 35 31 38 | 32 30 2d 34 2e 0a 23 0a |-471-518|20-4..#.|
|00001460| 23 20 52 65 6c 61 74 65 | 64 20 69 6e 66 6f 72 6d |# Relate|d inform|
|00001470| 61 74 69 6f 6e 20 72 65 | 74 72 69 65 76 61 6c 20 |ation re|trieval |
|00001480| 73 6f 66 74 77 61 72 65 | 3a 0a 23 0a 23 09 31 29 |software|:.#.#.1)|
|00001490| 20 57 61 69 73 2c 20 61 | 76 61 69 6c 61 62 6c 65 | Wais, a|vailable|
|000014a0| 20 62 79 20 66 74 70 2c | 20 74 68 69 6e 6b 2e 63 | by ftp,| think.c|
|000014b0| 6f 6d 3a 2f 77 61 69 73 | 2f 77 61 69 73 2d 38 2d |om:/wais|/wais-8-|
|000014c0| 62 35 2e 31 2e 74 61 72 | 2e 5a 0a 23 0a 23 09 32 |b5.1.tar|.Z.#.#.2|
|000014d0| 29 20 6c 71 2d 74 65 78 | 74 2c 20 61 76 61 69 6c |) lq-tex|t, avail|
|000014e0| 61 62 6c 65 20 62 79 20 | 66 74 70 2c 20 63 73 2e |able by |ftp, cs.|
|000014f0| 74 6f 72 6f 6e 74 6f 2e | 65 64 75 3a 0a 23 09 2f |toronto.|edu:.#./|
|00001500| 70 75 62 2f 6c 71 2d 74 | 65 78 74 31 2e 31 30 2e |pub/lq-t|ext1.10.|
|00001510| 74 61 72 2e 5a 0a 23 0a | 23 20 54 68 69 73 20 73 |tar.Z.#.|# This s|
|00001520| 63 72 69 70 74 20 75 73 | 65 73 20 74 68 65 20 55 |cript us|es the U|
|00001530| 6e 69 78 20 63 6f 6e 63 | 65 70 74 20 6f 66 20 61 |nix conc|ept of a|
|00001540| 20 73 69 6d 70 6c 65 20 | 66 6c 61 74 20 74 65 78 | simple |flat tex|
|00001550| 74 20 66 69 6c 65 20 61 | 73 20 61 0a 23 20 64 61 |t file a|s a.# da|
|00001560| 74 61 62 61 73 65 2c 20 | 6f 70 65 72 61 74 65 64 |tabase, |operated|
|00001570| 20 6f 6e 20 62 79 20 74 | 68 65 20 76 61 72 69 6f | on by t|he vario|
|00001580| 75 73 20 75 74 69 6c 69 | 74 69 65 73 20 6e 61 74 |us utili|ties nat|
|00001590| 69 76 65 20 74 6f 20 74 | 68 65 20 55 6e 69 78 0a |ive to t|he Unix.|
|000015a0| 23 20 73 79 73 74 65 6d | 2e 20 54 68 65 20 66 6c |# system|. The fl|
|000015b0| 61 74 20 74 65 78 74 20 | 66 69 6c 65 27 73 20 6f |at text |file's o|
|000015c0| 72 67 61 6e 69 7a 61 74 | 69 6f 6e 20 69 73 20 65 |rganizat|ion is e|
|000015d0| 78 61 63 74 6c 79 20 6f | 6e 65 20 72 65 63 6f 72 |xactly o|ne recor|
|000015e0| 64 20 66 6f 72 0a 23 20 | 65 61 63 68 20 66 69 6c |d for.# |each fil|
|000015f0| 65 20 74 68 61 74 20 63 | 6f 6e 74 61 69 6e 73 20 |e that c|ontains |
|00001600| 61 74 20 6c 65 61 73 74 | 20 6f 6e 65 20 69 6e 73 |at least| one ins|
|00001610| 74 61 6e 63 65 20 6f 66 | 20 61 20 73 70 65 63 69 |tance of| a speci|
|00001620| 66 69 63 20 77 6f 72 64 | 2e 0a 23 20 45 61 63 68 |fic word|..# Each|
|00001630| 20 72 65 63 6f 72 64 20 | 69 6e 20 74 68 65 20 66 | record |in the f|
|00001640| 6c 61 74 20 74 65 78 74 | 20 66 69 6c 65 20 68 61 |lat text| file ha|
|00001650| 73 20 65 78 61 63 74 6c | 79 20 74 77 6f 20 66 69 |s exactl|y two fi|
|00001660| 65 6c 64 73 2e 20 54 68 | 65 73 65 20 74 77 6f 0a |elds. Th|ese two.|
|00001670| 23 20 66 69 65 6c 64 73 | 20 61 72 65 20 74 68 65 |# fields| are the|
|00001680| 20 77 6f 72 64 2c 20 66 | 6f 6c 6c 6f 77 65 64 20 | word, f|ollowed |
|00001690| 62 79 20 61 20 73 69 6e | 67 6c 65 20 22 24 7b 54 |by a sin|gle "${T|
|000016a0| 41 42 7d 22 20 66 69 65 | 6c 64 20 64 65 6c 69 6d |AB}" fie|ld delim|
|000016b0| 69 74 65 72 2c 0a 23 20 | 61 6e 64 20 74 68 65 20 |iter,.# |and the |
|000016c0| 66 69 6c 65 20 6e 61 6d | 65 20 63 6f 6e 74 61 69 |file nam|e contai|
|000016d0| 6e 69 6e 67 20 74 68 65 | 20 77 6f 72 64 2e 20 54 |ning the| word. T|
|000016e0| 68 65 20 72 65 63 6f 72 | 64 20 73 65 71 75 65 6e |he recor|d sequen|
|000016f0| 63 65 20 69 6e 20 74 68 | 65 0a 23 20 66 6c 61 74 |ce in th|e.# flat|
|00001700| 20 74 65 78 74 20 66 69 | 6c 65 20 69 73 20 74 68 | text fi|le is th|
|00001710| 65 20 41 53 43 49 49 20 | 63 6f 6c 6c 61 74 65 64 |e ASCII |collated|
|00001720| 20 73 65 71 75 65 6e 63 | 65 20 6f 66 20 74 68 65 | sequenc|e of the|
|00001730| 20 77 6f 72 64 20 66 69 | 65 6c 64 2e 0a 23 0a 23 | word fi|eld..#.#|
|00001740| 20 54 68 69 73 20 6f 72 | 67 61 6e 69 7a 61 74 69 | This or|ganizati|
|00001750| 6f 6e 20 6f 66 20 66 6c | 61 74 20 74 65 78 74 20 |on of fl|at text |
|00001760| 66 69 6c 65 20 69 73 20 | 61 6e 20 69 6e 76 65 72 |file is |an inver|
|00001770| 74 65 64 20 69 6e 64 65 | 78 20 64 61 74 61 62 61 |ted inde|x databa|
|00001780| 73 65 2c 0a 23 20 69 65 | 2e 2c 20 74 68 65 20 66 |se,.# ie|., the f|
|00001790| 69 6c 65 20 6e 61 6d 65 | 73 20 6f 66 20 66 69 6c |ile name|s of fil|
|000017a0| 65 73 20 74 68 61 74 20 | 63 6f 6e 74 61 69 6e 20 |es that |contain |
|000017b0| 61 20 73 70 65 63 69 66 | 69 63 20 77 6f 72 64 20 |a specif|ic word |
|000017c0| 63 61 6e 20 62 65 0a 23 | 20 66 6f 75 6e 64 2c 20 |can be.#| found, |
|000017d0| 75 73 69 6e 67 20 61 20 | 62 69 6e 61 72 79 20 73 |using a |binary s|
|000017e0| 65 61 72 63 68 20 70 72 | 6f 67 72 61 6d 2c 20 28 |earch pr|ogram, (|
|000017f0| 6c 69 6b 65 20 74 68 65 | 20 6e 61 74 69 76 65 20 |like the| native |
|00001800| 55 6e 69 78 20 70 72 6f | 67 72 61 6d 2c 0a 23 20 |Unix pro|gram,.# |
|00001810| 22 6c 6f 6f 6b 2e 22 29 | 20 54 68 65 20 69 6e 76 |"look.")| The inv|
|00001820| 65 72 74 65 64 20 69 6e | 64 65 78 20 66 69 6c 65 |erted in|dex file|
|00001830| 20 72 65 63 6f 72 64 73 | 20 63 61 6e 20 62 65 20 | records| can be |
|00001840| 63 72 65 61 74 65 64 20 | 62 79 20 70 61 72 73 69 |created |by parsi|
|00001850| 6e 67 0a 23 20 74 68 65 | 20 77 6f 72 64 73 20 69 |ng.# the| words i|
|00001860| 6e 20 74 65 78 74 75 72 | 61 6c 20 64 6f 63 75 6d |n textur|al docum|
|00001870| 65 6e 74 73 20 28 70 65 | 72 68 61 70 73 20 75 73 |ents (pe|rhaps us|
|00001880| 69 6e 67 20 74 68 65 20 | 6e 61 74 69 76 65 20 55 |ing the |native U|
|00001890| 6e 69 78 0a 23 20 70 72 | 6f 67 72 61 6d 73 2c 20 |nix.# pr|ograms, |
|000018a0| 22 74 72 22 20 61 6e 64 | 20 22 73 65 64 2c 22 29 |"tr" and| "sed,")|
|000018b0| 20 61 6e 64 20 63 6f 6e | 63 61 74 65 6e 61 74 69 | and con|catenati|
|000018c0| 6e 67 20 74 68 65 73 65 | 20 77 6f 72 64 73 20 77 |ng these| words w|
|000018d0| 69 74 68 20 61 0a 23 20 | 73 69 6e 67 6c 65 20 22 |ith a.# |single "|
|000018e0| 24 7b 54 41 42 7d 22 20 | 61 6e 64 20 74 68 65 20 |${TAB}" |and the |
|000018f0| 66 69 6c 65 20 6e 61 6d | 65 20 6f 66 20 74 68 65 |file nam|e of the|
|00001900| 20 66 69 6c 65 20 63 6f | 6e 74 61 69 6e 69 6e 67 | file co|ntaining|
|00001910| 20 74 68 65 20 77 6f 72 | 64 2e 0a 23 20 54 68 65 | the wor|d..# The|
|00001920| 73 65 20 72 65 63 6f 72 | 64 73 20 63 61 6e 20 74 |se recor|ds can t|
|00001930| 68 65 6e 20 62 65 20 73 | 6f 72 74 65 64 20 69 6e |hen be s|orted in|
|00001940| 74 6f 20 41 53 43 49 49 | 20 63 6f 6c 6c 61 74 69 |to ASCII| collati|
|00001950| 6f 6e 20 73 65 71 75 65 | 6e 63 65 2c 0a 23 20 28 |on seque|nce,.# (|
|00001960| 75 73 69 6e 67 2c 20 66 | 6f 72 20 65 78 61 6d 70 |using, f|or examp|
|00001970| 6c 65 20 74 68 65 20 55 | 6e 69 78 20 70 72 6f 67 |le the U|nix prog|
|00001980| 72 61 6d 2c 20 22 73 6f | 72 74 22 20 2d 75 2e 29 |ram, "so|rt" -u.)|
|00001990| 20 4f 62 76 69 6f 75 73 | 6c 79 2c 20 74 77 6f 0a | Obvious|ly, two.|
|000019a0| 23 20 73 6f 72 74 65 64 | 20 69 6e 76 65 72 74 65 |# sorted| inverte|
|000019b0| 64 20 69 6e 64 65 78 20 | 64 61 74 61 62 61 73 65 |d index |database|
|000019c0| 73 20 63 6f 75 6c 64 20 | 62 65 20 63 6f 6d 62 69 |s could |be combi|
|000019d0| 6e 65 64 20 77 69 74 68 | 20 74 68 65 20 22 73 6f |ned with| the "so|
|000019e0| 72 74 22 0a 23 20 2d 75 | 6d 2c 20 63 6f 6d 6d 61 |rt".# -u|m, comma|
|000019f0| 6e 64 2e 09 20 46 69 6c | 65 20 6e 61 6d 65 73 20 |nd.. Fil|e names |
|00001a00| 63 6f 75 6c 64 20 62 65 | 20 72 65 6d 6f 76 65 64 |could be| removed|
|00001a10| 20 66 72 6f 6d 20 74 68 | 65 20 69 6e 76 65 72 74 | from th|e invert|
|00001a20| 65 64 20 69 6e 64 65 78 | 0a 23 20 64 61 74 61 62 |ed index|.# datab|
|00001a30| 61 73 65 20 77 69 74 68 | 20 74 68 65 20 22 65 67 |ase with| the "eg|
|00001a40| 72 65 70 22 20 2d 76 20 | 22 2a 24 7b 54 41 42 7d |rep" -v |"*${TAB}|
|00001a50| 66 69 6c 65 6e 61 6d 65 | 22 20 63 6f 6d 6d 61 6e |filename|" comman|
|00001a60| 64 2c 20 61 6e 64 20 77 | 6f 72 64 73 0a 23 20 72 |d, and w|ords.# r|
|00001a70| 65 6d 6f 76 65 64 20 77 | 69 74 68 20 74 68 65 20 |emoved w|ith the |
|00001a80| 22 65 67 72 65 70 22 20 | 2d 76 20 22 5e 77 6f 72 |"egrep" |-v "^wor|
|00001a90| 64 24 7b 54 41 42 7d 22 | 20 63 6f 6d 6d 61 6e 64 |d${TAB}"| command|
|00001aa0| 2c 20 61 6e 64 20 73 6f | 20 6f 6e 2e 20 54 68 69 |, and so| on. Thi|
|00001ab0| 73 0a 23 20 73 63 72 69 | 70 74 20 75 73 65 73 20 |s.# scri|pt uses |
|00001ac0| 6f 6e 6c 79 20 61 20 66 | 65 77 20 6f 66 20 74 68 |only a f|ew of th|
|00001ad0| 65 20 6e 61 74 69 76 65 | 20 55 6e 69 78 20 70 72 |e native| Unix pr|
|00001ae0| 6f 67 72 61 6d 73 20 74 | 6f 20 63 6f 6e 73 74 72 |ograms t|o constr|
|00001af0| 75 63 74 20 61 6e 0a 23 | 20 69 6e 76 65 72 74 65 |uct an.#| inverte|
|00001b00| 64 20 69 6e 64 65 78 20 | 64 61 74 61 62 61 73 65 |d index |database|
|00001b10| 20 73 79 73 74 65 6d 2e | 0a 23 0a 23 20 54 68 65 | system.|.#.# The|
|00001b20| 20 66 75 6e 63 74 69 6f | 6e 73 20 63 6f 6e 74 61 | functio|ns conta|
|00001b30| 69 6e 65 64 20 69 6e 20 | 74 68 69 73 20 73 63 72 |ined in |this scr|
|00001b40| 69 70 74 3a 0a 23 0a 23 | 09 31 29 20 66 69 6e 64 |ipt:.#.#|.1) find|
|00001b50| 5f 70 72 6f 67 72 61 6d | 28 29 2c 20 66 69 6e 64 |_program|(), find|
|00001b60| 20 69 66 20 61 20 70 72 | 6f 67 72 61 6d 20 65 78 | if a pr|ogram ex|
|00001b70| 69 73 74 73 2e 0a 23 09 | 32 29 20 68 65 6c 70 28 |ists..#.|2) help(|
|00001b80| 29 2c 20 68 65 6c 70 2e | 0a 23 09 33 29 20 72 65 |), help.|.#.3) re|
|00001b90| 61 64 5f 69 6e 64 65 78 | 20 28 29 2c 20 71 75 65 |ad_index| (), que|
|00001ba0| 72 79 20 74 68 65 20 69 | 6e 76 65 72 74 65 64 20 |ry the i|nverted |
|00001bb0| 69 6e 64 65 78 20 66 69 | 6c 65 20 66 6f 72 20 77 |index fi|le for w|
|00001bc0| 6f 72 64 28 73 29 2e 0a | 23 09 34 29 20 77 72 69 |ord(s)..|#.4) wri|
|00001bd0| 74 65 5f 69 6e 64 65 78 | 28 29 2c 20 69 6e 64 65 |te_index|(), inde|
|00001be0| 78 20 74 68 65 20 77 6f | 72 64 73 20 69 6e 20 74 |x the wo|rds in t|
|00001bf0| 68 65 20 66 69 6c 65 73 | 2e 0a 23 09 35 29 20 75 |he files|..#.5) u|
|00001c00| 70 64 61 74 65 5f 64 61 | 74 61 62 61 73 65 28 29 |pdate_da|tabase()|
|00001c10| 2c 20 75 70 64 61 74 65 | 20 74 68 65 20 64 61 74 |, update| the dat|
|00001c20| 61 62 61 73 65 2e 0a 23 | 09 36 29 20 70 61 72 73 |abase..#|.6) pars|
|00001c30| 65 5f 77 6f 72 64 28 29 | 2c 20 6c 65 78 69 63 61 |e_word()|, lexica|
|00001c40| 6c 20 61 6e 61 6c 79 73 | 69 73 2e 0a 23 09 37 29 |l analys|is..#.7)|
|00001c50| 20 72 65 6d 6f 76 65 5f | 77 6f 72 64 73 28 29 2c | remove_|words(),|
|00001c60| 20 72 65 6d 6f 76 65 20 | 77 6f 72 64 73 20 66 72 | remove |words fr|
|00001c70| 6f 6d 20 74 68 65 20 69 | 6e 76 65 72 74 65 64 20 |om the i|nverted |
|00001c80| 69 6e 64 65 78 2e 0a 23 | 09 38 29 20 72 65 6d 6f |index..#|.8) remo|
|00001c90| 76 65 5f 66 69 6c 65 73 | 28 29 2c 20 72 65 6d 6f |ve_files|(), remo|
|00001ca0| 76 65 20 66 69 6c 65 73 | 20 66 72 6f 6d 20 74 68 |ve files| from th|
|00001cb0| 65 20 69 6e 76 65 72 74 | 65 64 20 69 6e 64 65 78 |e invert|ed index|
|00001cc0| 2e 0a 23 09 39 29 20 72 | 65 6c 65 76 61 6e 63 65 |..#.9) r|elevance|
|00001cd0| 5f 63 6f 75 6e 74 28 29 | 2c 20 72 65 6c 65 76 61 |_count()|, releva|
|00001ce0| 6e 63 65 20 63 6f 75 6e | 74 2e 0a 23 09 31 30 29 |nce coun|t..#.10)|
|00001cf0| 20 72 65 6c 65 76 61 6e | 63 65 5f 70 72 6f 78 69 | relevan|ce_proxi|
|00001d00| 6d 69 74 79 28 29 2c 20 | 70 72 6f 78 69 6d 69 74 |mity(), |proximit|
|00001d10| 79 20 72 65 74 72 69 65 | 76 61 6c 2e 0a 23 0a 23 |y retrie|val..#.#|
|00001d20| 20 54 68 65 20 66 75 6e | 63 74 69 6f 6e 73 2c 20 | The fun|ctions, |
|00001d30| 72 65 6d 6f 76 65 5f 77 | 6f 72 64 73 28 29 2c 20 |remove_w|ords(), |
|00001d40| 72 65 6d 6f 76 65 5f 66 | 69 6c 65 73 28 29 2c 20 |remove_f|iles(), |
|00001d50| 72 65 6c 65 76 61 6e 63 | 65 5f 63 6f 75 6e 74 28 |relevanc|e_count(|
|00001d60| 29 20 61 6e 64 0a 23 20 | 72 65 6c 65 76 61 6e 63 |) and.# |relevanc|
|00001d70| 65 5f 70 72 6f 78 69 6d | 69 74 79 28 29 20 61 72 |e_proxim|ity() ar|
|00001d80| 65 20 69 6e 63 6c 75 64 | 65 64 20 74 6f 20 73 65 |e includ|ed to se|
|00001d90| 72 76 65 20 61 73 20 74 | 65 6d 70 6c 61 74 65 73 |rve as t|emplates|
|00001da0| 20 66 6f 72 20 66 75 72 | 74 68 65 72 0a 23 20 61 | for fur|ther.# a|
|00001db0| 70 70 6c 69 63 61 74 69 | 6f 6e 73 2e 20 50 72 6f |pplicati|ons. Pro|
|00001dc0| 62 61 62 6c 79 2c 20 69 | 6e 20 74 68 65 20 69 6e |bably, i|n the in|
|00001dd0| 74 65 72 65 73 74 20 6f | 66 20 67 65 6e 65 72 61 |terest o|f genera|
|00001de0| 6c 69 74 79 2c 20 74 68 | 65 79 20 73 68 6f 75 6c |lity, th|ey shoul|
|00001df0| 64 0a 23 20 6e 6f 74 20 | 62 65 20 69 6e 63 6c 75 |d.# not |be inclu|
|00001e00| 64 65 64 20 69 6e 20 74 | 68 65 20 70 72 6f 67 72 |ded in t|he progr|
|00001e10| 61 6d 20 73 69 6e 63 65 | 20 74 68 65 79 20 63 61 |am since| they ca|
|00001e20| 6e 20 62 65 20 63 6f 6d | 70 6c 65 74 65 6c 79 0a |n be com|pletely.|
|00001e30| 23 20 69 6d 70 6c 65 6d | 65 6e 74 65 64 20 61 73 |# implem|ented as|
|00001e40| 20 65 78 74 65 72 6e 61 | 6c 20 73 63 72 69 70 74 | externa|l script|
|00001e50| 73 2c 20 61 6c 69 61 73 | 65 73 2c 20 6f 72 20 70 |s, alias|es, or p|
|00001e60| 69 70 65 73 20 66 72 6f | 6d 20 74 68 65 20 6f 75 |ipes fro|m the ou|
|00001e70| 74 70 75 74 20 6f 66 0a | 23 20 71 74 2e 0a 23 0a |tput of.|# qt..#.|
|00001e80| 23 20 54 68 69 73 20 70 | 72 6f 67 72 61 6d 20 77 |# This p|rogram w|
|00001e90| 69 6c 6c 20 63 72 65 61 | 74 65 20 61 6e 64 20 71 |ill crea|te and q|
|00001ea0| 75 65 72 79 20 69 6e 76 | 65 72 74 65 64 20 69 6e |uery inv|erted in|
|00001eb0| 64 65 78 20 66 69 6c 65 | 73 20 74 68 61 74 20 69 |dex file|s that i|
|00001ec0| 6e 64 65 78 0a 23 20 74 | 68 65 20 77 6f 72 64 73 |ndex.# t|he words|
|00001ed0| 20 69 6e 20 74 65 78 74 | 20 66 69 6c 65 73 2e 20 | in text| files. |
|00001ee0| 54 68 65 73 65 20 69 6e | 64 69 63 65 73 20 61 72 |These in|dices ar|
|00001ef0| 65 20 75 73 65 66 75 6c | 20 69 6e 20 69 6e 66 6f |e useful| in info|
|00001f00| 72 6d 61 74 69 6f 6e 0a | 23 20 72 65 74 72 69 65 |rmation.|# retrie|
|00001f10| 76 61 6c 20 73 79 73 74 | 65 6d 73 2e 20 54 68 65 |val syst|ems. The|
|00001f20| 20 69 6e 76 65 72 74 65 | 64 20 69 6e 64 65 78 20 | inverte|d index |
|00001f30| 66 69 6c 65 73 20 61 72 | 65 2c 20 74 79 70 69 63 |files ar|e, typic|
|00001f40| 61 6c 6c 79 2c 20 61 62 | 6f 75 74 20 74 68 65 0a |ally, ab|out the.|
|00001f50| 23 20 73 61 6d 65 20 73 | 69 7a 65 20 6f 66 20 74 |# same s|ize of t|
|00001f60| 68 65 20 74 65 78 74 20 | 66 69 6c 65 73 2c 20 61 |he text |files, a|
|00001f70| 6e 64 20 64 6f 20 6e 6f | 74 20 72 65 71 75 69 72 |nd do no|t requir|
|00001f80| 65 20 74 68 65 20 74 65 | 78 74 20 66 69 6c 65 73 |e the te|xt files|
|00001f90| 20 74 6f 20 62 65 0a 23 | 20 70 72 65 73 65 6e 74 | to be.#| present|
|00001fa0| 20 66 6f 72 20 71 75 65 | 72 79 20 6f 70 65 72 61 | for que|ry opera|
|00001fb0| 74 69 6f 6e 73 2e 20 54 | 68 65 20 71 75 65 72 79 |tions. T|he query|
|00001fc0| 20 66 75 6e 63 74 69 6f | 6e 73 2c 20 74 79 70 69 | functio|ns, typi|
|00001fd0| 63 61 6c 6c 79 2c 20 63 | 6f 6e 73 69 73 74 0a 23 |cally, c|onsist.#|
|00001fe0| 20 6f 66 20 62 6f 6f 6c | 65 61 6e 20 6f 70 65 72 | of bool|ean oper|
|00001ff0| 61 74 69 6f 6e 73 20 6f | 6e 20 77 6f 72 64 20 73 |ations o|n word s|
|00002000| 65 61 72 63 68 65 73 2e | 20 54 68 65 20 6f 75 74 |earches.| The out|
|00002010| 70 75 74 20 6f 66 20 74 | 68 65 20 71 75 65 72 79 |put of t|he query|
|00002020| 20 69 73 2c 0a 23 20 74 | 79 70 69 63 61 6c 6c 79 | is,.# t|ypically|
|00002030| 2c 20 61 20 6c 69 73 74 | 20 6f 66 20 74 68 65 20 |, a list| of the |
|00002040| 66 69 6c 65 20 6e 61 6d | 65 73 20 74 68 61 74 20 |file nam|es that |
|00002050| 63 6f 6e 74 61 69 6e 20 | 74 68 65 20 71 75 65 72 |contain |the quer|
|00002060| 69 65 64 20 77 6f 72 64 | 28 73 29 2e 0a 23 0a 23 |ied word|(s)..#.#|
|00002070| 20 54 68 65 20 72 65 61 | 64 20 73 79 6e 6f 70 73 | The rea|d synops|
|00002080| 69 73 20 69 73 3a 0a 23 | 0a 23 09 71 74 20 5b 2d |is is:.#|.#.qt [-|
|00002090| 65 5d 20 5b 2d 72 20 7c | 20 2d 72 63 20 7c 20 2d |e] [-r || -rc | -|
|000020a0| 72 70 5d 20 5b 2d 66 20 | 69 6e 64 65 78 5f 6e 61 |rp] [-f |index_na|
|000020b0| 6d 65 5d 20 77 6f 72 64 | 31 20 5b 6f 70 31 5d 20 |me] word|1 [op1] |
|000020c0| 77 6f 72 64 32 20 5b 6f | 70 32 5d 20 2e 2e 2e 0a |word2 [o|p2] ....|
|000020d0| 23 0a 23 20 77 68 65 72 | 65 20 77 6f 72 64 31 2d |#.# wher|e word1-|
|000020e0| 77 6f 72 64 32 20 2e 2e | 2e 20 61 72 65 20 74 68 |word2 ..|. are th|
|000020f0| 65 20 77 6f 72 64 73 20 | 74 6f 20 62 65 20 71 75 |e words |to be qu|
|00002100| 65 72 69 65 64 20 69 6e | 20 74 68 65 20 69 6e 76 |eried in| the inv|
|00002110| 65 72 74 65 64 0a 23 20 | 69 6e 64 65 78 2c 20 61 |erted.# |index, a|
|00002120| 6e 64 20 6f 70 31 2d 6f | 70 32 20 2e 2e 2e 20 61 |nd op1-o|p2 ... a|
|00002130| 72 65 20 74 68 65 20 6f | 70 65 72 61 74 69 6f 6e |re the o|peration|
|00002140| 73 20 74 6f 20 62 65 20 | 70 65 72 66 6f 72 6d 65 |s to be |performe|
|00002150| 64 20 6f 6e 20 74 68 65 | 20 73 65 74 0a 23 20 6f |d on the| set.# o|
|00002160| 66 20 66 69 6c 65 20 6e | 61 6d 65 73 20 74 68 61 |f file n|ames tha|
|00002170| 74 20 63 6f 6e 74 61 69 | 6e 20 74 68 65 73 65 20 |t contai|n these |
|00002180| 77 6f 72 64 73 2e 20 54 | 68 65 20 77 6f 72 64 2f |words. T|he word/|
|00002190| 6f 70 65 72 61 74 69 6f | 6e 20 61 72 67 75 6d 65 |operatio|n argume|
|000021a0| 6e 74 73 0a 23 20 63 6f | 6e 73 69 73 74 20 6f 66 |nts.# co|nsist of|
|000021b0| 20 70 61 69 72 73 20 6f | 66 20 73 65 61 72 63 68 | pairs o|f search|
|000021c0| 20 77 6f 72 64 73 2c 20 | 61 6e 64 20 62 6f 6f 6c | words, |and bool|
|000021d0| 65 61 6e 20 6f 70 65 72 | 61 74 6f 72 73 2c 20 77 |ean oper|ators, w|
|000021e0| 69 74 68 20 61 20 6c 65 | 66 74 0a 23 20 74 6f 20 |ith a le|ft.# to |
|000021f0| 72 69 67 68 74 20 6f 70 | 65 72 61 74 69 6f 6e 61 |right op|erationa|
|00002200| 6c 20 70 72 65 63 65 64 | 65 6e 63 65 2e 0a 23 0a |l preced|ence..#.|
|00002210| 23 20 54 68 75 73 20 69 | 66 20 41 2c 20 42 2c 20 |# Thus i|f A, B, |
|00002220| 61 6e 64 20 43 20 61 72 | 65 20 77 6f 72 64 73 2c |and C ar|e words,|
|00002230| 20 74 68 65 6e 20 74 68 | 65 20 71 75 65 72 79 3a | then th|e query:|
|00002240| 0a 23 0a 23 09 41 20 61 | 6e 64 20 42 20 6f 72 20 |.#.#.A a|nd B or |
|00002250| 43 20 6e 6f 74 20 44 0a | 23 0a 23 20 77 6f 75 6c |C not D.|#.# woul|
|00002260| 64 20 73 70 65 63 69 66 | 79 20 74 68 61 74 20 61 |d specif|y that a|
|00002270| 6c 6c 20 66 69 6c 65 20 | 6e 61 6d 65 73 20 63 6f |ll file |names co|
|00002280| 6e 74 61 69 6e 69 6e 67 | 20 77 6f 72 64 20 41 20 |ntaining| word A |
|00002290| 73 68 6f 75 6c 64 20 62 | 65 20 66 6f 75 6e 64 2c |should b|e found,|
|000022a0| 0a 23 20 74 68 65 6e 20 | 61 6c 6c 20 74 68 65 20 |.# then |all the |
|000022b0| 66 69 6c 65 20 6e 61 6d | 65 73 20 63 6f 6e 74 61 |file nam|es conta|
|000022c0| 69 6e 69 6e 67 20 77 6f | 72 64 20 42 20 73 68 6f |ining wo|rd B sho|
|000022d0| 75 6c 64 20 62 65 20 66 | 6f 75 6e 64 2c 20 61 6e |uld be f|ound, an|
|000022e0| 64 20 6f 6e 6c 79 0a 23 | 20 74 68 6f 73 65 20 66 |d only.#| those f|
|000022f0| 69 6c 65 20 6e 61 6d 65 | 73 20 74 68 61 74 20 63 |ile name|s that c|
|00002300| 6f 6e 74 61 69 6e 20 77 | 6f 72 64 73 20 41 20 61 |ontain w|ords A a|
|00002310| 6e 64 20 42 20 73 68 6f | 75 6c 64 20 62 65 20 61 |nd B sho|uld be a|
|00002320| 64 64 65 64 20 74 6f 20 | 74 68 6f 73 65 0a 23 20 |dded to |those.# |
|00002330| 66 69 6c 65 20 6e 61 6d | 65 73 20 63 6f 6e 74 61 |file nam|es conta|
|00002340| 69 6e 69 6e 67 20 77 6f | 72 64 20 43 2c 20 61 6e |ining wo|rd C, an|
|00002350| 64 20 74 68 65 6e 20 69 | 66 20 74 68 65 73 65 20 |d then i|f these |
|00002360| 66 69 6c 65 20 6e 61 6d | 65 73 20 64 6f 20 6e 6f |file nam|es do no|
|00002370| 74 0a 23 20 63 6f 6e 74 | 61 69 6e 20 77 6f 72 64 |t.# cont|ain word|
|00002380| 20 44 2c 20 74 68 65 79 | 20 61 72 65 20 6f 75 74 | D, they| are out|
|00002390| 70 75 74 2e 0a 23 0a 23 | 20 4c 6f 67 69 63 61 6c |put..#.#| Logical|
|000023a0| 20 22 6f 72 27 69 6e 67 | 22 20 69 73 20 69 6d 70 | "or'ing|" is imp|
|000023b0| 6c 69 63 69 74 2c 20 74 | 68 75 73 3a 0a 23 0a 23 |licit, t|hus:.#.#|
|000023c0| 09 41 20 42 20 43 0a 23 | 0a 23 20 69 73 20 69 64 |.A B C.#|.# is id|
|000023d0| 65 6e 74 69 63 61 6c 20 | 74 6f 3a 0a 23 0a 23 09 |entical |to:.#.#.|
|000023e0| 41 20 6f 72 20 42 20 6f | 72 20 43 0a 23 0a 23 20 |A or B o|r C.#.# |
|000023f0| 4f 62 76 69 6f 75 73 6c | 79 2c 20 74 68 65 20 6b |Obviousl|y, the k|
|00002400| 65 79 77 6f 72 64 73 2c | 20 22 61 6e 64 2c 22 20 |eywords,| "and," |
|00002410| 22 6e 6f 74 2c 22 20 61 | 6e 64 20 22 6f 72 2c 22 |"not," a|nd "or,"|
|00002420| 20 6d 61 79 20 6e 6f 74 | 20 62 65 20 71 75 65 72 | may not| be quer|
|00002430| 69 65 64 0a 23 20 66 6f | 72 2c 20 77 68 65 6e 20 |ied.# fo|r, when |
|00002440| 75 73 69 6e 67 20 74 68 | 65 20 69 6d 70 6c 69 63 |using th|e implic|
|00002450| 69 74 20 22 6f 72 22 20 | 71 75 65 72 79 20 63 6f |it "or" |query co|
|00002460| 6e 73 74 72 75 63 74 73 | 2e 0a 23 0a 23 20 49 66 |nstructs|..#.# If|
|00002470| 20 74 68 65 20 22 2d 65 | 22 20 6f 70 74 69 6f 6e | the "-e|" option|
|00002480| 20 69 73 20 73 70 65 63 | 69 66 69 65 64 2c 20 74 | is spec|ified, t|
|00002490| 68 65 6e 20 22 65 78 61 | 63 74 20 6d 61 74 63 68 |hen "exa|ct match|
|000024a0| 22 20 71 75 65 72 69 65 | 73 20 77 69 6c 6c 20 62 |" querie|s will b|
|000024b0| 65 0a 23 20 70 65 72 66 | 6f 72 6d 65 64 2c 20 6f |e.# perf|ormed, o|
|000024c0| 74 68 65 72 77 69 73 65 | 2c 20 61 20 22 70 61 72 |therwise|, a "par|
|000024d0| 74 69 61 6c 20 6b 65 79 | 22 20 74 79 70 65 20 6f |tial key|" type o|
|000024e0| 66 20 73 65 61 72 63 68 | 20 77 69 6c 6c 20 62 65 |f search| will be|
|000024f0| 0a 23 20 70 65 72 66 6f | 72 6d 65 64 2c 20 77 68 |.# perfo|rmed, wh|
|00002500| 69 63 68 20 69 73 20 74 | 68 65 20 64 65 66 61 75 |ich is t|he defau|
|00002510| 6c 74 2e 20 49 74 20 69 | 73 20 72 65 63 6f 6d 6d |lt. It i|s recomm|
|00002520| 65 6e 64 65 64 20 74 68 | 61 74 20 74 68 65 20 22 |ended th|at the "|
|00002530| 2d 65 22 0a 23 20 6f 70 | 74 69 6f 6e 20 62 65 20 |-e".# op|tion be |
|00002540| 75 73 65 64 20 69 66 20 | 74 68 65 20 71 75 65 72 |used if |the quer|
|00002550| 79 20 69 6e 76 6f 6c 76 | 65 73 20 61 6e 79 20 62 |y involv|es any b|
|00002560| 6f 6f 6c 65 61 6e 20 6f | 70 65 72 61 74 69 6f 6e |oolean o|peration|
|00002570| 73 2e 0a 23 0a 23 20 49 | 66 20 74 68 65 20 22 2d |s..#.# I|f the "-|
|00002580| 72 22 20 6f 70 74 69 6f | 6e 20 69 73 20 73 70 65 |r" optio|n is spe|
|00002590| 63 69 66 69 65 64 2c 20 | 74 68 65 6e 20 74 68 65 |cified, |then the|
|000025a0| 20 77 6f 72 64 73 20 62 | 65 69 6e 67 20 71 75 65 | words b|eing que|
|000025b0| 72 69 65 64 20 66 6f 72 | 0a 23 20 77 69 6c 6c 20 |ried for|.# will |
|000025c0| 62 65 20 6f 75 74 70 75 | 74 20 62 65 66 6f 72 65 |be outpu|t before|
|000025d0| 20 74 68 65 20 6c 69 73 | 74 20 66 69 6c 65 20 6e | the lis|t file n|
|000025e0| 61 6d 65 73 20 74 68 61 | 74 20 63 6f 6e 74 61 69 |ames tha|t contai|
|000025f0| 6e 20 74 68 65 20 71 75 | 65 72 69 65 64 0a 23 20 |n the qu|eried.# |
|00002600| 77 6f 72 64 73 2e 20 20 | 54 68 69 73 20 6f 75 74 |words. |This out|
|00002610| 70 75 74 20 66 6f 72 6d | 61 74 20 69 73 20 63 6f |put form|at is co|
|00002620| 6d 70 61 74 69 62 6c 65 | 20 77 69 74 68 20 65 67 |mpatible| with eg|
|00002630| 72 65 70 28 31 29 2c 20 | 61 6e 64 20 69 73 20 75 |rep(1), |and is u|
|00002640| 73 65 66 75 6c 0a 23 20 | 69 6e 20 64 6f 69 6e 67 |seful.# |in doing|
|00002650| 20 22 72 65 6c 65 76 61 | 6e 63 65 20 66 65 65 64 | "releva|nce feed|
|00002660| 62 61 63 6b 22 20 73 65 | 61 72 63 68 65 73 2e 0a |back" se|arches..|
|00002670| 23 0a 23 20 49 66 20 74 | 68 65 20 22 2d 72 63 22 |#.# If t|he "-rc"|
|00002680| 20 6f 70 74 69 6f 6e 20 | 69 73 20 73 70 65 63 69 | option |is speci|
|00002690| 66 69 65 64 2c 20 74 68 | 65 6e 20 74 68 65 20 63 |fied, th|en the c|
|000026a0| 6f 75 6e 74 20 6f 66 20 | 72 65 63 6f 72 64 73 20 |ount of |records |
|000026b0| 69 6e 20 61 20 66 69 6c | 65 0a 23 20 74 68 61 74 |in a fil|e.# that|
|000026c0| 20 63 6f 6e 74 61 69 6e | 20 6d 61 74 63 68 28 73 | contain| match(s|
|000026d0| 29 20 77 69 6c 6c 20 62 | 65 20 6f 75 74 70 75 74 |) will b|e output|
|000026e0| 20 77 69 74 68 20 74 68 | 65 20 66 69 6c 65 20 6e | with th|e file n|
|000026f0| 61 6d 65 20 63 6f 6e 74 | 61 69 6e 69 6e 67 0a 23 |ame cont|aining.#|
|00002700| 20 74 68 65 20 6d 61 74 | 63 68 65 73 2e 09 54 68 | the mat|ches..Th|
|00002710| 69 73 20 70 72 6f 76 69 | 64 65 73 20 74 68 65 20 |is provi|des the |
|00002720| 73 79 73 74 65 6d 20 77 | 69 74 68 20 61 20 72 65 |system w|ith a re|
|00002730| 6d 65 64 69 61 6c 20 22 | 72 65 6c 65 76 61 6e 63 |medial "|relevanc|
|00002740| 65 0a 23 20 66 65 65 64 | 62 61 63 6b 22 20 63 61 |e.# feed|back" ca|
|00002750| 70 61 62 69 6c 69 74 79 | 2e 20 54 68 65 20 6f 72 |pability|. The or|
|00002760| 69 67 69 6e 61 6c 20 74 | 65 78 74 20 66 69 6c 65 |iginal t|ext file|
|00002770| 73 20 74 68 61 74 20 77 | 65 72 65 20 75 73 65 64 |s that w|ere used|
|00002780| 20 74 6f 0a 23 20 63 6f | 6e 73 74 72 75 63 74 20 | to.# co|nstruct |
|00002790| 74 68 65 20 69 6e 76 65 | 72 74 65 64 20 69 6e 64 |the inve|rted ind|
|000027a0| 65 78 20 66 69 6c 65 20 | 6d 75 73 74 20 62 65 20 |ex file |must be |
|000027b0| 61 76 61 69 6c 61 62 6c | 65 20 69 6e 20 74 68 65 |availabl|e in the|
|000027c0| 20 73 79 73 74 65 6d 20 | 74 6f 0a 23 20 75 73 65 | system |to.# use|
|000027d0| 20 74 68 69 73 20 6f 70 | 74 69 6f 6e 2e 0a 23 0a | this op|tion..#.|
|000027e0| 23 20 49 66 20 74 68 65 | 20 22 2d 72 70 22 20 6f |# If the| "-rp" o|
|000027f0| 70 74 69 6f 6e 20 69 73 | 20 73 70 65 63 69 66 69 |ption is| specifi|
|00002800| 65 64 2c 20 74 68 65 6e | 20 74 68 65 20 72 65 63 |ed, then| the rec|
|00002810| 6f 72 64 73 20 69 6e 20 | 61 20 66 69 6c 65 20 74 |ords in |a file t|
|00002820| 68 61 74 0a 23 20 63 6f | 6e 74 61 69 6e 20 6d 61 |hat.# co|ntain ma|
|00002830| 74 63 68 28 73 29 20 77 | 69 6c 6c 20 62 65 20 6f |tch(s) w|ill be o|
|00002840| 75 74 70 75 74 20 61 66 | 74 65 72 20 74 68 65 20 |utput af|ter the |
|00002850| 66 69 6c 65 20 6e 61 6d | 65 20 63 6f 6e 74 61 69 |file nam|e contai|
|00002860| 6e 69 6e 67 20 74 68 65 | 0a 23 20 6d 61 74 63 68 |ning the|.# match|
|00002870| 65 73 2e 20 54 68 69 73 | 20 6f 75 74 70 75 74 20 |es. This| output |
|00002880| 66 6f 72 6d 61 74 20 70 | 72 6f 76 69 64 65 73 20 |format p|rovides |
|00002890| 74 68 65 20 73 79 73 74 | 65 6d 20 77 69 74 68 20 |the syst|em with |
|000028a0| 61 20 72 65 6d 65 64 69 | 61 6c 0a 23 20 22 70 65 |a remedi|al.# "pe|
|000028b0| 72 6d 75 74 65 64 20 69 | 6e 64 65 78 22 20 74 79 |rmuted i|ndex" ty|
|000028c0| 70 65 20 6f 66 20 22 70 | 72 6f 78 69 6d 69 74 79 |pe of "p|roximity|
|000028d0| 20 72 65 74 72 69 65 76 | 61 6c 2e 22 20 54 68 65 | retriev|al." The|
|000028e0| 20 6f 72 69 67 69 6e 61 | 6c 20 74 65 78 74 0a 23 | origina|l text.#|
|000028f0| 20 66 69 6c 65 73 20 74 | 68 61 74 20 77 65 72 65 | files t|hat were|
|00002900| 20 75 73 65 64 20 74 6f | 20 63 6f 6e 73 74 72 75 | used to| constru|
|00002910| 63 74 20 74 68 65 20 69 | 6e 76 65 72 74 65 64 20 |ct the i|nverted |
|00002920| 69 6e 64 65 78 20 6d 75 | 73 74 20 62 65 0a 23 20 |index mu|st be.# |
|00002930| 61 76 61 69 6c 61 62 6c | 65 20 69 6e 20 74 68 65 |availabl|e in the|
|00002940| 20 73 79 73 74 65 6d 20 | 74 6f 20 75 73 65 20 74 | system |to use t|
|00002950| 68 69 73 20 6f 70 74 69 | 6f 6e 2e 0a 23 0a 23 20 |his opti|on..#.# |
|00002960| 54 68 65 20 77 72 69 74 | 65 20 73 79 6e 6f 70 73 |The writ|e synops|
|00002970| 69 73 20 69 73 3a 0a 23 | 0a 23 09 71 74 20 2d 77 |is is:.#|.#.qt -w|
|00002980| 20 5b 2d 66 20 69 6e 64 | 65 78 5f 6e 61 6d 65 5d | [-f ind|ex_name]|
|00002990| 20 5b 2d 31 20 7c 20 2e | 2e 2e 20 7c 20 2d 38 5d | [-1 | .|.. | -8]|
|000029a0| 20 66 69 6c 65 31 20 66 | 69 6c 65 32 20 2e 2e 2e | file1 f|ile2 ...|
|000029b0| 0a 23 0a 23 20 77 68 65 | 72 65 20 66 69 6c 65 31 |.#.# whe|re file1|
|000029c0| 20 66 69 6c 65 32 20 2e | 2e 2e 20 61 72 65 20 74 | file2 .|.. are t|
|000029d0| 68 65 20 66 69 6c 65 20 | 6e 61 6d 65 73 20 74 68 |he file |names th|
|000029e0| 61 74 20 63 6f 6e 74 61 | 69 6e 20 77 6f 72 64 73 |at conta|in words|
|000029f0| 20 74 68 61 74 20 61 72 | 65 0a 23 20 74 6f 20 62 | that ar|e.# to b|
|00002a00| 65 20 61 64 64 65 64 20 | 74 6f 20 74 68 65 20 69 |e added |to the i|
|00002a10| 6e 76 65 72 74 65 64 20 | 69 6e 64 65 78 2c 20 6f |nverted |index, o|
|00002a20| 72 3a 0a 23 0a 23 09 71 | 74 20 2d 77 20 5b 2d 66 |r:.#.#.q|t -w [-f|
|00002a30| 20 69 6e 64 65 78 5f 6e | 61 6d 65 5d 20 5b 2d 31 | index_n|ame] [-1|
|00002a40| 20 7c 20 2e 2e 2e 20 7c | 20 2d 38 5d 20 3c 20 66 | | ... || -8] < f|
|00002a50| 69 6c 65 5f 6c 69 73 74 | 0a 23 0a 23 20 77 68 65 |ile_list|.#.# whe|
|00002a60| 72 65 20 66 69 6c 65 5f | 6c 69 73 74 20 69 73 20 |re file_|list is |
|00002a70| 74 68 65 20 6e 61 6d 65 | 20 6f 66 20 61 20 66 69 |the name| of a fi|
|00002a80| 6c 65 20 74 68 61 74 20 | 63 6f 6e 74 61 69 6e 73 |le that |contains|
|00002a90| 20 61 20 6c 69 73 74 20 | 6f 66 20 66 69 6c 65 0a | a list |of file.|
|00002aa0| 23 20 6e 61 6d 65 73 2c | 20 6f 6e 65 20 66 69 6c |# names,| one fil|
|00002ab0| 65 20 6e 61 6d 65 20 70 | 65 72 20 72 65 63 6f 72 |e name p|er recor|
|00002ac0| 64 2c 20 74 68 61 74 20 | 63 6f 6e 74 61 69 6e 20 |d, that |contain |
|00002ad0| 77 6f 72 64 73 20 74 68 | 61 74 20 61 72 65 20 74 |words th|at are t|
|00002ae0| 6f 20 62 65 0a 23 20 61 | 64 64 65 64 20 74 6f 20 |o be.# a|dded to |
|00002af0| 74 68 65 20 69 6e 76 65 | 72 74 65 64 20 69 6e 64 |the inve|rted ind|
|00002b00| 65 78 2e 0a 23 0a 23 20 | 49 74 20 69 73 20 72 65 |ex..#.# |It is re|
|00002b10| 63 6f 6d 6d 65 6e 64 65 | 64 20 74 68 61 74 20 66 |commende|d that f|
|00002b20| 69 6c 65 20 6e 61 6d 65 | 73 20 63 6f 6e 74 61 69 |ile name|s contai|
|00002b30| 6e 20 74 68 65 20 61 62 | 73 6f 6c 75 74 65 20 70 |n the ab|solute p|
|00002b40| 61 74 68 20 74 6f 20 74 | 68 65 0a 23 20 73 79 73 |ath to t|he.# sys|
|00002b50| 74 65 6d 27 73 20 72 6f | 6f 74 20 64 69 72 65 63 |tem's ro|ot direc|
|00002b60| 74 6f 72 79 2e 0a 23 0a | 23 20 49 66 20 74 68 65 |tory..#.|# If the|
|00002b70| 20 69 6e 76 65 72 74 65 | 64 20 69 6e 64 65 78 20 | inverte|d index |
|00002b80| 66 69 6c 65 20 64 6f 65 | 73 20 6e 6f 74 20 65 78 |file doe|s not ex|
|00002b90| 69 73 74 2c 20 74 68 65 | 6e 20 69 74 20 77 69 6c |ist, the|n it wil|
|00002ba0| 6c 20 62 65 20 63 72 65 | 61 74 65 64 2c 0a 23 20 |l be cre|ated,.# |
|00002bb0| 61 6e 64 20 63 6f 6e 74 | 61 69 6e 20 61 6e 20 69 |and cont|ain an i|
|00002bc0| 6e 64 65 78 20 74 6f 20 | 61 6c 6c 20 6f 66 20 74 |ndex to |all of t|
|00002bd0| 68 65 20 77 6f 72 64 73 | 20 69 6e 20 74 68 65 20 |he words| in the |
|00002be0| 69 6e 70 75 74 20 66 69 | 6c 65 73 2e 20 49 66 20 |input fi|les. If |
|00002bf0| 74 68 65 0a 23 20 69 6e | 76 65 72 74 65 64 20 69 |the.# in|verted i|
|00002c00| 6e 64 65 78 20 66 69 6c | 65 20 65 78 69 73 74 73 |ndex fil|e exists|
|00002c10| 2c 20 74 68 65 6e 20 74 | 68 65 20 69 6e 64 69 63 |, then t|he indic|
|00002c20| 65 73 20 6f 66 20 61 6c | 6c 20 77 6f 72 64 73 20 |es of al|l words |
|00002c30| 69 6e 20 74 68 65 0a 23 | 20 69 6e 70 75 74 20 66 |in the.#| input f|
|00002c40| 69 6c 65 73 20 77 69 6c | 6c 20 62 65 20 61 64 64 |iles wil|l be add|
|00002c50| 65 64 2c 20 69 6e 63 72 | 65 6d 65 6e 74 61 6c 6c |ed, incr|ementall|
|00002c60| 79 2e 20 49 6e 73 74 61 | 6e 63 65 73 20 6f 66 20 |y. Insta|nces of |
|00002c70| 77 6f 72 64 73 20 61 6e | 64 0a 23 20 66 69 6c 65 |words an|d.# file|
|00002c80| 6e 61 6d 65 20 70 61 69 | 72 73 20 77 69 6c 6c 20 |name pai|rs will |
|00002c90| 62 65 20 75 6e 69 71 75 | 65 20 69 6e 20 74 68 65 |be uniqu|e in the|
|00002ca0| 20 69 6e 76 65 72 74 65 | 64 20 69 6e 64 65 78 2e | inverte|d index.|
|00002cb0| 0a 23 0a 23 20 54 68 65 | 20 22 2d 77 22 20 6f 70 |.#.# The| "-w" op|
|00002cc0| 74 69 6f 6e 2c 20 73 70 | 65 63 69 66 69 65 73 20 |tion, sp|ecifies |
|00002cd0| 74 68 61 74 20 77 72 69 | 74 65 20 6f 70 65 72 61 |that wri|te opera|
|00002ce0| 74 69 6f 6e 73 20 77 69 | 6c 6c 20 62 65 20 70 65 |tions wi|ll be pe|
|00002cf0| 72 66 6f 72 6d 65 64 2c | 0a 23 20 61 6e 64 20 69 |rformed,|.# and i|
|00002d00| 73 20 61 20 6d 61 6e 64 | 61 74 6f 72 79 20 6f 70 |s a mand|atory op|
|00002d10| 74 69 6f 6e 2c 20 74 6f | 20 62 65 20 75 73 65 64 |tion, to| be used|
|00002d20| 20 69 66 20 61 6e 64 20 | 6f 6e 6c 79 20 69 66 20 | if and |only if |
|00002d30| 77 72 69 74 65 20 6f 70 | 65 72 61 74 69 6f 6e 73 |write op|erations|
|00002d40| 0a 23 20 61 72 65 20 64 | 65 73 69 72 65 64 2e 0a |.# are d|esired..|
|00002d50| 23 0a 23 20 54 68 65 20 | 22 2d 66 20 69 6e 64 65 |#.# The |"-f inde|
|00002d60| 78 5f 6e 61 6d 65 2c 22 | 20 6f 70 74 69 6f 6e 61 |x_name,"| optiona|
|00002d70| 6c 6c 79 2c 20 73 70 65 | 63 69 66 69 65 73 20 74 |lly, spe|cifies t|
|00002d80| 68 65 20 69 6e 76 65 72 | 74 65 64 20 69 6e 64 65 |he inver|ted inde|
|00002d90| 78 20 66 69 6c 65 27 73 | 0a 23 20 6e 61 6d 65 2e |x file's|.# name.|
|00002da0| 20 49 66 20 74 68 65 20 | 22 2d 66 22 20 6f 70 74 | If the |"-f" opt|
|00002db0| 69 6f 6e 20 69 73 20 6e | 6f 74 20 73 70 65 63 69 |ion is n|ot speci|
|00002dc0| 66 69 65 64 2c 20 74 68 | 65 20 69 6e 76 65 72 74 |fied, th|e invert|
|00002dd0| 65 64 20 69 6e 64 65 78 | 20 66 69 6c 65 0a 23 20 |ed index| file.# |
|00002de0| 6e 61 6d 65 20 77 69 6c | 6c 20 64 65 66 61 75 6c |name wil|l defaul|
|00002df0| 74 20 74 6f 20 22 71 74 | 2e 69 6e 64 65 78 2e 22 |t to "qt|.index."|
|00002e00| 0a 23 0a 23 20 54 68 65 | 20 6c 65 78 69 63 61 6c |.#.# The| lexical|
|00002e10| 20 61 6e 61 6c 79 7a 65 | 72 20 6c 65 76 65 6c 20 | analyze|r level |
|00002e20| 69 73 20 73 70 65 63 69 | 66 69 65 64 20 62 79 2c |is speci|fied by,|
|00002e30| 20 22 2d 31 22 2c 20 74 | 68 72 6f 75 67 68 20 22 | "-1", t|hrough "|
|00002e40| 2d 38 22 2e 20 49 66 0a | 23 20 6e 6f 6e 65 20 61 |-8". If.|# none a|
|00002e50| 72 65 20 73 70 65 63 69 | 66 69 65 64 2c 20 74 68 |re speci|fied, th|
|00002e60| 65 20 64 65 66 61 75 6c | 74 2c 20 22 2d 34 22 2c |e defaul|t, "-4",|
|00002e70| 20 77 69 6c 6c 20 62 65 | 20 75 73 65 64 2e 20 54 | will be| used. T|
|00002e80| 68 65 20 6c 65 78 69 63 | 61 6c 0a 23 20 61 6e 61 |he lexic|al.# ana|
|00002e90| 6c 79 7a 65 72 73 20 77 | 69 74 68 20 6c 61 72 67 |lyzers w|ith larg|
|00002ea0| 65 72 20 6e 75 6d 62 65 | 72 73 20 61 72 65 2c 20 |er numbe|rs are, |
|00002eb0| 67 65 6e 65 72 61 6c 6c | 79 2c 20 6d 6f 72 65 20 |generall|y, more |
|00002ec0| 73 6f 70 68 69 73 74 69 | 63 61 74 65 64 0a 23 20 |sophisti|cated.# |
|00002ed0| 61 62 6f 75 74 20 74 68 | 65 20 77 6f 72 64 73 20 |about th|e words |
|00002ee0| 74 68 61 74 20 61 72 65 | 20 70 6c 61 63 65 64 20 |that are| placed |
|00002ef0| 69 6e 20 74 68 65 20 69 | 6e 76 65 72 74 65 64 20 |in the i|nverted |
|00002f00| 69 6e 64 65 78 2e 20 54 | 68 65 20 6c 65 78 69 63 |index. T|he lexic|
|00002f10| 61 6c 0a 23 20 61 6e 61 | 6c 79 7a 65 72 73 20 61 |al.# ana|lyzers a|
|00002f20| 76 61 69 6c 61 62 6c 65 | 20 61 72 65 3a 0a 23 0a |vailable| are:.#.|
|00002f30| 23 09 31 29 20 50 61 72 | 73 65 73 20 77 6f 72 64 |#.1) Par|ses word|
|00002f40| 73 20 61 6e 64 20 6e 75 | 6d 62 65 72 73 2e 20 41 |s and nu|mbers. A|
|00002f50| 6c 6c 20 6f 74 68 65 72 | 20 63 68 61 72 61 63 74 |ll other| charact|
|00002f60| 65 72 73 20 61 72 65 20 | 6f 6d 69 74 74 65 64 2e |ers are |omitted.|
|00002f70| 0a 23 09 43 61 70 69 74 | 61 6c 69 7a 61 74 69 6f |.#.Capit|alizatio|
|00002f80| 6e 20 69 73 20 70 72 65 | 73 65 72 76 65 64 2e 20 |n is pre|served. |
|00002f90| 50 72 6f 62 61 62 6c 79 | 20 74 68 65 20 62 65 73 |Probably| the bes|
|00002fa0| 74 20 63 68 6f 69 63 65 | 20 69 66 0a 23 09 6e 6f |t choice| if.#.no|
|00002fb0| 6e 2d 77 6f 72 64 20 73 | 65 61 72 63 68 65 73 20 |n-word s|earches |
|00002fc0| 61 72 65 20 69 6d 70 6f | 72 74 61 6e 74 2e 0a 23 |are impo|rtant..#|
|00002fd0| 0a 23 09 32 29 20 4c 69 | 6b 65 20 31 29 20 61 62 |.#.2) Li|ke 1) ab|
|00002fe0| 6f 76 65 2c 20 62 75 74 | 20 74 68 65 20 27 5f 27 |ove, but| the '_'|
|00002ff0| 20 63 68 61 72 61 63 74 | 65 72 20 69 73 20 72 65 | charact|er is re|
|00003000| 63 6f 67 6e 69 7a 65 64 | 2e 20 54 68 69 73 0a 23 |cognized|. This.#|
|00003010| 09 70 61 72 73 65 72 20 | 73 65 65 6d 73 20 74 6f |.parser |seems to|
|00003020| 20 77 6f 72 6b 20 77 65 | 6c 6c 20 77 69 74 68 20 | work we|ll with |
|00003030| 22 43 22 20 70 72 6f 67 | 72 61 6d 20 73 6f 75 72 |"C" prog|ram sour|
|00003040| 63 65 20 66 69 6c 65 73 | 2e 0a 23 0a 23 09 33 29 |ce files|..#.#.3)|
|00003050| 20 4c 69 6b 65 20 31 29 | 20 61 62 6f 76 65 2c 20 | Like 1)| above, |
|00003060| 62 75 74 2c 20 6f 6e 6c | 79 20 77 6f 72 64 73 20 |but, onl|y words |
|00003070| 6f 66 20 6d 6f 72 65 20 | 74 68 61 6e 20 74 77 6f |of more |than two|
|00003080| 20 63 68 61 72 61 63 74 | 65 72 73 0a 23 09 61 72 | charact|ers.#.ar|
|00003090| 65 20 70 6c 61 63 65 64 | 20 69 6e 20 74 68 65 20 |e placed| in the |
|000030a0| 69 6e 76 65 72 74 65 64 | 20 69 6e 64 65 78 20 66 |inverted| index f|
|000030b0| 69 6c 65 2e 20 49 66 20 | 63 61 70 69 74 61 6c 69 |ile. If |capitali|
|000030c0| 7a 61 74 69 6f 6e 20 69 | 73 0a 23 09 63 6f 6e 73 |zation i|s.#.cons|
|000030d0| 69 64 65 72 65 64 20 69 | 6d 70 6f 72 74 61 6e 74 |idered i|mportant|
|000030e0| 20 69 6e 20 74 68 65 20 | 73 65 61 72 63 68 20 63 | in the |search c|
|000030f0| 72 69 74 65 72 69 61 2c | 20 74 68 65 6e 20 74 68 |riteria,| then th|
|00003100| 69 73 20 73 65 65 6d 73 | 0a 23 09 74 6f 20 62 65 |is seems|.#.to be|
|00003110| 20 74 68 65 20 62 65 73 | 74 20 63 68 6f 69 63 65 | the bes|t choice|
|00003120| 2e 0a 23 0a 23 09 34 29 | 20 4c 69 6b 65 20 31 29 |..#.#.4)| Like 1)|
|00003130| 20 61 62 6f 76 65 2c 20 | 62 75 74 2c 20 63 61 70 | above, |but, cap|
|00003140| 69 74 61 6c 69 7a 61 74 | 69 6f 6e 20 69 73 20 69 |italizat|ion is i|
|00003150| 67 6e 6f 72 65 64 2e 20 | 46 6f 72 20 67 65 6e 65 |gnored. |For gene|
|00003160| 72 61 6c 0a 23 09 74 65 | 78 74 20 77 68 65 72 65 |ral.#.te|xt where|
|00003170| 20 61 6c 6c 20 77 6f 72 | 64 73 20 61 6e 64 20 6e | all wor|ds and n|
|00003180| 75 6d 62 65 72 73 20 61 | 72 65 20 63 6f 6e 73 69 |umbers a|re consi|
|00003190| 64 65 72 65 64 20 73 69 | 67 6e 69 66 69 63 61 6e |dered si|gnifican|
|000031a0| 74 2c 0a 23 09 74 68 69 | 73 20 73 65 65 6d 73 20 |t,.#.thi|s seems |
|000031b0| 74 6f 20 62 65 20 74 68 | 65 20 62 65 73 74 20 63 |to be th|e best c|
|000031c0| 68 6f 69 63 65 2e 20 41 | 6c 73 6f 20 73 65 65 6d |hoice. A|lso seem|
|000031d0| 73 20 61 20 67 6f 6f 64 | 20 63 68 6f 69 63 65 20 |s a good| choice |
|000031e0| 66 6f 72 0a 23 09 22 63 | 61 74 6d 61 6e 22 20 70 |for.#."c|atman" p|
|000031f0| 61 67 65 73 2e 09 20 51 | 75 65 72 69 65 73 20 73 |ages.. Q|ueries s|
|00003200| 68 6f 75 6c 64 20 62 65 | 20 69 6e 20 6c 6f 77 65 |hould be| in lowe|
|00003210| 72 63 61 73 65 2e 0a 23 | 0a 23 09 35 29 20 4c 69 |rcase..#|.#.5) Li|
|00003220| 6b 65 20 33 29 20 61 62 | 6f 76 65 2c 20 62 75 74 |ke 3) ab|ove, but|
|00003230| 20 63 61 70 69 74 61 6c | 69 7a 61 74 69 6f 6e 20 | capital|ization |
|00003240| 69 73 20 69 67 6e 6f 72 | 65 64 2e 20 46 6f 72 20 |is ignor|ed. For |
|00003250| 67 65 6e 65 72 61 6c 0a | 23 09 74 65 78 74 2c 20 |general.|#.text, |
|00003260| 74 68 69 73 20 73 65 65 | 6d 73 20 74 6f 20 62 65 |this see|ms to be|
|00003270| 20 74 68 65 20 62 65 73 | 74 20 63 68 6f 69 63 65 | the bes|t choice|
|00003280| 2e 20 51 75 65 72 69 65 | 73 20 73 68 6f 75 6c 64 |. Querie|s should|
|00003290| 20 62 65 20 69 6e 0a 23 | 09 6c 6f 77 65 72 63 61 | be in.#|.lowerca|
|000032a0| 73 65 2e 0a 23 0a 23 09 | 36 29 20 4c 69 6b 65 20 |se..#.#.|6) Like |
|000032b0| 34 29 20 61 62 6f 76 65 | 2c 20 62 75 74 20 77 6f |4) above|, but wo|
|000032c0| 72 64 73 20 63 6f 6e 74 | 61 69 6e 69 6e 67 20 6f |rds cont|aining o|
|000032d0| 6e 6c 79 20 6e 75 6d 62 | 65 72 73 20 61 72 65 0a |nly numb|ers are.|
|000032e0| 23 09 6f 6d 69 74 74 65 | 64 20 66 72 6f 6d 20 74 |#.omitte|d from t|
|000032f0| 68 65 20 69 6e 76 65 72 | 74 65 64 20 69 6e 64 65 |he inver|ted inde|
|00003300| 78 20 66 69 6c 65 2e 20 | 46 6f 72 20 74 65 78 74 |x file. |For text|
|00003310| 20 63 6f 6e 74 61 69 6e | 69 6e 67 20 6f 6e 6c 79 | contain|ing only|
|00003320| 0a 23 09 77 6f 72 64 73 | 2c 20 74 68 69 73 20 73 |.#.words|, this s|
|00003330| 65 65 6d 73 20 74 6f 20 | 62 65 20 74 68 65 20 62 |eems to |be the b|
|00003340| 65 73 74 20 63 68 6f 69 | 63 65 2e 20 51 75 65 72 |est choi|ce. Quer|
|00003350| 69 65 73 20 73 68 6f 75 | 6c 64 20 62 65 20 69 6e |ies shou|ld be in|
|00003360| 0a 23 09 6c 6f 77 65 72 | 63 61 73 65 2e 0a 23 0a |.#.lower|case..#.|
|00003370| 23 09 37 29 20 4c 69 6b | 65 20 34 29 20 61 62 6f |#.7) Lik|e 4) abo|
|00003380| 76 65 2c 20 62 75 74 20 | 64 6f 65 73 20 6e 6f 74 |ve, but |does not|
|00003390| 20 69 6e 63 6c 75 64 65 | 20 55 6e 69 78 20 6d 61 | include| Unix ma|
|000033a0| 69 6c 20 68 65 61 64 65 | 72 73 20 69 6e 0a 23 09 |il heade|rs in.#.|
|000033b0| 74 68 65 20 69 6e 76 65 | 72 74 65 64 20 69 6e 64 |the inve|rted ind|
|000033c0| 65 78 20 66 69 6c 65 2e | 20 45 61 63 68 20 65 6d |ex file.| Each em|
|000033d0| 61 69 6c 20 73 68 6f 75 | 6c 64 20 62 65 20 69 6e |ail shou|ld be in|
|000033e0| 20 61 20 73 65 70 61 72 | 61 74 65 0a 23 09 66 69 | a separ|ate.#.fi|
|000033f0| 6c 65 2c 20 61 73 20 6f | 70 70 6f 73 65 64 20 74 |le, as o|pposed t|
|00003400| 6f 20 63 6f 6e 63 61 74 | 65 6e 61 74 65 64 20 69 |o concat|enated i|
|00003410| 6e 74 6f 20 66 6f 6c 64 | 65 72 73 2e 20 54 68 69 |nto fold|ers. Thi|
|00003420| 73 20 73 65 65 6d 73 20 | 74 6f 0a 23 09 62 65 20 |s seems |to.#.be |
|00003430| 74 68 65 20 62 65 73 74 | 20 63 68 6f 69 63 65 20 |the best| choice |
|00003440| 66 6f 72 20 55 6e 69 78 | 20 6d 61 69 6c 20 66 69 |for Unix| mail fi|
|00003450| 6c 65 73 2c 20 69 66 20 | 74 68 65 20 68 65 61 64 |les, if |the head|
|00003460| 65 72 0a 23 09 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |er.#.inf|ormation|
|00003470| 20 69 73 20 6e 6f 74 20 | 64 65 73 69 72 61 62 6c | is not |desirabl|
|00003480| 65 2e 0a 23 0a 23 09 38 | 29 20 4c 69 6b 65 20 34 |e..#.#.8|) Like 4|
|00003490| 29 20 61 62 6f 76 65 2c | 20 62 75 74 20 64 65 6c |) above,| but del|
|000034a0| 65 74 65 73 20 54 65 58 | 20 61 6e 64 2f 6f 72 20 |etes TeX| and/or |
|000034b0| 4c 61 54 65 58 20 63 6f | 6d 6d 61 6e 64 73 20 66 |LaTeX co|mmands f|
|000034c0| 72 6f 6d 0a 23 09 74 68 | 65 20 69 6e 76 65 72 74 |rom.#.th|e invert|
|000034d0| 65 64 20 69 6e 64 65 78 | 20 66 69 6c 65 2e 20 54 |ed index| file. T|
|000034e0| 68 69 73 20 73 65 65 6d | 73 20 74 6f 20 62 65 20 |his seem|s to be |
|000034f0| 74 68 65 20 62 65 73 74 | 20 63 68 6f 69 63 65 20 |the best| choice |
|00003500| 66 6f 72 0a 23 09 54 65 | 58 20 61 6e 64 20 4c 61 |for.#.Te|X and La|
|00003510| 54 65 58 20 64 6f 63 75 | 6d 65 6e 74 73 2e 0a 23 |TeX docu|ments..#|
|00003520| 0a 23 20 54 68 65 20 6d | 6f 72 65 20 73 6f 70 68 |.# The m|ore soph|
|00003530| 69 73 74 69 63 61 74 65 | 64 20 74 68 65 20 70 61 |isticate|d the pa|
|00003540| 72 73 65 72 2c 20 74 68 | 65 20 73 6d 61 6c 6c 65 |rser, th|e smalle|
|00003550| 72 20 74 68 65 20 73 69 | 7a 65 20 6f 66 20 74 68 |r the si|ze of th|
|00003560| 65 0a 23 20 69 6e 76 65 | 72 74 65 64 20 69 6e 64 |e.# inve|rted ind|
|00003570| 65 78 20 66 69 6c 65 2e | 20 4d 75 6c 74 69 70 6c |ex file.| Multipl|
|00003580| 65 20 72 75 6e 73 20 63 | 61 6e 20 62 65 20 6d 61 |e runs c|an be ma|
|00003590| 64 65 2c 20 75 73 69 6e | 67 20 74 68 65 20 64 69 |de, usin|g the di|
|000035a0| 66 66 65 72 65 6e 74 0a | 23 20 70 61 72 73 65 72 |fferent.|# parser|
|000035b0| 73 2c 20 74 6f 20 73 74 | 6f 72 65 20 77 6f 72 64 |s, to st|ore word|
|000035c0| 73 20 69 6e 20 74 68 65 | 20 69 6e 76 65 72 74 65 |s in the| inverte|
|000035d0| 64 20 69 6e 64 65 78 2e | 20 46 6f 72 20 65 78 61 |d index.| For exa|
|000035e0| 6d 70 6c 65 2c 20 75 73 | 69 6e 67 0a 23 20 70 61 |mple, us|ing.# pa|
|000035f0| 72 73 65 72 73 20 33 29 | 20 61 6e 64 20 34 29 20 |rsers 3)| and 4) |
|00003600| 77 6f 75 6c 64 20 70 6c | 61 63 65 20 62 6f 74 68 |would pl|ace both|
|00003610| 20 74 68 65 20 63 61 70 | 69 74 61 6c 69 7a 65 64 | the cap|italized|
|00003620| 20 61 6e 64 0a 23 20 6e | 6f 6e 2d 63 61 70 69 74 | and.# n|on-capit|
|00003630| 61 6c 69 7a 65 64 20 77 | 6f 72 64 73 20 69 6e 20 |alized w|ords in |
|00003640| 74 68 65 20 69 6e 64 65 | 78 2e 20 20 54 68 69 73 |the inde|x. This|
|00003650| 20 77 6f 75 6c 64 20 6e | 6f 74 20 64 75 70 6c 69 | would n|ot dupli|
|00003660| 63 61 74 65 20 61 6e 79 | 0a 23 20 77 6f 72 64 73 |cate any|.# words|
|00003670| 20 61 6c 72 65 61 64 79 | 20 69 6e 20 74 68 65 20 | already| in the |
|00003680| 69 6e 64 65 78 2d 6f 6e | 6c 79 20 61 64 64 20 74 |index-on|ly add t|
|00003690| 68 65 20 77 6f 72 64 73 | 20 74 68 61 74 20 77 65 |he words| that we|
|000036a0| 72 65 20 64 69 66 66 65 | 72 65 6e 74 2e 0a 23 0a |re diffe|rent..#.|
|000036b0| 23 20 54 68 65 20 72 65 | 6d 6f 76 65 20 77 6f 72 |# The re|move wor|
|000036c0| 64 73 20 73 79 6e 6f 70 | 73 69 73 20 69 73 3a 0a |ds synop|sis is:.|
|000036d0| 23 0a 23 09 71 74 20 2d | 77 20 2d 64 77 20 5b 2d |#.#.qt -|w -dw [-|
|000036e0| 66 20 69 6e 64 65 78 5f | 6e 61 6d 65 5d 20 77 6f |f index_|name] wo|
|000036f0| 72 64 31 20 77 6f 72 64 | 32 20 2e 2e 2e 0a 23 0a |rd1 word|2 ....#.|
|00003700| 23 20 77 68 65 72 65 20 | 77 6f 72 64 31 20 77 6f |# where |word1 wo|
|00003710| 72 64 32 20 2e 2e 2e 20 | 61 72 65 20 74 68 65 20 |rd2 ... |are the |
|00003720| 77 6f 72 64 73 20 74 68 | 61 74 20 61 72 65 20 74 |words th|at are t|
|00003730| 6f 20 62 65 20 64 65 6c | 65 74 65 64 20 66 72 6f |o be del|eted fro|
|00003740| 6d 20 74 68 65 0a 23 20 | 69 6e 76 65 72 74 65 64 |m the.# |inverted|
|00003750| 20 69 6e 64 65 78 20 66 | 69 6c 65 2c 20 61 6e 64 | index f|ile, and|
|00003760| 20 6d 61 79 20 62 65 20 | 61 20 72 65 67 75 6c 61 | may be |a regula|
|00003770| 72 20 65 78 70 72 65 73 | 73 69 6f 6e 73 2d 6e 6f |r expres|sions-no|
|00003780| 20 27 5e 27 20 6f 72 20 | 27 24 27 0a 23 20 63 68 | '^' or |'$'.# ch|
|00003790| 61 72 61 63 74 65 72 73 | 20 73 68 6f 75 6c 64 20 |aracters| should |
|000037a0| 62 65 20 75 73 65 64 2c | 20 75 6e 6c 65 73 73 20 |be used,| unless |
|000037b0| 74 68 65 79 20 61 72 65 | 20 65 73 63 61 70 65 64 |they are| escaped|
|000037c0| 2e 20 54 68 65 20 22 2d | 77 22 20 6f 70 74 69 6f |. The "-|w" optio|
|000037d0| 6e 0a 23 20 69 73 20 6d | 61 6e 64 61 74 6f 72 79 |n.# is m|andatory|
|000037e0| 2e 0a 23 0a 23 20 54 68 | 65 20 72 65 6d 6f 76 65 |..#.# Th|e remove|
|000037f0| 20 66 69 6c 65 73 20 73 | 79 6e 6f 70 73 69 73 20 | files s|ynopsis |
|00003800| 69 73 3a 0a 23 0a 23 09 | 71 74 20 2d 77 20 2d 64 |is:.#.#.|qt -w -d|
|00003810| 66 20 5b 2d 66 20 69 6e | 64 65 78 5f 6e 61 6d 65 |f [-f in|dex_name|
|00003820| 5d 20 66 69 6c 65 31 20 | 66 69 6c 65 32 20 2e 2e |] file1 |file2 ..|
|00003830| 2e 0a 23 0a 23 20 77 68 | 65 72 65 20 66 69 6c 65 |..#.# wh|ere file|
|00003840| 31 20 66 69 6c 65 32 20 | 2e 2e 2e 20 61 72 65 20 |1 file2 |... are |
|00003850| 74 68 65 20 66 69 6c 65 | 20 6e 61 6d 65 73 20 74 |the file| names t|
|00003860| 68 61 74 20 61 72 65 20 | 74 6f 20 62 65 20 64 65 |hat are |to be de|
|00003870| 6c 65 74 65 64 20 66 72 | 6f 6d 0a 23 20 69 6e 76 |leted fr|om.# inv|
|00003880| 65 72 74 65 64 20 69 6e | 64 65 78 2e 20 54 68 65 |erted in|dex. The|
|00003890| 20 66 69 6c 65 20 6e 61 | 6d 65 73 20 74 6f 20 62 | file na|mes to b|
|000038a0| 65 20 64 65 6c 65 74 65 | 64 20 66 72 6f 6d 20 74 |e delete|d from t|
|000038b0| 68 65 20 69 6e 76 65 72 | 74 65 64 20 69 6e 64 65 |he inver|ted inde|
|000038c0| 78 0a 23 20 66 69 6c 65 | 20 6d 61 79 20 62 65 20 |x.# file| may be |
|000038d0| 72 65 67 75 6c 61 72 20 | 65 78 70 72 65 73 73 69 |regular |expressi|
|000038e0| 6f 6e 73 2d 6e 6f 20 27 | 5e 27 20 6f 72 20 27 24 |ons-no '|^' or '$|
|000038f0| 27 20 63 68 61 72 61 63 | 74 65 72 73 20 73 68 6f |' charac|ters sho|
|00003900| 75 6c 64 20 62 65 0a 23 | 20 75 73 65 64 2c 20 75 |uld be.#| used, u|
|00003910| 6e 6c 65 73 73 20 74 68 | 65 79 20 61 72 65 20 65 |nless th|ey are e|
|00003920| 73 63 61 70 65 64 2e 20 | 54 68 65 20 22 2d 77 22 |scaped. |The "-w"|
|00003930| 20 6f 70 74 69 6f 6e 20 | 69 73 20 6d 61 6e 64 61 | option |is manda|
|00003940| 74 6f 72 79 2e 0a 23 0a | 23 20 54 68 65 20 76 65 |tory..#.|# The ve|
|00003950| 72 73 69 6f 6e 20 73 79 | 6e 6f 70 73 69 73 20 69 |rsion sy|nopsis i|
|00003960| 73 3a 0a 23 0a 23 09 71 | 74 20 2d 76 0a 23 0a 23 |s:.#.#.q|t -v.#.#|
|00003970| 20 77 68 69 63 68 20 77 | 69 6c 6c 20 70 72 69 6e | which w|ill prin|
|00003980| 74 20 74 68 65 20 76 65 | 72 73 69 6f 6e 20 6e 75 |t the ve|rsion nu|
|00003990| 6d 62 65 72 20 6f 66 20 | 71 74 2e 0a 23 0a 23 20 |mber of |qt..#.# |
|000039a0| 54 68 65 20 68 65 6c 70 | 20 73 79 6e 6f 70 73 69 |The help| synopsi|
|000039b0| 73 20 69 73 3a 0a 23 0a | 23 09 71 74 20 2d 68 0a |s is:.#.|#.qt -h.|
|000039c0| 23 0a 23 20 77 68 69 63 | 68 20 77 69 6c 6c 20 6c |#.# whic|h will l|
|000039d0| 69 73 74 20 61 20 73 79 | 6e 6f 70 73 69 73 20 6f |ist a sy|nopsis o|
|000039e0| 66 20 74 68 65 20 63 6f | 6d 6d 61 6e 64 20 73 65 |f the co|mmand se|
|000039f0| 6d 61 6e 74 69 63 73 2e | 0a 23 0a 23 20 41 20 63 |mantics.|.#.# A c|
|00003a00| 6f 6d 6d 6f 6e 20 65 78 | 61 6d 70 6c 65 20 6f 66 |ommon ex|ample of|
|00003a10| 20 77 72 69 74 69 6e 67 | 20 61 6e 20 69 6e 76 65 | writing| an inve|
|00003a20| 72 74 65 64 20 69 6e 64 | 65 78 20 66 69 6c 65 20 |rted ind|ex file |
|00003a30| 77 6f 75 6c 64 20 62 65 | 3a 0a 23 0a 23 09 66 69 |would be|:.#.#.fi|
|00003a40| 6e 64 20 2f 64 69 72 31 | 2f 64 69 72 32 20 2d 74 |nd /dir1|/dir2 -t|
|00003a50| 79 70 65 20 66 20 2d 70 | 72 69 6e 74 20 7c 20 71 |ype f -p|rint | q|
|00003a60| 74 20 2d 77 0a 23 0a 23 | 20 77 68 69 63 68 20 77 |t -w.#.#| which w|
|00003a70| 6f 75 6c 64 20 72 65 63 | 75 72 73 69 76 65 6c 79 |ould rec|ursively|
|00003a80| 20 64 65 73 63 65 6e 64 | 20 74 68 72 6f 75 67 68 | descend| through|
|00003a90| 20 74 68 65 20 64 69 72 | 65 63 74 6f 72 79 20 68 | the dir|ectory h|
|00003aa0| 69 65 72 61 72 63 68 79 | 2c 20 61 6e 64 0a 23 20 |ierarchy|, and.# |
|00003ab0| 63 72 65 61 74 65 20 61 | 6e 20 69 6e 76 65 72 74 |create a|n invert|
|00003ac0| 65 64 20 69 6e 64 65 78 | 20 6f 66 20 61 6c 6c 20 |ed index| of all |
|00003ad0| 6f 66 20 74 68 65 20 77 | 6f 72 64 73 20 69 6e 20 |of the w|ords in |
|00003ae0| 61 6c 6c 20 6f 66 20 74 | 68 65 20 66 69 6c 65 73 |all of t|he files|
|00003af0| 20 69 6e 0a 23 20 61 6c | 6c 20 6f 66 20 74 68 65 | in.# al|l of the|
|00003b00| 20 64 69 72 65 63 74 6f | 72 69 65 73 2c 20 73 74 | directo|ries, st|
|00003b10| 61 72 74 69 6e 67 20 77 | 69 74 68 20 2f 64 69 72 |arting w|ith /dir|
|00003b20| 31 2f 64 69 72 32 2e 0a | 23 0a 23 20 41 20 63 6f |1/dir2..|#.# A co|
|00003b30| 6d 6d 6f 6e 20 65 78 61 | 6d 70 6c 65 20 6f 66 20 |mmon exa|mple of |
|00003b40| 72 65 74 72 69 65 76 69 | 6e 67 20 69 6e 66 6f 72 |retrievi|ng infor|
|00003b50| 6d 61 74 69 6f 6e 20 66 | 72 6f 6d 20 61 6e 20 69 |mation f|rom an i|
|00003b60| 6e 76 65 72 74 65 64 20 | 69 6e 64 65 78 0a 23 20 |nverted |index.# |
|00003b70| 66 69 6c 65 20 77 6f 75 | 6c 64 20 62 65 3a 0a 23 |file wou|ld be:.#|
|00003b80| 0a 23 09 6d 6f 72 65 20 | 2b 2f 77 6f 72 64 20 60 |.#.more |+/word `|
|00003b90| 71 74 20 77 6f 72 64 60 | 0a 23 0a 23 20 77 68 65 |qt word`|.#.# whe|
|00003ba0| 72 65 20 74 68 65 20 22 | 6d 6f 72 65 22 20 70 72 |re the "|more" pr|
|00003bb0| 6f 67 72 61 6d 20 77 6f | 75 6c 64 20 70 61 67 65 |ogram wo|uld page|
|00003bc0| 20 74 68 72 6f 75 67 68 | 20 74 68 65 20 64 6f 63 | through| the doc|
|00003bd0| 75 6d 65 6e 74 73 20 74 | 68 61 74 0a 23 20 63 6f |uments t|hat.# co|
|00003be0| 6e 74 61 69 6e 20 22 77 | 6f 72 64 2c 22 20 61 64 |ntain "w|ord," ad|
|00003bf0| 76 61 6e 63 69 6e 67 20 | 74 6f 20 74 68 65 20 6e |vancing |to the n|
|00003c00| 65 78 74 20 69 6e 73 74 | 61 6e 63 65 20 65 76 65 |ext inst|ance eve|
|00003c10| 72 79 20 74 69 6d 65 20 | 74 68 65 20 27 6e 27 20 |ry time |the 'n' |
|00003c20| 6b 65 79 0a 23 20 69 73 | 20 64 65 70 72 65 73 73 |key.# is| depress|
|00003c30| 65 64 2e 0a 23 0a 23 20 | 41 20 63 6f 6d 6d 6f 6e |ed..#.# |A common|
|00003c40| 20 65 78 61 6d 70 6c 65 | 20 6f 66 20 72 65 6c 65 | example| of rele|
|00003c50| 76 61 6e 63 65 20 64 65 | 74 65 72 6d 69 6e 61 74 |vance de|terminat|
|00003c60| 69 6f 6e 20 69 6e 20 72 | 65 74 72 69 65 76 69 6e |ion in r|etrievin|
|00003c70| 67 20 69 6e 66 6f 72 6d | 61 74 69 6f 6e 0a 23 20 |g inform|ation.# |
|00003c80| 66 72 6f 6d 20 61 6e 20 | 69 6e 76 65 72 74 65 64 |from an |inverted|
|00003c90| 20 69 6e 64 65 78 20 66 | 69 6c 65 20 77 6f 75 6c | index f|ile woul|
|00003ca0| 64 20 62 65 3a 0a 23 0a | 23 09 65 67 72 65 70 20 |d be:.#.|#.egrep |
|00003cb0| 2d 69 63 20 60 71 74 20 | 2d 72 20 77 6f 72 64 60 |-ic `qt |-r word`|
|00003cc0| 20 7c 20 73 6f 72 74 20 | 2d 6e 20 2d 72 20 2d 74 | | sort |-n -r -t|
|00003cd0| 3a 20 2b 31 0a 23 0a 23 | 20 77 68 69 63 68 20 77 |: +1.#.#| which w|
|00003ce0| 6f 75 6c 64 20 70 72 69 | 6e 74 20 74 68 65 20 66 |ould pri|nt the f|
|00003cf0| 69 6c 65 28 73 29 20 74 | 68 61 74 20 63 6f 6e 74 |ile(s) t|hat cont|
|00003d00| 61 69 6e 20 22 77 6f 72 | 64 2c 22 20 77 69 74 68 |ain "wor|d," with|
|00003d10| 20 74 68 65 20 63 6f 75 | 6e 74 20 6f 66 0a 23 20 | the cou|nt of.# |
|00003d20| 74 68 65 20 69 6e 73 74 | 61 6e 63 65 73 20 6f 66 |the inst|ances of|
|00003d30| 20 72 65 63 6f 72 64 73 | 20 74 68 61 74 20 63 6f | records| that co|
|00003d40| 6e 74 61 69 6e 20 22 77 | 6f 72 64 22 20 69 6e 20 |ntain "w|ord" in |
|00003d50| 65 61 63 68 20 6f 66 20 | 74 68 65 20 66 69 6c 65 |each of |the file|
|00003d60| 28 73 29 2e 0a 23 0a 23 | 20 53 69 6e 63 65 20 74 |(s)..#.#| Since t|
|00003d70| 68 65 20 69 6e 76 65 72 | 74 65 64 20 69 6e 64 65 |he inver|ted inde|
|00003d80| 78 20 66 69 6c 65 20 63 | 6f 6e 73 74 69 74 75 74 |x file c|onstitut|
|00003d90| 65 73 20 61 20 64 61 74 | 61 62 61 73 65 20 73 79 |es a dat|abase sy|
|00003da0| 73 74 65 6d 2c 20 63 61 | 72 65 20 6f 66 0a 23 20 |stem, ca|re of.# |
|00003db0| 68 6f 77 20 74 68 69 73 | 20 66 69 6c 65 20 69 73 |how this| file is|
|00003dc0| 20 6d 61 6e 69 70 75 6c | 61 74 65 64 20 69 73 20 | manipul|ated is |
|00003dd0| 69 6d 70 6f 72 74 61 6e | 74 2e 20 54 68 65 20 67 |importan|t. The g|
|00003de0| 65 6e 65 72 61 6c 20 70 | 72 6f 63 65 64 75 72 65 |eneral p|rocedure|
|00003df0| 20 75 73 65 64 0a 23 20 | 69 6e 20 74 68 69 73 20 | used.# |in this |
|00003e00| 73 63 72 69 70 74 20 69 | 73 20 61 73 20 66 6f 6c |script i|s as fol|
|00003e10| 6c 6f 77 73 3a 0a 23 0a | 23 09 31 29 20 57 68 65 |lows:.#.|#.1) Whe|
|00003e20| 6e 20 74 68 69 73 20 73 | 63 72 69 70 74 20 63 6f |n this s|cript co|
|00003e30| 6d 6d 65 6e 63 65 73 20 | 65 78 65 63 75 74 69 6f |mmences |executio|
|00003e40| 6e 2c 20 61 20 74 65 73 | 74 20 69 73 20 6d 61 64 |n, a tes|t is mad|
|00003e50| 65 20 66 6f 72 0a 23 09 | 74 68 65 20 65 78 69 73 |e for.#.|the exis|
|00003e60| 74 65 6e 63 65 20 6f 66 | 20 61 20 62 61 63 6b 75 |tence of| a backu|
|00003e70| 70 20 6f 66 20 61 6e 20 | 6f 72 69 67 69 6e 61 6c |p of an |original|
|00003e80| 20 69 6e 76 65 72 74 65 | 64 20 69 6e 64 65 78 20 | inverte|d index |
|00003e90| 66 69 6c 65 2c 0a 23 09 | 77 68 69 63 68 20 77 61 |file,.#.|which wa|
|00003ea0| 73 20 63 72 65 61 74 65 | 64 20 69 6e 20 73 74 65 |s create|d in ste|
|00003eb0| 70 20 33 29 2c 20 62 65 | 6c 6f 77 2e 20 28 50 72 |p 3), be|low. (Pr|
|00003ec0| 65 73 75 6d 61 62 6c 79 | 2c 20 74 68 69 73 20 66 |esumably|, this f|
|00003ed0| 69 6c 65 0a 23 09 77 61 | 73 20 6c 65 66 74 20 62 |ile.#.wa|s left b|
|00003ee0| 79 20 66 61 69 6c 65 64 | 20 61 74 74 65 6d 70 74 |y failed| attempt|
|00003ef0| 28 73 29 20 6f 66 20 73 | 74 65 70 28 73 29 20 33 |(s) of s|tep(s) 3|
|00003f00| 29 2c 20 34 29 2c 20 6f | 72 20 35 29 2c 20 62 79 |), 4), o|r 5), by|
|00003f10| 20 61 0a 23 09 70 72 69 | 6f 72 2c 20 75 6e 73 75 | a.#.pri|or, unsu|
|00003f20| 63 63 65 73 73 66 75 6c | 2c 20 65 78 65 63 75 74 |ccessful|, execut|
|00003f30| 69 6f 6e 20 6f 66 20 74 | 68 69 73 20 73 63 72 69 |ion of t|his scri|
|00003f40| 70 74 2e 29 20 49 66 20 | 74 68 65 20 62 61 63 6b |pt.) If |the back|
|00003f50| 75 70 0a 23 09 66 69 6c | 65 20 65 78 69 73 74 73 |up.#.fil|e exists|
|00003f60| 2c 20 69 74 20 69 73 20 | 75 6e 63 6f 6e 64 69 74 |, it is |uncondit|
|00003f70| 69 6f 6e 61 6c 6c 79 20 | 6d 6f 76 65 64 2c 20 76 |ionally |moved, v|
|00003f80| 69 61 20 74 68 65 20 22 | 6d 76 22 0a 23 09 63 6f |ia the "|mv".#.co|
|00003f90| 6d 6d 61 6e 64 2c 20 74 | 6f 20 62 65 20 74 68 65 |mmand, t|o be the|
|00003fa0| 20 63 75 72 72 65 6e 74 | 2c 20 6f 72 69 67 69 6e | current|, origin|
|00003fb0| 61 6c 20 64 61 74 61 62 | 61 73 65 2e 20 49 66 20 |al datab|ase. If |
|00003fc0| 74 68 69 73 0a 23 09 6f | 70 65 72 61 74 69 6f 6e |this.#.o|peration|
|00003fd0| 20 69 73 20 73 75 63 63 | 65 73 73 66 75 6c 2c 20 | is succ|essful, |
|00003fe0| 74 68 65 6e 20 73 74 65 | 70 20 32 29 20 69 73 20 |then ste|p 2) is |
|00003ff0| 65 78 65 63 75 74 65 64 | 2c 20 69 66 20 6e 6f 74 |executed|, if not|
|00004000| 2c 20 74 68 65 0a 23 09 | 73 63 72 69 70 74 20 61 |, the.#.|script a|
|00004010| 62 6f 72 74 73 2e 0a 23 | 0a 23 09 32 29 20 41 66 |borts..#|.#.2) Af|
|00004020| 74 65 72 20 61 6e 79 20 | 6f 72 69 67 69 6e 61 6c |ter any |original|
|00004030| 20 69 6e 76 65 72 74 65 | 64 20 69 6e 64 65 78 20 | inverte|d index |
|00004040| 66 69 6c 65 20 62 61 63 | 6b 75 70 20 69 73 20 72 |file bac|kup is r|
|00004050| 65 73 74 6f 72 65 64 2c | 0a 23 09 61 6c 6c 20 77 |estored,|.#.all w|
|00004060| 72 69 74 65 20 6f 70 65 | 72 61 74 69 6f 6e 73 20 |rite ope|rations |
|00004070| 74 6f 20 74 68 65 20 64 | 61 74 61 62 61 73 65 20 |to the d|atabase |
|00004080| 61 72 65 20 77 72 69 74 | 74 65 6e 20 74 6f 20 61 |are writ|ten to a|
|00004090| 0a 23 09 74 65 6d 70 6f | 72 61 72 79 20 66 69 6c |.#.tempo|rary fil|
|000040a0| 65 2d 69 6e 63 6c 75 64 | 69 6e 67 20 64 75 70 6c |e-includ|ing dupl|
|000040b0| 69 63 61 74 69 6f 6e 20 | 6f 66 20 61 6e 79 20 72 |ication |of any r|
|000040c0| 65 71 75 69 72 65 64 20 | 64 61 74 61 20 66 72 6f |equired |data fro|
|000040d0| 6d 0a 23 09 74 68 65 20 | 63 75 72 72 65 6e 74 20 |m.#.the |current |
|000040e0| 69 6e 76 65 72 74 65 64 | 20 69 6e 64 65 78 20 66 |inverted| index f|
|000040f0| 69 6c 65 2e 20 54 68 69 | 73 20 74 65 6d 70 6f 72 |ile. Thi|s tempor|
|00004100| 61 72 79 20 66 69 6c 65 | 20 77 69 6c 6c 0a 23 09 |ary file| will.#.|
|00004110| 62 65 63 6f 6d 65 20 74 | 68 65 20 6e 65 77 20 69 |become t|he new i|
|00004120| 6e 76 65 72 74 65 64 20 | 69 6e 64 65 78 20 66 69 |nverted |index fi|
|00004130| 6c 65 2e 20 49 66 20 74 | 68 65 73 65 20 6f 70 65 |le. If t|hese ope|
|00004140| 72 61 74 69 6f 6e 73 20 | 61 72 65 0a 23 09 73 75 |rations |are.#.su|
|00004150| 63 63 65 73 73 66 75 6c | 2c 20 74 68 65 6e 20 73 |ccessful|, then s|
|00004160| 74 65 70 20 33 29 20 69 | 73 20 65 78 65 63 75 74 |tep 3) i|s execut|
|00004170| 65 64 2c 20 69 66 20 6e | 6f 74 2c 20 74 68 65 20 |ed, if n|ot, the |
|00004180| 73 63 72 69 70 74 0a 23 | 09 61 62 6f 72 74 73 2e |script.#|.aborts.|
|00004190| 0a 23 0a 23 09 33 29 20 | 41 66 74 65 72 20 61 6c |.#.#.3) |After al|
|000041a0| 6c 20 77 72 69 74 65 20 | 6f 70 65 72 61 74 69 6f |l write |operatio|
|000041b0| 6e 73 20 61 72 65 20 63 | 6f 6d 70 6c 65 74 65 64 |ns are c|ompleted|
|000041c0| 2c 20 74 68 65 20 6f 72 | 69 67 69 6e 61 6c 0a 23 |, the or|iginal.#|
|000041d0| 09 69 6e 76 65 72 74 65 | 64 20 69 6e 64 65 78 20 |.inverte|d index |
|000041e0| 66 69 6c 65 20 69 73 20 | 62 61 63 6b 65 64 20 75 |file is |backed u|
|000041f0| 70 2c 20 75 73 69 6e 67 | 20 74 68 65 20 22 6d 76 |p, using| the "mv|
|00004200| 22 20 63 6f 6d 6d 61 6e | 64 2e 20 49 66 0a 23 09 |" comman|d. If.#.|
|00004210| 74 68 69 73 20 6f 70 65 | 72 61 74 69 6f 6e 20 73 |this ope|ration s|
|00004220| 75 63 63 65 73 73 66 75 | 6c 2c 20 74 68 65 6e 20 |uccessfu|l, then |
|00004230| 73 74 65 70 20 34 29 20 | 69 73 20 65 78 65 63 75 |step 4) |is execu|
|00004240| 74 65 64 2c 20 69 66 20 | 6e 6f 74 2c 0a 23 09 74 |ted, if |not,.#.t|
|00004250| 68 65 20 73 63 72 69 70 | 74 20 61 62 6f 72 74 73 |he scrip|t aborts|
|00004260| 2e 0a 23 0a 23 09 34 29 | 20 41 66 74 65 72 20 74 |..#.#.4)| After t|
|00004270| 68 65 20 6f 72 69 67 69 | 6e 61 6c 20 69 6e 76 65 |he origi|nal inve|
|00004280| 72 74 65 64 20 69 6e 64 | 65 78 20 66 69 6c 65 20 |rted ind|ex file |
|00004290| 68 61 73 20 62 65 65 6e | 20 62 61 63 6b 65 64 20 |has been| backed |
|000042a0| 75 70 2c 0a 23 09 74 68 | 65 20 74 65 6d 70 6f 72 |up,.#.th|e tempor|
|000042b0| 61 72 79 20 69 6e 76 65 | 72 74 65 64 20 69 6e 64 |ary inve|rted ind|
|000042c0| 65 78 20 66 69 6c 65 20 | 69 73 20 6d 6f 76 65 64 |ex file |is moved|
|000042d0| 2c 20 75 73 69 6e 67 20 | 74 68 65 20 22 6d 76 22 |, using |the "mv"|
|000042e0| 0a 23 09 63 6f 6d 6d 61 | 6e 64 2c 20 61 73 20 74 |.#.comma|nd, as t|
|000042f0| 68 65 20 6e 65 77 20 69 | 6e 76 65 72 74 65 64 20 |he new i|nverted |
|00004300| 69 6e 64 65 78 20 66 69 | 6c 65 2e 20 49 66 20 74 |index fi|le. If t|
|00004310| 68 69 73 20 6f 70 65 72 | 61 74 69 6f 6e 20 69 73 |his oper|ation is|
|00004320| 0a 23 09 73 75 63 63 65 | 73 73 66 75 6c 2c 20 74 |.#.succe|ssful, t|
|00004330| 68 65 6e 20 73 74 65 70 | 20 35 29 20 69 73 20 65 |hen step| 5) is e|
|00004340| 78 65 63 75 74 65 64 2c | 20 69 66 20 6e 6f 74 2c |xecuted,| if not,|
|00004350| 20 74 68 65 20 73 63 72 | 69 70 74 0a 23 09 61 62 | the scr|ipt.#.ab|
|00004360| 6f 72 74 73 2e 0a 23 0a | 23 09 35 29 20 41 66 74 |orts..#.|#.5) Aft|
|00004370| 65 72 20 74 68 65 20 74 | 65 6d 70 6f 72 61 72 79 |er the t|emporary|
|00004380| 20 69 6e 76 65 72 74 65 | 64 20 69 6e 64 65 78 20 | inverte|d index |
|00004390| 66 69 6c 65 20 68 61 73 | 20 62 65 65 6e 20 6d 6f |file has| been mo|
|000043a0| 76 65 64 2c 20 74 68 65 | 0a 23 09 6f 72 69 67 69 |ved, the|.#.origi|
|000043b0| 6e 61 6c 20 69 6e 76 65 | 72 74 65 64 20 69 6e 64 |nal inve|rted ind|
|000043c0| 65 78 20 66 69 6c 65 20 | 62 61 63 6b 75 70 20 69 |ex file |backup i|
|000043d0| 73 20 72 65 6d 6f 76 65 | 64 2e 20 49 66 20 74 68 |s remove|d. If th|
|000043e0| 69 73 0a 23 09 6f 70 65 | 72 61 74 69 6f 6e 20 69 |is.#.ope|ration i|
|000043f0| 73 20 73 75 63 63 65 73 | 73 66 75 6c 2c 20 74 68 |s succes|sful, th|
|00004400| 65 20 73 63 72 69 70 74 | 20 65 78 69 74 73 20 6e |e script| exits n|
|00004410| 6f 72 6d 61 6c 6c 79 2c | 20 69 66 20 6e 6f 74 2c |ormally,| if not,|
|00004420| 0a 23 09 74 68 65 20 73 | 63 72 69 70 74 20 61 62 |.#.the s|cript ab|
|00004430| 6f 72 74 73 2e 0a 23 0a | 23 20 4e 6f 74 65 20 74 |orts..#.|# Note t|
|00004440| 68 61 74 20 74 68 65 20 | 76 75 6c 6e 65 72 61 62 |hat the |vulnerab|
|00004450| 69 6c 69 74 79 20 69 73 | 20 69 6e 20 73 74 65 70 |ility is| in step|
|00004460| 73 20 33 29 2c 20 34 29 | 20 61 6e 64 20 35 29 2e |s 3), 4)| and 5).|
|00004470| 20 49 66 20 73 74 65 70 | 20 33 29 0a 23 20 66 61 | If step| 3).# fa|
|00004480| 69 6c 73 2c 20 74 68 65 | 6e 20 74 68 65 20 74 68 |ils, the|n the th|
|00004490| 65 20 6f 72 69 67 69 6e | 61 6c 20 69 6e 76 65 72 |e origin|al inver|
|000044a0| 74 65 64 20 69 6e 64 65 | 78 20 69 73 20 73 74 69 |ted inde|x is sti|
|000044b0| 6c 6c 20 69 6e 74 61 63 | 74 2c 20 61 6e 64 0a 23 |ll intac|t, and.#|
|000044c0| 20 74 68 65 72 65 20 69 | 73 20 6e 6f 20 62 61 63 | there i|s no bac|
|000044d0| 6b 75 70 20 28 6f 72 20 | 6e 65 65 64 20 66 6f 72 |kup (or |need for|
|000044e0| 20 6f 6e 65 2e 29 20 49 | 66 20 73 74 65 70 20 34 | one.) I|f step 4|
|000044f0| 29 20 66 61 69 6c 73 2c | 20 74 68 65 6e 20 74 68 |) fails,| then th|
|00004500| 65 72 65 20 69 73 0a 23 | 20 61 20 62 61 63 6b 75 |ere is.#| a backu|
|00004510| 70 20 61 6e 64 20 69 74 | 20 77 69 6c 6c 20 72 65 |p and it| will re|
|00004520| 73 74 6f 72 65 64 20 69 | 6e 20 73 74 65 70 20 31 |stored i|n step 1|
|00004530| 29 2e 20 49 66 20 73 74 | 65 70 20 35 29 20 66 61 |). If st|ep 5) fa|
|00004540| 69 6c 73 2c 20 74 68 65 | 6e 0a 23 20 74 68 65 72 |ils, the|n.# ther|
|00004550| 65 20 69 73 20 61 20 62 | 61 63 6b 75 70 20 61 6e |e is a b|ackup an|
|00004560| 64 20 69 74 20 77 69 6c | 6c 2c 20 61 6c 73 6f 2c |d it wil|l, also,|
|00004570| 20 62 65 20 72 65 73 74 | 6f 72 65 64 20 69 6e 20 | be rest|ored in |
|00004580| 73 74 65 70 20 31 29 2c | 0a 23 20 28 69 6e 61 64 |step 1),|.# (inad|
|00004590| 76 65 72 74 65 6e 74 6c | 79 20 64 65 73 74 72 6f |vertentl|y destro|
|000045a0| 79 69 6e 67 20 74 68 65 | 20 6e 65 77 20 69 6e 76 |ying the| new inv|
|000045b0| 65 72 74 65 64 20 69 6e | 64 65 78 20 66 69 6c 65 |erted in|dex file|
|000045c0| 2e 29 20 4e 6f 74 65 2c | 0a 23 20 61 64 64 69 74 |.) Note,|.# addit|
|000045d0| 69 6f 6e 61 6c 6c 79 2c | 20 74 68 61 74 20 73 74 |ionally,| that st|
|000045e0| 65 70 73 20 33 29 2c 20 | 34 29 2c 20 61 6e 64 20 |eps 3), |4), and |
|000045f0| 35 29 20 61 72 65 20 22 | 6c 6f 77 20 72 69 73 6b |5) are "|low risk|
|00004600| 22 20 6f 70 65 72 61 74 | 69 6f 6e 73 2c 0a 23 20 |" operat|ions,.# |
|00004610| 28 74 77 6f 20 22 6d 76 | 22 20 61 6e 64 20 6f 6e |(two "mv|" and on|
|00004620| 65 20 22 72 6d 22 20 6f | 70 65 72 61 74 69 6f 6e |e "rm" o|peration|
|00004630| 2c 29 20 61 6e 64 20 65 | 78 65 63 75 74 65 64 20 |,) and e|xecuted |
|00004640| 73 65 71 75 65 6e 74 69 | 61 6c 6c 79 2c 20 77 69 |sequenti|ally, wi|
|00004650| 74 68 20 6e 6f 0a 23 20 | 69 6e 74 65 72 76 65 6e |th no.# |interven|
|00004660| 69 6e 67 20 70 72 6f 67 | 72 61 6d 20 73 74 65 70 |ing prog|ram step|
|00004670| 73 2e 0a 58 0a 23 20 46 | 75 6e 63 74 69 6f 6e 20 |s..X.# F|unction |
|00004680| 74 6f 20 66 69 6e 64 20 | 74 68 65 20 70 72 6f 67 |to find |the prog|
|00004690| 72 61 6d 73 20 75 73 65 | 64 20 69 6e 20 74 68 69 |rams use|d in thi|
|000046a0| 73 20 73 63 72 69 70 74 | 2e 20 54 68 65 20 61 72 |s script|. The ar|
|000046b0| 67 75 6d 65 6e 74 73 20 | 61 72 65 0a 23 20 74 68 |guments |are.# th|
|000046c0| 65 20 63 68 6f 69 63 65 | 20 6f 66 20 70 61 74 68 |e choice| of path|
|000046d0| 73 20 74 6f 20 61 20 70 | 72 6f 67 72 61 6d 2c 20 |s to a p|rogram, |
|000046e0| 69 6e 20 70 72 65 63 65 | 64 65 6e 63 65 20 6f 66 |in prece|dence of|
|000046f0| 20 79 6f 75 72 20 66 69 | 72 73 74 20 63 68 6f 69 | your fi|rst choi|
|00004700| 63 65 2c 0a 23 20 73 65 | 63 6f 6e 64 20 63 68 6f |ce,.# se|cond cho|
|00004710| 69 63 65 2c 20 61 6e 64 | 20 73 6f 20 6f 6e 2e 0a |ice, and| so on..|
|00004720| 23 0a 23 20 4e 6f 74 65 | 20 74 68 61 74 20 74 68 |#.# Note| that th|
|00004730| 69 73 20 66 75 6e 63 74 | 69 6f 6e 20 69 73 20 6e |is funct|ion is n|
|00004740| 6f 74 20 65 66 66 69 63 | 69 65 6e 74 2e 20 44 75 |ot effic|ient. Du|
|00004750| 72 69 6e 67 20 69 6e 73 | 74 61 6c 6c 61 74 69 6f |ring ins|tallatio|
|00004760| 6e 2c 20 74 68 65 0a 23 | 20 70 61 74 68 73 20 73 |n, the.#| paths s|
|00004770| 68 6f 75 6c 64 20 62 65 | 20 68 61 72 64 20 63 6f |hould be| hard co|
|00004780| 64 65 64 2c 20 61 6e 64 | 20 74 68 69 73 20 66 75 |ded, and| this fu|
|00004790| 6e 63 74 69 6f 6e 20 72 | 65 6d 6f 76 65 64 2e 0a |nction r|emoved..|
|000047a0| 58 0a 66 69 6e 64 5f 70 | 72 6f 67 72 61 6d 28 29 |X.find_p|rogram()|
|000047b0| 0a 7b 0a 58 20 20 20 20 | 23 20 49 66 20 6e 6f 20 |.{.X |# If no |
|000047c0| 61 72 67 75 6d 65 6e 74 | 73 2c 20 65 78 69 74 2e |argument|s, exit.|
|000047d0| 0a 58 0a 58 20 20 20 20 | 69 66 20 5b 20 22 24 23 |.X.X |if [ "$#|
|000047e0| 22 20 2d 65 71 20 22 30 | 22 20 5d 3b 20 74 68 65 |" -eq "0|" ]; the|
|000047f0| 6e 0a 58 09 24 7b 45 43 | 48 4f 7d 20 22 4e 6f 20 |n.X.${EC|HO} "No |
|00004800| 70 72 6f 67 72 61 6d 20 | 6e 61 6d 65 20 73 70 65 |program |name spe|
|00004810| 63 69 66 69 65 64 2c 20 | 61 62 6f 72 74 69 6e 67 |cified, |aborting|
|00004820| 2e 22 20 31 3e 26 32 0a | 58 09 65 78 69 74 20 31 |." 1>&2.|X.exit 1|
|00004830| 0a 58 20 20 20 20 66 69 | 0a 58 0a 58 20 20 20 20 |.X fi|.X.X |
|00004840| 23 20 53 61 76 65 20 74 | 68 65 20 66 69 72 73 74 |# Save t|he first|
|00004850| 20 61 72 67 75 6d 65 6e | 74 27 73 20 62 61 73 65 | argumen|t's base|
|00004860| 6e 61 6d 65 20 66 6f 72 | 20 65 72 72 6f 72 20 72 |name for| error r|
|00004870| 65 70 6f 72 74 69 6e 67 | 2e 0a 58 0a 58 20 20 20 |eporting|..X.X |
|00004880| 20 70 72 6f 67 72 61 6d | 5f 62 61 73 65 3d 60 62 | program|_base=`b|
|00004890| 61 73 65 6e 61 6d 65 20 | 24 31 60 0a 58 0a 58 20 |asename |$1`.X.X |
|000048a0| 20 20 20 23 20 46 6f 72 | 20 65 61 63 68 20 61 72 | # For| each ar|
|000048b0| 67 75 6d 65 6e 74 2c 20 | 74 65 73 74 20 69 66 20 |gument, |test if |
|000048c0| 74 68 65 20 66 69 6c 65 | 20 6e 61 6d 65 20 65 78 |the file| name ex|
|000048d0| 69 73 74 73 2c 20 61 6e | 64 20 69 73 0a 58 20 20 |ists, an|d is.X |
|000048e0| 20 20 23 20 65 78 65 63 | 75 74 61 62 6c 65 2e 0a | # exec|utable..|
|000048f0| 58 0a 58 20 20 20 20 77 | 68 69 6c 65 20 5b 20 22 |X.X w|hile [ "|
|00004900| 24 23 22 20 2d 6e 65 20 | 22 30 22 20 5d 0a 58 20 |$#" -ne |"0" ].X |
|00004910| 20 20 20 64 6f 0a 58 09 | 69 66 20 5b 20 2d 78 20 | do.X.|if [ -x |
|00004920| 22 24 31 22 20 5d 3b 20 | 74 68 65 6e 0a 58 09 20 |"$1" ]; |then.X. |
|00004930| 20 20 20 24 7b 45 43 48 | 4f 7d 20 22 24 31 22 0a | ${ECH|O} "$1".|
|00004940| 58 09 20 20 20 20 72 65 | 74 75 72 6e 0a 58 09 66 |X. re|turn.X.f|
|00004950| 69 0a 58 09 73 68 69 66 | 74 0a 58 20 20 20 20 64 |i.X.shif|t.X d|
|00004960| 6f 6e 65 0a 58 0a 58 20 | 20 20 20 23 20 4e 6f 6e |one.X.X | # Non|
|00004970| 65 20 6f 66 20 74 68 65 | 20 66 69 6c 65 20 6e 61 |e of the| file na|
|00004980| 6d 65 20 61 72 67 75 6d | 65 6e 74 73 20 77 65 72 |me argum|ents wer|
|00004990| 65 20 66 6f 75 6e 64 2c | 20 65 78 69 74 20 77 69 |e found,| exit wi|
|000049a0| 74 68 20 74 68 65 20 65 | 72 72 6f 72 2e 0a 58 0a |th the e|rror..X.|
|000049b0| 58 20 20 20 20 24 7b 45 | 43 48 4f 7d 20 22 50 72 |X ${E|CHO} "Pr|
|000049c0| 6f 67 72 61 6d 20 6e 6f | 74 20 66 6f 75 6e 64 2c |ogram no|t found,|
|000049d0| 20 24 70 72 6f 67 72 61 | 6d 5f 62 61 73 65 2c 20 | $progra|m_base, |
|000049e0| 61 62 6f 72 74 69 6e 67 | 2e 22 20 31 3e 26 32 0a |aborting|." 1>&2.|
|000049f0| 58 20 20 20 20 65 78 69 | 74 20 31 0a 7d 0a 58 0a |X exi|t 1.}.X.|
|00004a00| 23 20 41 73 73 75 6d 65 | 20 61 6e 20 65 63 68 6f |# Assume| an echo|
|00004a10| 20 69 73 20 69 6e 20 74 | 68 65 20 70 61 74 68 20 | is in t|he path |
|00004a20| 66 6f 72 20 66 69 6e 64 | 5f 70 72 6f 67 72 61 6d |for find|_program|
|00004a30| 28 29 2e 0a 58 0a 45 43 | 48 4f 3d 65 63 68 6f 0a |()..X.EC|HO=echo.|
|00004a40| 58 0a 43 41 54 3d 60 66 | 69 6e 64 5f 70 72 6f 67 |X.CAT=`f|ind_prog|
|00004a50| 72 61 6d 20 2f 75 73 72 | 2f 62 69 6e 2f 63 61 74 |ram /usr|/bin/cat|
|00004a60| 60 0a 43 50 3d 60 66 69 | 6e 64 5f 70 72 6f 67 72 |`.CP=`fi|nd_progr|
|00004a70| 61 6d 20 2f 75 73 72 2f | 62 69 6e 2f 63 70 60 0a |am /usr/|bin/cp`.|
|00004a80| 58 0a 23 20 46 6f 72 20 | 53 75 6e 4f 53 20 34 2e |X.# For |SunOS 4.|
|00004a90| 31 2e 78 2c 20 75 73 65 | 20 74 68 65 20 53 79 73 |1.x, use| the Sys|
|00004aa0| 56 20 76 65 72 73 69 6f | 6e 20 6f 66 20 65 63 68 |V versio|n of ech|
|00004ab0| 6f 2c 20 69 6e 20 2f 75 | 73 72 2f 35 62 69 6e 2f |o, in /u|sr/5bin/|
|00004ac0| 65 63 68 6f 2c 20 61 6c | 6c 0a 23 20 6f 74 68 65 |echo, al|l.# othe|
|00004ad0| 72 73 20 75 73 65 20 2f | 75 73 72 2f 62 69 6e 2f |rs use /|usr/bin/|
|00004ae0| 65 63 68 6f 2e 0a 58 0a | 45 43 48 4f 3d 60 66 69 |echo..X.|ECHO=`fi|
|00004af0| 6e 64 5f 70 72 6f 67 72 | 61 6d 20 2f 75 73 72 2f |nd_progr|am /usr/|
|00004b00| 35 62 69 6e 2f 65 63 68 | 6f 20 2f 75 73 72 2f 62 |5bin/ech|o /usr/b|
|00004b10| 69 6e 2f 65 63 68 6f 60 | 0a 45 47 52 45 50 3d 60 |in/echo`|.EGREP=`|
|00004b20| 66 69 6e 64 5f 70 72 6f | 67 72 61 6d 20 2f 75 73 |find_pro|gram /us|
|00004b30| 72 2f 62 69 6e 2f 65 67 | 72 65 70 60 0a 4a 4f 49 |r/bin/eg|rep`.JOI|
|00004b40| 4e 3d 60 66 69 6e 64 5f | 70 72 6f 67 72 61 6d 20 |N=`find_|program |
|00004b50| 2f 75 73 72 2f 62 69 6e | 2f 6a 6f 69 6e 60 0a 58 |/usr/bin|/join`.X|
|00004b60| 0a 23 20 46 6f 72 20 53 | 79 73 56 20 52 65 6c 2e |.# For S|ysV Rel.|
|00004b70| 20 34 2e 78 2c 20 74 68 | 65 20 6c 6f 6f 6b 20 70 | 4.x, th|e look p|
|00004b80| 72 6f 67 72 61 6d 20 72 | 65 73 69 64 65 73 20 69 |rogram r|esides i|
|00004b90| 6e 20 2f 75 73 72 2f 75 | 63 62 2f 6c 6f 6f 6b 2c |n /usr/u|cb/look,|
|00004ba0| 20 61 6c 6c 0a 23 20 6f | 74 68 65 72 73 20 75 73 | all.# o|thers us|
|00004bb0| 65 20 2f 75 73 72 2f 62 | 69 6e 2f 6c 6f 6f 6b 2e |e /usr/b|in/look.|
|00004bc0| 0a 58 0a 4c 4f 4f 4b 3d | 60 66 69 6e 64 5f 70 72 |.X.LOOK=|`find_pr|
|00004bd0| 6f 67 72 61 6d 20 2f 75 | 73 72 2f 62 69 6e 2f 6c |ogram /u|sr/bin/l|
|00004be0| 6f 6f 6b 20 2f 75 73 72 | 2f 75 63 62 2f 6c 6f 6f |ook /usr|/ucb/loo|
|00004bf0| 6b 60 0a 4d 56 3d 60 66 | 69 6e 64 5f 70 72 6f 67 |k`.MV=`f|ind_prog|
|00004c00| 72 61 6d 20 2f 75 73 72 | 2f 62 69 6e 2f 6d 76 60 |ram /usr|/bin/mv`|
|00004c10| 0a 52 4d 3d 60 66 69 6e | 64 5f 70 72 6f 67 72 61 |.RM=`fin|d_progra|
|00004c20| 6d 20 2f 75 73 72 2f 62 | 69 6e 2f 72 6d 60 0a 53 |m /usr/b|in/rm`.S|
|00004c30| 45 44 3d 60 66 69 6e 64 | 5f 70 72 6f 67 72 61 6d |ED=`find|_program|
|00004c40| 20 2f 75 73 72 2f 62 69 | 6e 2f 73 65 64 60 0a 53 | /usr/bi|n/sed`.S|
|00004c50| 4f 52 54 3d 60 66 69 6e | 64 5f 70 72 6f 67 72 61 |ORT=`fin|d_progra|
|00004c60| 6d 20 2f 75 73 72 2f 62 | 69 6e 2f 73 6f 72 74 60 |m /usr/b|in/sort`|
|00004c70| 0a 58 0a 23 20 46 6f 72 | 20 74 68 65 20 44 45 43 |.X.# For| the DEC|
|00004c80| 20 41 4c 50 48 41 20 33 | 30 30 30 2c 20 74 68 65 | ALPHA 3|000, the|
|00004c90| 20 73 79 6e 63 20 70 72 | 6f 67 72 61 6d 20 72 65 | sync pr|ogram re|
|00004ca0| 73 69 64 65 73 20 69 6e | 20 2f 75 73 72 2f 73 62 |sides in| /usr/sb|
|00004cb0| 69 6e 2f 73 79 6e 63 2c | 0a 23 20 61 6c 6c 20 6f |in/sync,|.# all o|
|00004cc0| 74 68 65 72 73 20 75 73 | 65 20 2f 75 73 72 2f 62 |thers us|e /usr/b|
|00004cd0| 69 6e 2f 73 79 6e 63 2e | 0a 58 0a 53 59 4e 43 3d |in/sync.|.X.SYNC=|
|00004ce0| 60 66 69 6e 64 5f 70 72 | 6f 67 72 61 6d 20 2f 75 |`find_pr|ogram /u|
|00004cf0| 73 72 2f 62 69 6e 2f 73 | 79 6e 63 20 2f 75 73 72 |sr/bin/s|ync /usr|
|00004d00| 2f 73 62 69 6e 2f 73 79 | 6e 63 60 0a 58 0a 23 20 |/sbin/sy|nc`.X.# |
|00004d10| 46 6f 72 20 53 75 6e 4f | 53 20 34 2e 31 2e 78 2c |For SunO|S 4.1.x,|
|00004d20| 20 75 73 65 20 74 68 65 | 20 53 79 73 56 20 76 65 | use the| SysV ve|
|00004d30| 72 73 69 6f 6e 20 6f 66 | 20 74 72 2c 20 69 6e 20 |rsion of| tr, in |
|00004d40| 2f 75 73 72 2f 35 62 69 | 6e 2f 74 72 2c 20 61 6c |/usr/5bi|n/tr, al|
|00004d50| 6c 0a 23 20 6f 74 68 65 | 72 73 20 75 73 65 20 2f |l.# othe|rs use /|
|00004d60| 75 73 72 2f 62 69 6e 2f | 74 72 2e 0a 58 0a 54 52 |usr/bin/|tr..X.TR|
|00004d70| 3d 60 66 69 6e 64 5f 70 | 72 6f 67 72 61 6d 20 2f |=`find_p|rogram /|
|00004d80| 75 73 72 2f 35 62 69 6e | 2f 74 72 20 2f 75 73 72 |usr/5bin|/tr /usr|
|00004d90| 2f 62 69 6e 2f 74 72 60 | 0a 55 4e 49 51 3d 60 66 |/bin/tr`|.UNIQ=`f|
|00004da0| 69 6e 64 5f 70 72 6f 67 | 72 61 6d 20 2f 75 73 72 |ind_prog|ram /usr|
|00004db0| 2f 62 69 6e 2f 75 6e 69 | 71 60 0a 58 0a 23 20 44 |/bin/uni|q`.X.# D|
|00004dc0| 65 66 61 75 6c 74 20 69 | 6e 76 65 72 74 65 64 20 |efault i|nverted |
|00004dd0| 69 6e 64 65 78 20 66 69 | 6c 65 20 6e 61 6d 65 2e |index fi|le name.|
|00004de0| 0a 58 0a 44 42 5f 4e 41 | 4d 45 3d 22 71 74 2e 69 |.X.DB_NA|ME="qt.i|
|00004df0| 6e 64 65 78 22 0a 58 0a | 23 20 44 65 66 61 75 6c |ndex".X.|# Defaul|
|00004e00| 74 20 74 65 6d 70 6f 72 | 61 72 79 20 69 6e 76 65 |t tempor|ary inve|
|00004e10| 72 74 65 64 20 69 6e 64 | 65 78 20 66 69 6c 65 20 |rted ind|ex file |
|00004e20| 62 61 73 65 20 6e 61 6d | 65 2e 0a 58 0a 54 4d 50 |base nam|e..X.TMP|
|00004e30| 5f 4e 41 4d 45 3d 22 71 | 74 2e 69 6e 64 65 78 22 |_NAME="q|t.index"|
|00004e40| 0a 58 0a 23 20 49 66 20 | 74 68 65 20 65 6e 76 69 |.X.# If |the envi|
|00004e50| 72 6f 6e 6d 65 6e 74 61 | 6c 20 76 61 72 69 61 62 |ronmenta|l variab|
|00004e60| 6c 65 2c 20 54 4d 50 44 | 49 52 2c 20 65 78 69 73 |le, TMPD|IR, exis|
|00004e70| 74 73 2c 20 74 68 65 6e | 20 74 68 61 74 20 64 69 |ts, then| that di|
|00004e80| 72 65 63 74 6f 72 79 0a | 23 20 77 69 6c 6c 20 62 |rectory.|# will b|
|00004e90| 65 20 75 73 65 64 20 66 | 6f 72 20 61 6c 6c 20 74 |e used f|or all t|
|00004ea0| 65 6d 70 6f 72 61 72 79 | 20 66 69 6c 65 73 2c 20 |emporary| files, |
|00004eb0| 69 66 20 6e 6f 74 2c 20 | 74 68 65 6e 20 2f 74 6d |if not, |then /tm|
|00004ec0| 70 20 77 69 6c 6c 20 62 | 65 20 75 73 65 64 2e 0a |p will b|e used..|
|00004ed0| 23 20 54 68 65 20 74 65 | 6d 70 6f 72 61 72 79 20 |# The te|mporary |
|00004ee0| 66 69 6c 65 20 6e 61 6d | 65 73 20 69 6e 20 54 4d |file nam|es in TM|
|00004ef0| 50 44 49 52 20 61 72 65 | 20 61 6c 77 61 79 73 20 |PDIR are| always |
|00004f00| 74 68 65 20 62 61 73 65 | 6e 61 6d 65 20 6f 66 20 |the base|name of |
|00004f10| 74 68 65 0a 23 20 64 61 | 74 61 62 61 73 65 2c 20 |the.# da|tabase, |
|00004f20| 63 6f 6e 63 61 74 65 6e | 61 74 65 64 20 77 69 74 |concaten|ated wit|
|00004f30| 68 20 61 20 27 2d 27 2c | 20 61 20 75 6e 69 71 75 |h a '-',| a uniqu|
|00004f40| 65 20 63 68 61 72 61 63 | 74 65 72 20 74 68 61 74 |e charac|ter that|
|00004f50| 20 69 64 65 6e 74 69 66 | 69 65 73 0a 23 20 74 68 | identif|ies.# th|
|00004f60| 65 20 74 65 6d 70 6f 72 | 61 72 79 20 66 69 6c 65 |e tempor|ary file|
|00004f70| 20 74 6f 20 74 68 69 73 | 20 73 63 72 69 70 74 2c | to this| script,|
|00004f80| 20 61 20 27 2e 27 2c 20 | 61 6e 64 20 74 68 69 73 | a '.', |and this|
|00004f90| 20 73 63 72 69 70 74 27 | 73 20 70 69 64 2e 0a 58 | script'|s pid..X|
|00004fa0| 0a 23 20 54 65 6d 70 6f | 72 61 72 79 20 66 69 6c |.# Tempo|rary fil|
|00004fb0| 65 20 64 69 72 65 63 74 | 6f 72 79 20 6e 61 6d 65 |e direct|ory name|
|00004fc0| 2e 0a 58 0a 54 45 4d 50 | 5f 44 49 52 3d 22 24 7b |..X.TEMP|_DIR="${|
|00004fd0| 54 4d 50 44 49 52 3a 2d | 2f 74 6d 70 7d 22 0a 58 |TMPDIR:-|/tmp}".X|
|00004fe0| 0a 23 20 54 65 6d 70 6f | 72 61 72 79 20 69 6e 76 |.# Tempo|rary inv|
|00004ff0| 65 72 74 65 64 20 69 6e | 64 65 78 20 66 69 6c 65 |erted in|dex file|
|00005000| 20 6e 61 6d 65 2e 20 54 | 68 65 72 65 20 61 72 65 | name. T|here are|
|00005010| 20 74 77 6f 20 61 6c 74 | 65 72 6e 61 74 69 76 65 | two alt|ernative|
|00005020| 73 20 68 65 72 65 2e 0a | 23 20 54 68 65 20 64 61 |s here..|# The da|
|00005030| 74 61 62 61 73 65 20 69 | 73 20 75 70 64 61 74 65 |tabase i|s update|
|00005040| 64 20 62 79 20 62 61 63 | 6b 69 6e 67 20 75 70 20 |d by bac|king up |
|00005050| 74 68 65 20 63 75 72 72 | 65 6e 74 20 64 61 74 61 |the curr|ent data|
|00005060| 62 61 73 65 20 28 77 69 | 74 68 20 74 68 65 0a 23 |base (wi|th the.#|
|00005070| 20 24 7b 4d 56 7d 20 63 | 6f 6d 6d 61 6e 64 29 20 | ${MV} c|ommand) |
|00005080| 74 6f 20 61 20 64 69 66 | 66 65 72 65 6e 74 20 6e |to a dif|ferent n|
|00005090| 61 6d 65 20 69 6e 20 69 | 74 73 20 63 75 72 72 65 |ame in i|ts curre|
|000050a0| 6e 74 20 64 69 72 65 63 | 74 6f 72 79 2e 20 54 68 |nt direc|tory. Th|
|000050b0| 65 6e 20 74 68 65 0a 23 | 20 6e 65 77 20 64 61 74 |en the.#| new dat|
|000050c0| 61 62 61 73 65 20 69 73 | 20 6d 6f 76 65 64 20 28 |abase is| moved (|
|000050d0| 61 67 61 69 6e 20 77 69 | 74 68 20 74 68 65 20 24 |again wi|th the $|
|000050e0| 7b 4d 56 7d 20 63 6f 6d | 6d 61 6e 64 29 20 66 72 |{MV} com|mand) fr|
|000050f0| 6f 6d 20 69 74 73 0a 23 | 20 74 65 6d 70 6f 72 61 |om its.#| tempora|
|00005100| 72 79 20 6e 61 6d 65 20 | 74 6f 20 74 68 65 20 64 |ry name |to the d|
|00005110| 61 74 61 62 61 73 65 20 | 6e 61 6d 65 2e 20 49 6e |atabase |name. In|
|00005120| 20 73 6f 6d 65 20 73 79 | 73 74 65 6d 73 2c 20 69 | some sy|stems, i|
|00005130| 66 20 74 68 65 20 2f 74 | 6d 70 0a 23 20 64 69 72 |f the /t|mp.# dir|
|00005140| 65 63 74 6f 72 79 20 69 | 73 20 6f 6e 20 61 20 64 |ectory i|s on a d|
|00005150| 69 66 66 65 72 65 6e 74 | 20 64 69 73 6b 20 70 61 |ifferent| disk pa|
|00005160| 72 74 69 74 69 6f 6e 2c | 20 24 7b 4d 56 7d 20 77 |rtition,| ${MV} w|
|00005170| 69 6c 6c 20 68 61 76 65 | 20 74 6f 20 63 6f 70 79 |ill have| to copy|
|00005180| 0a 23 20 74 68 65 20 64 | 61 74 61 20 61 63 72 6f |.# the d|ata acro|
|00005190| 73 73 20 74 68 65 20 66 | 69 6c 65 20 73 79 73 74 |ss the f|ile syst|
|000051a0| 65 6d 73 20 74 6f 20 70 | 65 72 66 6f 72 6d 20 74 |ems to p|erform t|
|000051b0| 68 65 20 6d 6f 76 65 2e | 20 44 75 72 69 6e 67 20 |he move.| During |
|000051c0| 74 68 69 73 0a 23 20 74 | 69 6d 65 2c 20 74 68 65 |this.# t|ime, the|
|000051d0| 20 64 61 74 61 62 61 73 | 65 20 69 73 20 76 75 6c | databas|e is vul|
|000051e0| 6e 65 72 61 62 6c 65 20 | 74 6f 20 70 6f 77 65 72 |nerable |to power|
|000051f0| 20 6f 75 74 61 67 65 73 | 2c 20 65 74 63 2e 20 49 | outages|, etc. I|
|00005200| 66 20 74 68 65 0a 23 20 | 74 65 6d 70 6f 72 61 72 |f the.# |temporar|
|00005210| 79 20 64 61 74 61 62 61 | 73 65 20 69 73 20 69 6e |y databa|se is in|
|00005220| 20 74 68 65 20 73 61 6d | 65 20 64 69 72 65 63 74 | the sam|e direct|
|00005230| 6f 72 79 20 61 73 20 74 | 68 65 20 63 75 72 72 65 |ory as t|he curre|
|00005240| 6e 74 20 64 61 74 61 62 | 61 73 65 2c 0a 23 20 74 |nt datab|ase,.# t|
|00005250| 68 65 20 75 70 64 61 74 | 65 20 77 69 6c 6c 20 6e |he updat|e will n|
|00005260| 6f 74 20 69 6e 76 6f 6c | 76 65 20 61 6e 79 20 64 |ot invol|ve any d|
|00005270| 61 74 61 20 74 72 61 6e | 73 66 65 72 20 6f 6e 20 |ata tran|sfer on |
|00005280| 74 68 65 20 64 69 73 6b | 20 28 69 65 2e 2c 20 6f |the disk| (ie., o|
|00005290| 6e 6c 79 0a 23 20 61 20 | 6e 61 6d 65 20 63 68 61 |nly.# a |name cha|
|000052a0| 6e 67 65 2e 29 20 4f 6e | 20 6f 6e 65 20 68 61 6e |nge.) On| one han|
|000052b0| 64 2c 20 63 6f 6e 73 74 | 72 75 63 74 69 6e 67 20 |d, const|ructing |
|000052c0| 74 68 65 20 74 65 6d 70 | 6f 72 61 72 79 20 64 61 |the temp|orary da|
|000052d0| 74 61 62 61 73 65 20 69 | 6e 0a 23 20 69 74 73 20 |tabase i|n.# its |
|000052e0| 68 6f 6d 65 20 64 69 72 | 65 63 74 6f 72 79 20 6c |home dir|ectory l|
|000052f0| 6f 77 65 72 73 20 74 68 | 65 20 72 69 73 6b 20 6f |owers th|e risk o|
|00005300| 66 20 63 6f 72 72 75 70 | 74 69 6f 6e 20 69 66 20 |f corrup|tion if |
|00005310| 74 68 65 20 6d 61 63 68 | 69 6e 65 20 67 6f 65 73 |the mach|ine goes|
|00005320| 0a 23 20 64 6f 77 6e 2c | 20 62 75 74 20 6f 6e 20 |.# down,| but on |
|00005330| 74 68 65 20 6f 74 68 65 | 72 20 68 61 6e 64 2c 20 |the othe|r hand, |
|00005340| 69 74 20 63 6f 75 6c 64 | 20 6c 65 61 76 65 20 74 |it could| leave t|
|00005350| 68 65 20 74 65 6d 70 6f | 72 61 72 79 20 66 69 6c |he tempo|rary fil|
|00005360| 65 2d 77 68 69 63 68 0a | 23 20 63 61 6e 20 62 65 |e-which.|# can be|
|00005370| 20 6c 61 72 67 65 2d 77 | 68 65 6e 20 74 68 65 20 | large-w|hen the |
|00005380| 6d 61 63 68 69 6e 65 20 | 63 6f 6d 65 73 20 75 70 |machine |comes up|
|00005390| 2e 20 28 4e 6f 74 65 20 | 74 68 61 74 20 74 68 65 |. (Note |that the|
|000053a0| 20 2f 74 6d 70 20 64 69 | 72 65 63 74 6f 72 79 0a | /tmp di|rectory.|
|000053b0| 23 20 69 73 20 70 75 72 | 67 65 64 20 64 75 72 69 |# is pur|ged duri|
|000053c0| 6e 67 20 74 68 65 20 62 | 6f 6f 74 20 70 72 6f 63 |ng the b|oot proc|
|000053d0| 65 73 73 2e 29 20 54 68 | 65 20 74 77 6f 20 6f 70 |ess.) Th|e two op|
|000053e0| 74 69 6f 6e 73 20 61 72 | 65 3a 0a 58 0a 23 20 54 |tions ar|e:.X.# T|
|000053f0| 4d 50 5f 44 42 3d 22 24 | 7b 54 45 4d 50 5f 44 49 |MP_DB="$|{TEMP_DI|
|00005400| 52 7d 2f 24 7b 54 4d 50 | 5f 4e 41 4d 45 7d 2d 31 |R}/${TMP|_NAME}-1|
|00005410| 2e 24 24 22 0a 54 4d 50 | 5f 44 42 3d 22 24 7b 44 |.$$".TMP|_DB="${D|
|00005420| 42 5f 4e 41 4d 45 7d 2e | 4e 45 57 22 0a 58 0a 23 |B_NAME}.|NEW".X.#|
|00005430| 20 4c 69 73 74 20 6f 66 | 20 61 6c 6c 20 74 65 6d | List of| all tem|
|00005440| 70 6f 72 61 72 79 20 66 | 69 6c 65 73 3a 0a 23 0a |porary f|iles:.#.|
|00005450| 23 09 22 24 7b 54 45 4d | 50 5f 44 49 52 7d 2f 24 |#."${TEM|P_DIR}/$|
|00005460| 7b 54 4d 50 5f 4e 41 4d | 45 7d 2d 31 2e 24 24 22 |{TMP_NAM|E}-1.$$"|
|00005470| 2c 20 69 73 20 74 68 65 | 20 74 65 6d 70 6f 72 61 |, is the| tempora|
|00005480| 72 79 20 66 69 6c 65 20 | 6e 61 6d 65 20 6f 66 0a |ry file |name of.|
|00005490| 23 09 74 68 65 20 6e 65 | 77 20 69 6e 76 65 72 74 |#.the ne|w invert|
|000054a0| 65 64 20 69 6e 64 65 78 | 20 66 69 6c 65 2e 20 28 |ed index| file. (|
|000054b0| 45 69 74 68 65 72 20 69 | 6e 20 72 65 61 64 20 6f |Either i|n read o|
|000054c0| 72 20 77 72 69 74 65 20 | 6d 6f 64 65 73 2e 29 0a |r write |modes.).|
|000054d0| 23 0a 23 09 22 24 7b 54 | 45 4d 50 5f 44 49 52 7d |#.#."${T|EMP_DIR}|
|000054e0| 2f 24 7b 54 4d 50 5f 4e | 41 4d 45 7d 2d 32 2e 24 |/${TMP_N|AME}-2.$|
|000054f0| 24 22 2c 20 69 73 20 74 | 68 65 20 74 65 6d 70 6f |$", is t|he tempo|
|00005500| 72 61 72 79 20 66 69 6c | 65 20 6e 61 6d 65 0a 23 |rary fil|e name.#|
|00005510| 09 77 68 65 72 65 20 61 | 6e 79 74 68 69 6e 67 20 |.where a|nything |
|00005520| 74 68 61 74 20 69 73 20 | 74 6f 20 62 65 20 61 64 |that is |to be ad|
|00005530| 64 65 64 20 74 6f 20 74 | 68 65 20 69 6e 76 65 72 |ded to t|he inver|
|00005540| 74 65 64 20 69 6e 64 65 | 78 20 66 69 6c 65 0a 23 |ted inde|x file.#|
|00005550| 09 69 73 20 74 65 6d 70 | 6f 72 61 72 69 6c 79 20 |.is temp|orarily |
|00005560| 68 65 6c 64 2e 20 20 28 | 45 69 74 68 65 72 20 69 |held. (|Either i|
|00005570| 6e 20 72 65 61 64 20 6f | 72 20 77 72 69 74 65 20 |n read o|r write |
|00005580| 6d 6f 64 65 73 2e 29 0a | 23 0a 23 09 22 24 7b 54 |modes.).|#.#."${T|
|00005590| 45 4d 50 5f 44 49 52 7d | 2f 24 7b 54 4d 50 5f 4e |EMP_DIR}|/${TMP_N|
|000055a0| 41 4d 45 7d 2d 33 2e 24 | 24 22 2c 20 69 73 20 74 |AME}-3.$|$", is t|
|000055b0| 68 65 20 74 65 6d 70 6f | 72 61 72 79 20 66 69 6c |he tempo|rary fil|
|000055c0| 65 20 6e 61 6d 65 0a 23 | 09 77 68 65 72 65 20 61 |e name.#|.where a|
|000055d0| 6e 79 74 68 69 6e 67 20 | 74 68 61 74 20 69 73 20 |nything |that is |
|000055e0| 74 6f 20 62 65 20 61 64 | 64 65 64 20 74 6f 20 74 |to be ad|ded to t|
|000055f0| 68 65 20 69 6e 76 65 72 | 74 65 64 20 69 6e 64 65 |he inver|ted inde|
|00005600| 78 20 66 69 6c 65 0a 23 | 09 69 73 20 74 65 6d 70 |x file.#|.is temp|
|00005610| 6f 72 61 72 69 6c 79 20 | 68 65 6c 64 2e 20 20 28 |orarily |held. (|
|00005620| 49 6e 20 72 65 61 64 20 | 6d 6f 64 65 20 6f 6e 6c |In read |mode onl|
|00005630| 79 2e 29 0a 23 0a 23 09 | 22 24 7b 54 45 4d 50 5f |y.).#.#.|"${TEMP_|
|00005640| 44 49 52 7d 2f 24 7b 54 | 4d 50 5f 4e 41 4d 45 7d |DIR}/${T|MP_NAME}|
|00005650| 2d 45 2e 24 24 22 2c 20 | 69 73 20 61 20 74 65 6d |-E.$$", |is a tem|
|00005660| 70 6f 72 61 72 79 20 66 | 69 6c 65 20 6e 61 6d 65 |porary f|ile name|
|00005670| 20 74 68 61 74 0a 23 09 | 63 6f 6e 74 61 69 6e 73 | that.#.|contains|
|00005680| 20 69 6e 66 6f 72 6d 61 | 74 69 6f 6e 20 61 62 6f | informa|tion abo|
|00005690| 75 74 20 65 72 72 6f 72 | 20 63 6f 6e 64 69 74 69 |ut error| conditi|
|000056a0| 6f 6e 73 2e 20 49 66 20 | 69 74 20 64 6f 65 73 20 |ons. If |it does |
|000056b0| 6e 6f 74 0a 23 09 65 78 | 69 73 74 2c 20 6f 72 20 |not.#.ex|ist, or |
|000056c0| 65 78 69 73 74 73 20 61 | 6e 64 20 69 73 20 7a 65 |exists a|nd is ze|
|000056d0| 72 6f 20 6c 65 6e 67 74 | 68 2c 20 74 68 65 6e 20 |ro lengt|h, then |
|000056e0| 6e 6f 20 65 72 72 6f 72 | 20 6f 63 63 75 72 65 64 |no error| occured|
|000056f0| 2e 0a 58 0a 54 45 4d 50 | 5f 46 49 4c 45 53 3d 22 |..X.TEMP|_FILES="|
|00005700| 24 7b 54 45 4d 50 5f 44 | 49 52 7d 2f 24 7b 54 4d |${TEMP_D|IR}/${TM|
|00005710| 50 5f 4e 41 4d 45 7d 2d | 31 2e 24 24 20 24 7b 54 |P_NAME}-|1.$$ ${T|
|00005720| 45 4d 50 5f 44 49 52 7d | 2f 24 7b 54 4d 50 5f 4e |EMP_DIR}|/${TMP_N|
|00005730| 41 4d 45 7d 2d 32 2e 24 | 24 20 24 7b 54 45 4d 50 |AME}-2.$|$ ${TEMP|
|00005740| 5f 44 49 52 7d 2f 24 7b | 54 4d 50 5f 4e 41 4d 45 |_DIR}/${|TMP_NAME|
|00005750| 7d 2d 33 2e 24 24 20 24 | 7b 54 45 4d 50 5f 44 49 |}-3.$$ $|{TEMP_DI|
|00005760| 52 7d 2f 24 7b 54 4d 50 | 5f 4e 41 4d 45 7d 2d 45 |R}/${TMP|_NAME}-E|
|00005770| 2e 24 24 20 24 7b 54 4d | 50 5f 44 42 7d 22 0a 58 |.$$ ${TM|P_DB}".X|
|00005780| 0a 23 20 44 65 66 61 75 | 6c 74 20 6c 65 78 69 63 |.# Defau|lt lexic|
|00005790| 61 6c 20 61 6e 61 6c 79 | 7a 65 72 2e 0a 58 0a 4c |al analy|zer..X.L|
|000057a0| 45 58 49 43 4f 3d 34 0a | 58 0a 23 20 52 45 4c 45 |EXICO=4.|X.# RELE|
|000057b0| 56 41 4e 43 45 5f 41 52 | 47 55 4d 45 4e 54 53 2c |VANCE_AR|GUMENTS,|
|000057c0| 20 61 20 6c 69 73 74 20 | 6f 66 20 74 68 65 20 77 | a list |of the w|
|000057d0| 6f 72 64 73 20 62 65 69 | 6e 67 20 71 75 65 72 69 |ords bei|ng queri|
|000057e0| 65 64 20 66 6f 72 20 69 | 6e 0a 23 20 72 65 61 64 |ed for i|n.# read|
|000057f0| 5f 69 6e 64 65 78 28 29 | 2e 0a 58 0a 52 45 4c 45 |_index()|..X.RELE|
|00005800| 56 41 4e 43 45 5f 41 52 | 47 55 4d 45 4e 54 53 3d |VANCE_AR|GUMENTS=|
|00005810| 22 22 0a 58 0a 23 20 52 | 45 4c 45 56 41 4e 43 45 |"".X.# R|ELEVANCE|
|00005820| 5f 41 54 54 52 49 42 55 | 54 45 2c 20 31 20 3d 20 |_ATTRIBU|TE, 1 = |
|00005830| 69 6e 63 6c 75 64 65 20 | 22 24 7b 52 45 4c 45 56 |include |"${RELEV|
|00005840| 41 4e 43 45 5f 41 52 47 | 55 4d 45 4e 54 53 7d 22 |ANCE_ARG|UMENTS}"|
|00005850| 20 61 73 20 74 68 65 0a | 23 20 66 69 72 73 74 20 | as the.|# first |
|00005860| 72 65 63 6f 72 64 20 6f | 75 70 75 74 20 66 72 6f |record o|uput fro|
|00005870| 6d 20 72 65 61 64 5f 69 | 6e 64 65 78 28 29 2c 20 |m read_i|ndex(), |
|00005880| 30 20 3d 20 64 6f 20 6e | 6f 74 20 6f 75 74 70 75 |0 = do n|ot outpu|
|00005890| 74 0a 23 20 22 24 7b 52 | 45 4c 45 56 41 4e 43 45 |t.# "${R|ELEVANCE|
|000058a0| 5f 41 52 47 55 4d 45 4e | 54 53 7d 22 0a 58 0a 52 |_ARGUMEN|TS}".X.R|
|000058b0| 45 4c 45 56 41 4e 43 45 | 5f 41 54 54 52 49 42 55 |ELEVANCE|_ATTRIBU|
|000058c0| 54 45 3d 30 0a 58 0a 23 | 20 20 4d 6f 64 65 20 6f |TE=0.X.#| Mode o|
|000058d0| 66 20 6f 70 65 72 61 74 | 69 6f 6e 73 3a 0a 23 0a |f operat|ions:.#.|
|000058e0| 23 09 52 45 41 44 5f 4d | 4f 44 45 2c 20 72 65 61 |#.READ_M|ODE, rea|
|000058f0| 64 20 6f 6e 6c 79 20 6d | 6f 64 65 20 3d 20 31 2e |d only m|ode = 1.|
|00005900| 0a 23 0a 23 09 57 52 49 | 54 45 5f 4d 4f 44 45 2c |.#.#.WRI|TE_MODE,|
|00005910| 20 77 72 69 74 65 20 6d | 6f 64 65 20 3d 20 32 2e | write m|ode = 2.|
|00005920| 0a 23 0a 23 09 44 45 4c | 45 54 45 5f 57 4f 52 44 |.#.#.DEL|ETE_WORD|
|00005930| 53 2c 20 64 65 6c 65 74 | 65 20 77 6f 72 64 73 20 |S, delet|e words |
|00005940| 6d 6f 64 65 20 3d 20 33 | 2e 0a 23 0a 23 09 44 45 |mode = 3|..#.#.DE|
|00005950| 4c 45 54 45 5f 46 49 4c | 45 53 2c 20 64 65 6c 65 |LETE_FIL|ES, dele|
|00005960| 74 65 20 66 69 6c 65 73 | 20 6d 6f 64 65 20 3d 20 |te files| mode = |
|00005970| 34 2e 0a 23 0a 23 09 52 | 45 4c 45 56 41 4e 43 45 |4..#.#.R|ELEVANCE|
|00005980| 5f 43 4f 55 4e 54 2c 20 | 72 65 6c 65 76 61 6e 63 |_COUNT, |relevanc|
|00005990| 65 20 63 6f 75 6e 74 20 | 6d 6f 64 65 20 3d 20 35 |e count |mode = 5|
|000059a0| 2e 0a 23 0a 23 09 52 45 | 4c 45 56 41 4e 43 45 5f |..#.#.RE|LEVANCE_|
|000059b0| 50 52 4f 58 49 4d 49 54 | 59 2c 20 72 65 6c 65 76 |PROXIMIT|Y, relev|
|000059c0| 61 6e 63 65 20 70 72 6f | 78 69 6d 69 74 79 20 6d |ance pro|ximity m|
|000059d0| 6f 64 65 20 3d 20 36 2e | 0a 58 0a 52 45 41 44 5f |ode = 6.|.X.READ_|
|000059e0| 4d 4f 44 45 3d 31 0a 57 | 52 49 54 45 5f 4d 4f 44 |MODE=1.W|RITE_MOD|
|000059f0| 45 3d 32 0a 44 45 4c 45 | 54 45 5f 57 4f 52 44 53 |E=2.DELE|TE_WORDS|
|00005a00| 3d 33 0a 44 45 4c 45 54 | 45 5f 46 49 4c 45 53 3d |=3.DELET|E_FILES=|
|00005a10| 34 0a 52 45 4c 45 56 41 | 4e 43 45 5f 43 4f 55 4e |4.RELEVA|NCE_COUN|
|00005a20| 54 3d 35 0a 52 45 4c 45 | 56 41 4e 43 45 5f 50 52 |T=5.RELE|VANCE_PR|
|00005a30| 4f 58 49 4d 49 54 59 3d | 36 0a 58 0a 23 20 44 65 |OXIMITY=|6.X.# De|
|00005a40| 66 61 75 6c 74 20 6d 6f | 64 65 20 6f 66 20 6f 70 |fault mo|de of op|
|00005a50| 65 72 61 74 69 6f 6e 2e | 0a 58 0a 4f 50 5f 4d 4f |eration.|.X.OP_MO|
|00005a60| 44 45 3d 22 24 7b 52 45 | 41 44 5f 4d 4f 44 45 7d |DE="${RE|AD_MODE}|
|00005a70| 22 0a 58 0a 23 20 44 65 | 66 61 75 6c 74 20 74 65 |".X.# De|fault te|
|00005a80| 72 6d 69 6e 61 74 69 6f | 6e 20 63 68 61 72 61 63 |rminatio|n charac|
|00005a90| 74 65 72 20 75 73 65 64 | 20 62 79 20 24 7b 4c 4f |ter used| by ${LO|
|00005aa0| 4f 4b 7d 20 70 72 6f 67 | 72 61 6d 2e 20 53 65 74 |OK} prog|ram. Set|
|00005ab0| 74 69 6e 67 20 74 68 69 | 73 0a 23 20 74 6f 20 22 |ting thi|s.# to "|
|00005ac0| 24 7b 54 41 42 7d 22 20 | 77 69 6c 6c 20 61 6c 6c |${TAB}" |will all|
|00005ad0| 6f 77 20 22 65 78 61 63 | 74 20 6b 65 79 22 20 73 |ow "exac|t key" s|
|00005ae0| 65 61 72 63 68 65 73 20 | 66 6f 72 20 74 68 65 20 |earches |for the |
|00005af0| 77 6f 72 64 73 20 69 6e | 20 74 68 65 0a 23 20 69 |words in| the.# i|
|00005b00| 6e 76 65 72 74 65 64 20 | 69 6e 64 65 78 20 66 69 |nverted |index fi|
|00005b10| 6c 65 2e 20 54 68 65 20 | 64 65 66 61 75 6c 74 2c |le. The |default,|
|00005b20| 20 77 68 69 63 68 20 69 | 73 20 6e 75 6c 6c 2c 20 | which i|s null, |
|00005b30| 69 73 20 74 6f 20 61 6c | 6c 6f 77 20 22 70 61 72 |is to al|low "par|
|00005b40| 74 69 61 6c 0a 23 20 6b | 65 79 22 20 73 65 61 72 |tial.# k|ey" sear|
|00005b50| 63 68 65 73 2e 0a 58 0a | 45 4e 44 3d 0a 58 0a 23 |ches..X.|END=.X.#|
|00005b60| 20 54 61 62 20 63 68 61 | 72 61 63 74 65 72 2c 20 | Tab cha|racter, |
|00005b70| 75 73 65 64 20 74 6f 20 | 73 70 65 63 69 66 79 20 |used to |specify |
|00005b80| 74 68 65 20 66 69 65 6c | 64 20 64 65 6c 69 6d 69 |the fiel|d delimi|
|00005b90| 74 65 72 20 66 6f 72 20 | 74 68 65 20 24 7b 4a 4f |ter for |the ${JO|
|00005ba0| 49 4e 7d 0a 23 20 70 72 | 6f 67 72 61 6d 2e 20 20 |IN}.# pr|ogram. |
|00005bb0| 54 68 69 73 20 69 73 20 | 63 68 6f 73 65 6e 20 61 |This is |chosen a|
|00005bc0| 73 20 61 20 63 68 61 72 | 61 63 74 65 72 20 74 68 |s a char|acter th|
|00005bd0| 61 74 20 77 69 6c 6c 20 | 6e 65 76 65 72 20 62 65 |at will |never be|
|00005be0| 20 69 6e 20 74 68 65 0a | 23 20 69 6e 76 65 72 74 | in the.|# invert|
|00005bf0| 65 64 20 69 6e 64 65 78 | 20 66 69 6c 65 2c 20 73 |ed index| file, s|
|00005c00| 69 6e 63 65 20 61 6c 6c | 20 77 68 69 74 65 20 73 |ince all| white s|
|00005c10| 70 61 63 65 20 69 73 20 | 74 6f 20 62 65 20 70 61 |pace is |to be pa|
|00005c20| 72 73 65 64 20 61 77 61 | 79 2e 20 4e 6f 74 65 0a |rsed awa|y. Note.|
|00005c30| 23 20 74 68 61 74 20 74 | 68 69 73 20 66 69 6c 65 |# that t|his file|
|00005c40| 20 73 68 6f 75 6c 64 20 | 6e 65 76 65 72 20 62 65 | should |never be|
|00005c50| 20 64 65 74 61 62 27 65 | 64 2e 0a 58 0a 54 41 42 | detab'e|d..X.TAB|
|00005c60| 3d 27 09 27 0a 58 0a 23 | 20 54 68 65 20 68 65 6c |='.'.X.#| The hel|
|00005c70| 70 20 66 75 6e 63 74 69 | 6f 6e 2e 20 50 72 69 6e |p functi|on. Prin|
|00005c80| 74 73 20 74 6f 20 73 74 | 64 6f 75 74 2c 20 73 6f |ts to st|dout, so|
|00005c90| 20 74 68 61 74 20 69 74 | 20 63 61 6e 20 62 65 20 | that it| can be |
|00005ca0| 72 65 64 69 72 65 63 74 | 65 64 20 74 6f 0a 23 20 |redirect|ed to.# |
|00005cb0| 61 20 66 69 6c 65 2e 20 | 54 68 65 20 66 75 6e 63 |a file. |The func|
|00005cc0| 74 69 6f 6e 20 72 65 71 | 75 69 72 65 73 20 6e 6f |tion req|uires no|
|00005cd0| 20 61 72 67 75 6d 65 6e | 74 73 2e 0a 58 0a 68 65 | argumen|ts..X.he|
|00005ce0| 6c 70 28 29 0a 7b 0a 58 | 20 20 20 20 24 7b 45 43 |lp().{.X| ${EC|
|00005cf0| 48 4f 7d 20 22 54 68 69 | 73 20 70 72 6f 67 72 61 |HO} "Thi|s progra|
|00005d00| 6d 20 77 69 6c 6c 20 63 | 72 65 61 74 65 20 61 6e |m will c|reate an|
|00005d10| 64 20 71 75 65 72 79 20 | 69 6e 76 65 72 74 65 64 |d query |inverted|
|00005d20| 20 69 6e 64 65 78 20 66 | 69 6c 65 73 20 74 68 61 | index f|iles tha|
|00005d30| 74 20 69 6e 64 65 78 22 | 0a 58 20 20 20 20 24 7b |t index"|.X ${|
|00005d40| 45 43 48 4f 7d 20 22 74 | 68 65 20 77 6f 72 64 73 |ECHO} "t|he words|
|00005d50| 20 69 6e 20 74 65 78 74 | 20 66 69 6c 65 73 2e 20 | in text| files. |
|00005d60| 54 68 65 73 65 20 69 6e | 64 69 63 65 73 20 61 72 |These in|dices ar|
|00005d70| 65 20 75 73 65 66 75 6c | 20 69 6e 20 69 6e 66 6f |e useful| in info|
|00005d80| 72 6d 61 74 69 6f 6e 22 | 0a 58 20 20 20 20 24 7b |rmation"|.X ${|
|00005d90| 45 43 48 4f 7d 20 22 72 | 65 74 72 69 65 76 61 6c |ECHO} "r|etrieval|
|00005da0| 20 73 79 73 74 65 6d 73 | 2e 20 54 68 65 20 69 6e | systems|. The in|
|00005db0| 76 65 72 74 65 64 20 69 | 6e 64 65 78 20 66 69 6c |verted i|ndex fil|
|00005dc0| 65 73 20 61 72 65 2c 20 | 74 79 70 69 63 61 6c 6c |es are, |typicall|
|00005dd0| 79 2c 20 61 62 6f 75 74 | 20 74 68 65 22 0a 58 20 |y, about| the".X |
|00005de0| 20 20 20 24 7b 45 43 48 | 4f 7d 20 22 73 61 6d 65 | ${ECH|O} "same|
|00005df0| 20 73 69 7a 65 20 6f 66 | 20 74 68 65 20 74 65 78 | size of| the tex|
|00005e00| 74 20 66 69 6c 65 73 2c | 20 61 6e 64 20 64 6f 20 |t files,| and do |
|00005e10| 6e 6f 74 20 72 65 71 75 | 69 72 65 20 74 68 65 20 |not requ|ire the |
|00005e20| 74 65 78 74 20 66 69 6c | 65 73 20 74 6f 20 62 65 |text fil|es to be|
|00005e30| 22 0a 58 20 20 20 20 24 | 7b 45 43 48 4f 7d 20 22 |".X $|{ECHO} "|
|00005e40| 70 72 65 73 65 6e 74 20 | 66 6f 72 20 71 75 65 72 |present |for quer|
|00005e50| 79 20 6f 70 65 72 61 74 | 69 6f 6e 73 2e 20 54 68 |y operat|ions. Th|
|00005e60| 65 20 71 75 65 72 79 20 | 66 75 6e 63 74 69 6f 6e |e query |function|
|00005e70| 73 2c 20 74 79 70 69 63 | 61 6c 6c 79 2c 20 63 6f |s, typic|ally, co|
|00005e80| 6e 73 69 73 74 22 0a 58 | 20 20 20 20 24 7b 45 43 |nsist".X| ${EC|
|00005e90| 48 4f 7d 20 22 6f 66 20 | 62 6f 6f 6c 65 61 6e 20 |HO} "of |boolean |
|00005ea0| 6f 70 65 72 61 74 69 6f | 6e 73 20 6f 6e 20 77 6f |operatio|ns on wo|
|00005eb0| 72 64 20 73 65 61 72 63 | 68 65 73 2e 20 54 68 65 |rd searc|hes. The|
|00005ec0| 20 6f 75 74 70 75 74 20 | 6f 66 20 74 68 65 20 71 | output |of the q|
|00005ed0| 75 65 72 79 20 69 73 2c | 22 0a 58 20 20 20 20 24 |uery is,|".X $|
|00005ee0| 7b 45 43 48 4f 7d 20 22 | 74 79 70 69 63 61 6c 6c |{ECHO} "|typicall|
|00005ef0| 79 2c 20 61 20 6c 69 73 | 74 20 6f 66 20 74 68 65 |y, a lis|t of the|
|00005f00| 20 66 69 6c 65 20 6e 61 | 6d 65 73 20 74 68 61 74 | file na|mes that|
|00005f10| 20 63 6f 6e 74 61 69 6e | 20 74 68 65 20 71 75 65 | contain| the que|
|00005f20| 72 69 65 64 20 77 6f 72 | 64 28 73 29 2e 22 0a 58 |ried wor|d(s).".X|
|00005f30| 20 20 20 20 24 7b 45 43 | 48 4f 7d 20 22 22 0a 58 | ${EC|HO} "".X|
|00005f40| 20 20 20 20 24 7b 45 43 | 48 4f 7d 20 22 54 68 65 | ${EC|HO} "The|
|00005f50| 20 72 65 61 64 20 73 79 | 6e 6f 70 73 69 73 20 69 | read sy|nopsis i|
|00005f60| 73 3a 22 0a 58 20 20 20 | 20 24 7b 45 43 48 4f 7d |s:".X | ${ECHO}|
|00005f70| 20 22 22 0a 58 20 20 20 | 20 24 7b 45 43 48 4f 7d | "".X | ${ECHO}|
|00005f80| 20 22 09 71 74 20 5b 2d | 65 5d 20 5b 2d 72 20 7c | ".qt [-|e] [-r ||
|00005f90| 20 2d 72 63 20 7c 20 2d | 72 70 5d 20 5b 2d 66 20 | -rc | -|rp] [-f |
|00005fa0| 69 6e 64 65 78 5f 6e 61 | 6d 65 5d 20 77 6f 72 64 |index_na|me] word|
|00005fb0| 31 20 5b 6f 70 31 5d 20 | 77 6f 72 64 32 20 5b 6f |1 [op1] |word2 [o|
|00005fc0| 70 32 5d 20 2e 2e 2e 22 | 0a 58 20 20 20 20 24 7b |p2] ..."|.X ${|
|00005fd0| 45 43 48 4f 7d 20 22 22 | 0a 58 20 20 20 20 24 7b |ECHO} ""|.X ${|
|00005fe0| 45 43 48 4f 7d 20 22 77 | 68 65 72 65 20 77 6f 72 |ECHO} "w|here wor|
|00005ff0| 64 31 2d 77 6f 72 64 32 | 20 2e 2e 2e 20 61 72 65 |d1-word2| ... are|
|00006000| 20 74 68 65 20 77 6f 72 | 64 73 20 74 6f 20 62 65 | the wor|ds to be|
|00006010| 20 71 75 65 72 69 65 64 | 20 69 6e 20 74 68 65 20 | queried| in the |
|00006020| 69 6e 76 65 72 74 65 64 | 22 0a 58 20 20 20 20 24 |inverted|".X $|
|00006030| 7b 45 43 48 4f 7d 20 22 | 69 6e 64 65 78 2c 20 61 |{ECHO} "|index, a|
|00006040| 6e 64 20 6f 70 31 2d 6f | 70 32 20 2e 2e 2e 20 61 |nd op1-o|p2 ... a|
|00006050| 72 65 20 74 68 65 20 6f | 70 65 72 61 74 69 6f 6e |re the o|peration|
|00006060| 73 20 74 6f 20 62 65 20 | 70 65 72 66 6f 72 6d 65 |s to be |performe|
|00006070| 64 20 6f 6e 20 74 68 65 | 20 73 65 74 22 0a 58 20 |d on the| set".X |
|00006080| 20 20 20 24 7b 45 43 48 | 4f 7d 20 22 6f 66 20 66 | ${ECH|O} "of f|
|00006090| 69 6c 65 20 6e 61 6d 65 | 73 20 74 68 61 74 20 63 |ile name|s that c|
|000060a0| 6f 6e 74 61 69 6e 20 74 | 68 65 73 65 20 77 6f 72 |ontain t|hese wor|
|000060b0| 64 73 2e 20 54 68 65 20 | 77 6f 72 64 2f 6f 70 65 |ds. The |word/ope|
|000060c0| 72 61 74 69 6f 6e 20 61 | 72 67 75 6d 65 6e 74 73 |ration a|rguments|
|000060d0| 22 0a 58 20 20 20 20 24 | 7b 45 43 48 4f 7d 20 22 |".X $|{ECHO} "|
|000060e0| 63 6f 6e 73 69 73 74 20 | 6f 66 20 70 61 69 72 73 |consist |of pairs|
|000060f0| 20 6f 66 20 73 65 61 72 | 63 68 20 77 6f 72 64 73 | of sear|ch words|
|00006100| 2c 20 61 6e 64 20 62 6f | 6f 6c 65 61 6e 20 6f 70 |, and bo|olean op|
|00006110| 65 72 61 74 6f 72 73 2c | 20 77 69 74 68 20 61 20 |erators,| with a |
|00006120| 6c 65 66 74 22 0a 58 20 | 20 20 20 24 7b 45 43 48 |left".X | ${ECH|
|00006130| 4f 7d 20 22 74 6f 20 72 | 69 67 68 74 20 6f 70 65 |O} "to r|ight ope|
|00006140| 72 61 74 69 6f 6e 61 6c | 20 70 72 65 63 65 64 65 |rational| precede|
|00006150| 6e 63 65 2e 22 0a 58 20 | 20 20 20 24 7b 45 43 48 |nce.".X | ${ECH|
|00006160| 4f 7d 20 22 22 0a 58 20 | 20 20 20 24 7b 45 43 48 |O} "".X | ${ECH|
|00006170| 4f 7d 20 22 54 68 75 73 | 20 69 66 20 41 2c 20 42 |O} "Thus| if A, B|
|00006180| 2c 20 61 6e 64 20 43 20 | 61 72 65 20 77 6f 72 64 |, and C |are word|
|00006190| 73 2c 20 74 68 65 6e 20 | 74 68 65 20 71 75 65 72 |s, then |the quer|
|000061a0| 79 3a 22 0a 58 20 20 20 | 20 24 7b 45 43 48 4f 7d |y:".X | ${ECHO}|
|000061b0| 20 22 22 0a 58 20 20 20 | 20 24 7b 45 43 48 4f 7d | "".X | ${ECHO}|
|000061c0| 20 22 09 41 20 61 6e 64 | 20 42 20 6f 72 20 43 20 | ".A and| B or C |
|000061d0| 6e 6f 74 20 44 22 0a 58 | 20 20 20 20 24 7b 45 43 |not D".X| ${EC|
|000061e0| 48 4f 7d 20 22 22 0a 58 | 20 20 20 20 24 7b 45 43 |HO} "".X| ${EC|
|000061f0| 48 4f 7d 20 22 77 6f 75 | 6c 64 20 73 70 65 63 69 |HO} "wou|ld speci|
|00006200| 66 79 20 74 68 61 74 20 | 61 6c 6c 20 66 69 6c 65 |fy that |all file|
|00006210| 20 6e 61 6d 65 73 20 63 | 6f 6e 74 61 69 6e 69 6e | names c|ontainin|
|00006220| 67 20 77 6f 72 64 20 41 | 20 73 68 6f 75 6c 64 20 |g word A| should |
|00006230| 62 65 20 66 6f 75 6e 64 | 2c 22 0a 58 20 20 20 20 |be found|,".X |
|00006240| 24 7b 45 43 48 4f 7d 20 | 22 74 68 65 6e 20 61 6c |${ECHO} |"then al|
|00006250| 6c 20 74 68 65 20 66 69 | 6c 65 20 6e 61 6d 65 73 |l the fi|le names|
|00006260| 20 63 6f 6e 74 61 69 6e | 69 6e 67 20 77 6f 72 64 | contain|ing word|
|00006270| 20 42 20 73 68 6f 75 6c | 64 20 62 65 20 66 6f 75 | B shoul|d be fou|
|00006280| 6e 64 2c 20 61 6e 64 20 | 6f 6e 6c 79 22 0a 58 20 |nd, and |only".X |
|00006290| 20 20 20 24 7b 45 43 48 | 4f 7d 20 22 74 68 6f 73 | ${ECH|O} "thos|
|000062a0| 65 20 66 69 6c 65 20 6e | 61 6d 65 73 20 74 68 61 |e file n|ames tha|
|000062b0| 74 20 63 6f 6e 74 61 69 | 6e 20 77 6f 72 64 73 20 |t contai|n words |
|000062c0| 41 20 61 6e 64 20 42 20 | 73 68 6f 75 6c 64 20 62 |A and B |should b|
|000062d0| 65 20 61 64 64 65 64 20 | 74 6f 20 74 68 6f 73 65 |e added |to those|
|000062e0| 22 0a 58 20 20 20 20 24 | 7b 45 43 48 4f 7d 20 22 |".X $|{ECHO} "|
|000062f0| 66 69 6c 65 20 6e 61 6d | 65 73 20 63 6f 6e 74 61 |file nam|es conta|
|00006300| 69 6e 69 6e 67 20 77 6f | 72 64 20 43 2c 20 61 6e |ining wo|rd C, an|
|00006310| 64 20 74 68 65 6e 20 69 | 66 20 74 68 65 73 65 20 |d then i|f these |
|00006320| 66 69 6c 65 20 6e 61 6d | 65 73 20 64 6f 20 6e 6f |file nam|es do no|
|00006330| 74 22 0a 58 20 20 20 20 | 24 7b 45 43 48 4f 7d 20 |t".X |${ECHO} |
|00006340| 22 63 6f 6e 74 61 69 6e | 20 77 6f 72 64 20 44 2c |"contain| word D,|
|00006350| 20 74 68 65 79 20 61 72 | 65 20 6f 75 74 70 75 74 | they ar|e output|
|00006360| 2e 22 0a 58 20 20 20 20 | 24 7b 45 43 48 4f 7d 20 |.".X |${ECHO} |
|00006370| 22 22 0a 58 20 20 20 20 | 24 7b 45 43 48 4f 7d 20 |"".X |${ECHO} |
|00006380| 22 4c 6f 67 69 63 61 6c | 20 5c 22 6f 72 27 69 6e |"Logical| \"or'in|
|00006390| 67 5c 22 20 69 73 20 69 | 6d 70 6c 69 63 69 74 2c |g\" is i|mplicit,|
|000063a0| 20 74 68 75 73 3a 22 0a | 58 20 20 20 20 24 7b 45 | thus:".|X ${E|
|000063b0| 43 48 4f 7d 20 22 22 0a | 58 20 20 20 20 24 7b 45 |CHO} "".|X ${E|
|000063c0| 43 48 4f 7d 20 22 09 41 | 20 42 20 43 22 0a 58 20 |CHO} ".A| B C".X |
|000063d0| 20 20 20 24 7b 45 43 48 | 4f 7d 20 22 22 0a 58 20 | ${ECH|O} "".X |
|000063e0| 20 20 20 24 7b 45 43 48 | 4f 7d 20 22 69 73 20 69 | ${ECH|O} "is i|
|000063f0| 64 65 6e 74 69 63 61 6c | 20 74 6f 3a 22 0a 58 20 |dentical| to:".X |
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.