File: SWISH-RUN.1

package info (click to toggle)
swish-e 2.4.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 7,248 kB
  • ctags: 7,642
  • sloc: ansic: 47,385; sh: 8,502; perl: 5,101; makefile: 719; xml: 9
file content (1185 lines) | stat: -rw-r--r-- 46,136 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  | will give a
.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.\"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "SWISH-RUN 1"
.TH SWISH-RUN 1 "2004-09-01" "2.5.1" "SWISH-E Documentation"
.SH "NAME"
SWISH\-RUN \- Running Swish\-e and Command Line Switches
.SH "OVERVIEW"
.IX Header "OVERVIEW"
The Swish-e program is controlled by command line arguments (called
\&\fIswitches\fR).  Often, it is run manually from a shell (command
prompt), or from a program such as a \s-1CGI\s0 script that passes the command
line arguments to swish.
.PP
Note: A number of the command line switches may be specified in the
Swish-e configuration file specified with the \f(CW\*(C`\-c\*(C'\fR command line argument.
Please see SWISH-CONFIG for a complete description of
available configuration file directives.
.PP
There are two basic operating modes of Swish\-e: indexing and searching.
There are command line arguments that are unique to each mode, and
others that apply to both (yet may have different meaning depending on
the operating mode).  These command line arguments are listed below,
grouped by:
.PP
\&\s-1INDEXING\s0 \*(-- describes the command line arguments used
while indexing.
.PP
\&\s-1SEARCHING\s0 \*(-- lists the command line arguments used while
searching.
.PP
\&\s-1OTHER\s0 \s-1SWITCHES\s0 \*(-- lists switches that don't apply
to searching or indexing.
.PP
Beginning with Swish-e version 2.1, you may embed its search engine into
your applications.  Please see SWISH-LIBRARY.
.SH "INDEXING"
.IX Header "INDEXING"
Swish-e indexing is initiated by passing \fIcommand line arguments\fR to
swish.  The command line arguments used for \fIsearching\fR are described
in \s-1SEARCHING\s0.  Also, see SWISH-SEARCH
for examples of searching with Swish\-e.
.PP
Swish-e usage:
.PP
.Vb 2
\&    swish-e [-i dir file ... ] [-c file] [-f file] [-l] \e
\&            [-v (num)] [-S method(fs|http|prog)] [-N path]
.Ve
.PP
The \f(CW\*(C`\-h\*(C'\fR switch (help) will list the available Swish-e command line
arguments:
.PP
.Vb 1
\&    swish-e -h
.Ve
.PP
Typically, most if not all indexing settings are placed in a configuration
file (specified with the \f(CW\*(C`\-c\*(C'\fR switch).  Once the configuration file is
setup indexing is initiated as:
.PP
.Vb 1
\&    swish-e -c /path/to/config/file
.Ve
.PP
See SWISH-CONFIG for information on the configuration
file.
.PP
Security Note: If the swish binary is named \fIswish-search\fR then swish
will not allow any operation that would cause swish to write to the
index file.
.PP
When indexing it may be advisable to index to a temporary file, and
then after indexing has successfully completed rename the file to the
final location.  This is especially important when replacing an index
that is currently in use.
.PP
.Vb 3
\&    swish-e -c swish.config -f index.tmp
\&    [check return code from swish or look for err: output]
\&    mv index.tmp index.swish-e
.Ve
.Sh "Indexing Command Line Arguments"
.IX Subsection "Indexing Command Line Arguments"
.IP "\-i *directories and/or files* (input file)" 4
.IX Item "-i *directories and/or files* (input file)"
This specifies the directories and/or files to index. Directories will be
indexed recursively.  This is typically specified in the configuration file with the \fBIndexDir\fR directive instead of on the
command line.  Use of this switch overrides the configuration file
settings.
.IP "\-S [fs|http|prog] (document source/access mode)" 4
.IX Item "-S [fs|http|prog] (document source/access mode)"
This specifies the method to use for accessing documents to index.
Can be either \f(CW\*(C`fs\*(C'\fR for local indexing via the file system (the default),
\&\f(CW\*(C`http\*(C'\fR for spidering, or \f(CW\*(C`prog\*(C'\fR for reading documents from an external program.
.Sp
Located in the \f(CW\*(C`conf\*(C'\fR directory are example configuration files that demonstrate
indexing with the different document source methods.
.Sp
See the SWISH-FAQ for a discussion on the different indexing methods, and the difference
between spidering with the http method vs. using the file system method.
.RS 4
.IP "fs \- file system" 4
.IX Item "fs - file system"
The \f(CW\*(C`fs\*(C'\fR method simply reads files from a local (or networked) drive.  This is the default
method if the \f(CW\*(C`\-S\*(C'\fR switch is not specified.
See SWISH-CONFIG for configuration
directives specific to the \f(CW\*(C`fs\*(C'\fR method.
.IP "http \- spider a web server" 4
.IX Item "http - spider a web server"
The \f(CW\*(C`http\*(C'\fR method is used to spider web servers.  It uses an included helper
program called \fIswishspider\fR.  See SWISH-CONFIG for configuration
directives specific to the \f(CW\*(C`http\*(C'\fR method.
.Sp
Security Note: Under Windows swish passes the URLs fetched from remote documents through the shell (swish
uses the \fIsystem()\fR command for running \fIswishspider\fR under Windows), and this may be considered
an additional security risk.
.Sp
The \f(CW\*(C`http\*(C'\fR method is deprecated (or at least not very well appreciated).  Consider using
the \f(CW\*(C`prog\*(C'\fR method described below for spidering.  There's a spider program available in the
\&\fIprog-bin\fR directory for use with the \f(CW\*(C`prog\*(C'\fR method.  Here's a number of limitation with 
this method that are solved with the \f(CW\*(C`prog\*(C'\fR method:
.RS 4
.IP "*" 4
swishspider only spiders standard <a href=\*(L"...\*(R"> links.  Frames and other links are 
not followed.  
.IP "*" 4
By default, this method of spidering only indexes files that have a content type of \*(L"text/*\*(R"
(e.g. text/plain, text/html, text/xml).  You should use \f(CW\*(C`DefaultContents\*(C'\fR and \f(CW\*(C`IndexContents\*(C'\fR to
map file extensions to parsers used by swish (e.g.  \f(CW\*(C`IndexContents HTML* .html .htm\*(C'\fR), but 
this will fail where a document does not have a file extension.
.IP "*" 4
Swish\-e's \f(CW\*(C`FileFilter\*(C'\fR directive can be used with the \f(CW\*(C`http\*(C'\fR access method, although it 
requires a separate process (in addition to the swsihspider process) for each document 
filtered.
.IP "*" 4
The SWISH::Filter modules can be used with the swishspider program.  SWISH::Filter provides 
a general purpose filtering system (see SWISH::Filter documentation).  To use SWISH::Filter 
set \s-1PERL5LIB\s0 to point to the location of the \s-1SWISH\s0 module name space (typically 
/usr/local/lib/swish\-e under Unix).  For example:
.Sp
.Vb 2
\&   export PERL5LIB=/usr/local/lib/swish-e  # bash, bourne shells
\&   setenv PERL5LIB /usr/local/lib/swish-e  # csh, tcsh
.Ve
.Sp
or under Windows
.Sp
.Vb 1
\&   set PERL5LIB=c:\eprogram files\eswish-e2.4\elib\eswish-e
.Ve
.Sp
SWISH::Filter is not enabled by default due to the overhead of loading the modules for every
document fetched.
.Sp
The Swish-e distribution includes perl modules in the SWISH::Filters::* namespace to make
converting non-text documents into a format that Swish-e can parse easy.  As mentioned 
above, the helper script
\&\fIswishspider\fR will use these modules if can be found via \s-1PERL5LIB\s0.  These modules only 
provide an interface
to programs that do the conversion.  For example, you will need to download and install the
\&\*(L"catdoc\*(R" program to convert MSWord documents into text for indexing. Please see
\&\fIfilters/README\fR to see how to use this filter system.
.RE
.RS 4
.RE
.IP "prog \- general purpose access method" 4
.IX Item "prog - general purpose access method"
The \f(CW\*(C`prog\*(C'\fR method is new to Swish-e version 2.2.  It's designed as a general
purpose method to feed documents to swish from an external program.
.Sp
For example, the external program can read a database (e.g. MySQL), spider a web
server, or convert documents from one format to another (e.g. pdf to html).  Or,
you can simply use it to read the files of the file system (like \f(CW\*(C`\-S fs\*(C'\fR), yet provide
you with full control of what files are indexed.
.Sp
The external program name to run is passed to swish either by the
IndexDir directive, or via the \f(CW\*(C`\-i\*(C'\fR option.  
.Sp
The program specified should be an absolute path as swish-e will attempt to \fIstat()\fR the
program to make sure it exists.  Swish does this to help in error reporting.
.Sp
If the program specified with \-i or IndexDir is not an absolute path (i.e. 
does not include \*(L"/\*(R" ) then swish-e will append the \*(L"libexecdir\*(R" directory
defined during configuration.  Typically, libexecdir is set to
\&\*(L"$prefix/lib/swish\-e\*(R" (/usr/local/lib/swish\-e), but is platform and
installation dependent.  Running swish-e \-h will report the directory.
.Sp
For example, the \-S prog program \*(L"spider.pl\*(R" is a Perl helper program for use with \-S prog
and is installed in libexecdir.
.Sp
.Vb 2
\&    IndexDir spider.pl
\&    SwishProgParameters default http://localhost/index.html
.Ve
.Sp
and swish-e will find spider.pl in libexecdir.
.Sp
Additional parameters may be passed to the external program via the
SwishProgParameters directive.
In the example above swish-e will pass two parameters to spider.pl, \*(L"default\*(R" and 
\&\*(L"http://localhost/index.html\*(R".
.Sp
A special name \*(L"stdin\*(R" may be used with \f(CW\*(C`\-i\*(C'\fR or IndexDir
which tells swish to read from standard input instead of from an external program.  See
example below.
.Sp
The external program prints to standard output (which swish captures)
a set of headers followed by the content of the file to index.  The output looks similar to
an email message or a \s-1HTTP\s0 document returned by a web server in that it includes name/value pairs
of headers, a blank line, and the content.
.Sp
The content length is determined by a content-length header supplied to swish by the
program; there is no \*(L"end of record\*(R" character or flag sent between documents. Therefore, it
is critical that the content-length header is correct.  This is a common source of errors.
.Sp
One advantage of this method (over using filters, for example) is that the external program
is run only once for the entire indexing job, instead of once for every document.  This
avoids forking and creating a new process for every document, and makes a huge difference
when your external program is something like perl that has a large startup cost.
.Sp
Here's a simple example written in Perl:
.Sp
.Vb 2
\&    #!/usr/local/bin/perl -w
\&    use strict;
.Ve
.Sp
.Vb 11
\&    # Build a document
\&    my $doc = <<EOF;
\&    <html>
\&    <head>
\&        <title>Document Title</title>
\&    </head>
\&        <body>
\&            This is the text.
\&        </body>
\&    </html>
\&    EOF
.Ve
.Sp
.Vb 4
\&    # Prepare the headers for swish
\&    my $path = 'Example.file';
\&    my $size = length $doc;
\&    my $mtime = time;
.Ve
.Sp
.Vb 6
\&    # Output the document (to swish)
\&    print <<EOF;
\&    Path-Name: $path
\&    Content-Length: $size
\&    Last-Mtime: $mtime
\&    Document-Type: HTML*
.Ve
.Sp
.Vb 1
\&    EOF
.Ve
.Sp
.Vb 1
\&        print $doc;
.Ve
.Sp
The external program passes to swish a header.  The header is separated from
the body of the document with a blank line.  The available headers are:
.RS 4
.IP "Path\-Name:" 4
.IX Item "Path-Name:"
This is the name of the file you are indexing. This can be any string, so for example it could
be an \s-1ID\s0 of a record in a database, a \s-1URL\s0 or a simple file name.
.Sp
This header is required.
.IP "Content\-Length:" 4
.IX Item "Content-Length:"
This header specifies the length in bytes of the document that follows the header.
This length must be exactly the length of the document \*(-- do not make the mistake of adding
an extra line feed at the end of the document.
.Sp
This header is required.
.IP "Last\-Mtime:" 4
.IX Item "Last-Mtime:"
Thi parameter is the last modification time of the file, and must
be a time stamp (seconds since the Epoch on your platform).
.Sp
This header is not required.
.IP "Document\-Type:" 4
.IX Item "Document-Type:"
You may override swish's determination of document type (\f(CW\*(C`Indexcontents\*(C'\fR)
by using the \f(CW\*(C`Document\-Type:\*(C'\fR header.  The document type is used to select which
parser Swish-e uses to parse the document's contents.
.Sp
For example, a spider program might map the content-type returned from a web server to
one of the types Swish-e understands.  For example,
.Sp
.Vb 1
\&    my $doc_type = 'HTML*' if $response->content_type =~ m!text/html!'
.Ve
.Sp
This header is not required.
.RE
.RS 4
.Sp
The above example program only returns one document and exits, which is not very useful.  Normally,
your program would read data from some source, such as files or a database, format as
\&\s-1XML\s0, \s-1HTML\s0, or text, and pass them to swish, one after another.  The \f(CW\*(C`Content\-Length:\*(C'\fR header
tells swish where each document ends \*(-- there is not any special \*(L"end of record\*(R" character or
marker.
.Sp
To index with the above example you need to make sure that the program is executable
(and that the path to perl is correct), and then call swish telling to run in \f(CW\*(C`prog\*(C'\fR
mode, and the name of the program to use for input.
.Sp
.Vb 2
\&    % chmod 755 example.pl
\&    % ./swish-e -S prog -i ./example.pl
.Ve
.Sp
Programs can and should be tested prior to running swish. For example:
.Sp
.Vb 1
\&    % ./example.pl > test.out
.Ve
.Sp
A few more useful example programs are provided in the swish-e distribution
located in the \fIprog-bin\fR directory.  Some include documentation:
.Sp
.Vb 2
\&    % cd prog-bin
\&    % perldoc spider.pl
.Ve
.Sp
Others are small examples that include comments:
.Sp
.Vb 2
\&    % cd prog-bin
\&    % less DirTree.pl
.Ve
.Sp
The \fIspider.pl\fR program can be used as a replacement for the \fI\-S http\fR method.  It is
far more feature-rich and offers much more control over indexing.
.Sp
If you use the special program name \*(L"stdin\*(R" with \f(CW\*(C`\-i\*(C'\fR or IndexDir
then swish-e will read from standard input instead of from a program.  For example:
.Sp
.Vb 1
\&    % ./example.pl --count=1000 /path/to/data | ./swish-e -S prog -i stdin
.Ve
.Sp
This is basically the same as using a swish-e configuration file of:
.Sp
.Vb 2
\&    SwishProgParameters --count=1000 /path/to/data
\&    IndexDir ./example.pl
.Ve
.Sp
in a config file and running
.Sp
.Vb 1
\&    % ./swish-e -S prog -c swish.conf
.Ve
.Sp
This gives an easy way to run swish without a configuration file with a \f(CW\*(C`\-S prog\*(C'\fR program
that requires parameters.  It also means you can capture data to a file and then index
more once with the same data:
.Sp
.Vb 3
\&    % ./example.pl /path/to/data --count=1000 > docs.txt
\&    % cat docs.txt | ./swish-e -S prog -i stdin -c normal_index
\&    % cat docs.txt | ./swish-e -S prog -i stdin -c fuzzy_index
.Ve
.Sp
Using \*(L"stdin\*(R" might also be useful for programs that call swish (instead of swish calling the
program).
.Sp
(The reason \*(L"stdin\*(R" is used instead of the more common \*(L"\-\*(R" dash is due to the rotten way
swish parses the command line.  This should be fixed in the future.)
.Sp
The \f(CW\*(C`prog\*(C'\fR method bypasses some of the configuration parameters available
to the file system method \*(-- settings such as
\&\f(CW\*(C`IndexOnly\*(C'\fR, \f(CW\*(C`FileRules\*(C'\fR, \f(CW\*(C`FileMatch\*(C'\fR and \f(CW\*(C`FollowSymLinks\*(C'\fR
are ignored when using the \f(CW\*(C`prog\*(C'\fR method.  It's expected that these operations
are better accomplished in the external program before passing the document onto swish.  In
other words, when using the \f(CW\*(C`prog\*(C'\fR method, only send the documents to swish
that you want indexed.
.Sp
You may use swish's filter feature with the \f(CW\*(C`prog\*(C'\fR method, but performance will be better if you
run filtering programs from within your external program.  See also \fIfilters/README\fR for an example
how to easily add document converstion and filtering into your Perl-based programs.
.Sp
\&\fBNotes when using \-S prog on \s-1MS\s0 Windows\fR
.Sp
Windows does not use the shebang (#!) line of a program to determine the
program to run.  So, when running, for example, a perl program you may need
to specify the perl.exe binary as the program, and use the
\&\f(CW\*(C`SwishProgParameters\*(C'\fR to name the file.
.Sp
.Vb 2
\&    IndexDir e:/perl/bin/perl.exe
\&    SwishProgParameters read_database.pl
.Ve
.Sp
Swish will replace the forward slashes with backslashes before running the command specified with
\&\f(CW\*(C`IndexDir\*(C'\fR.  Swish uses the \fIpopen\fR\|(3) command which passes the command through the shell.
.RE
.RE
.RS 4
.RE
.IP "\-f *indexfile* (index file)" 4
.IX Item "-f *indexfile* (index file)"
If you are indexing, this specifies the file to save the generated index in,
and you can only specify one file.  See also \fBIndexFile\fR in the configuration file.
.Sp
If you are searching, this specifies the index
files (one or more) to search from. The default index file is index.swish\-e in the current directory.
.IP "\-c *file ...* (configuration files)" 4
.IX Item "-c *file ...* (configuration files)"
Specify the configuration file(s) to use for indexing.  This file contains many directives that
control how Swish-e proceeds.
See SWISH-CONFIG for a complete listing of configuration file directives.
.Sp
Example:
.Sp
.Vb 1
\&    swish-e -c docs.conf
.Ve
.Sp
If you specify a directory to index, an index file, or the verbose option on the command\-line,
these values will override any specified in the configuration file.
.Sp
You can specify multiple configuration files.  For example, you may have one configuration file
that has common site-wide settings, and another for a specific index.
.Sp
Examples:
.Sp
.Vb 3
\&    1) swish-e -c swish-e.conf
\&    2) swish-e -i /usr/local/www -f index.swish-e -v -c swish-e.conf
\&    3) swish-e -c swish-e.conf stopwords.conf
.Ve
.RS 4
.IP "1" 3
.IX Item "1"
The settings in the configuration file will be used to index a site.
.IP "2" 3
.IX Item "2"
These command-line options will override anything in the configuration file.
.IP "3" 3
.IX Item "3"
The variables in swish\-e.conf will be read, then the variable in stopwords.conf will be read.
Note that if the same variables occur in both files, older values may be written over.
.RE
.RS 4
.RE
.IP "\-e (economy mode)" 4
.IX Item "-e (economy mode)"
For large sites indexing may require more \s-1RAM\s0 than is available.  The \f(CW\*(C`\-e\*(C'\fR switch tells swish to use
disk space to store data structures while indexing, saving memory.  This option is recommended if
swish uses so much \s-1RAM\s0 that the computer begins to swap excessively, and you cannot increase available
memory.  The trade-off is slightly longer indexing times, and a busy disk drive.  
.IP "\-l (symbolic links)" 4
.IX Item "-l (symbolic links)"
Specifying this option tells swish to follow symbolic links when indexing.
The configuration file value \fBFollowSymLinks\fR will override the command-line value.
.Sp
The default is not to follow symlinks.  A small improvement in indexing time my result
from enabling FollowSymLinks since swish does not need to stat every directory and file
processed to determine if it is a symbolic link.
.IP "\-N path (index only newer files)" 4
.IX Item "-N path (index only newer files)"
The \f(CW\*(C`\-N\*(C'\fR option takes a path to a file, and only files \fInewer\fR than the specified
file will be indexed.  This is helpful for creating incremental indexes \*(-- that is,
indexes that contain just files added since the last full index was created of all files.
.Sp
Example (bad example)
.Sp
.Vb 1
\&    swish-e -c config.file -N index.swish-e -f index.new
.Ve
.Sp
This will index as normal, but only files with a modified date newer
than \fIindex.swish\-e\fR will be indexed.
.Sp
This is a bad example because it uses \fIindex.swish\-e\fR which one might assume
was the date of last indexing.  The problem is that files might have been added
between the time indexing read the directory and when the \fIindex.swish\-e\fR file
was created \*(-- which can be quite a bit of time for very large indexing jobs.
.Sp
The only solution is to prevent any new file additions while full indexing is running.
If this is impossible then it will be slightly better to do this:
.Sp
Full indexing:
.Sp
.Vb 3
\&    touch indexing_time.file
\&    swish-e -c config.file -f index.tmp
\&    mv index.tmp index.full
.Ve
.Sp
Incremental indexing:
.Sp
.Vb 2
\&    swish-e -c config.file -N indexing_time.file -f index.tmp
\&    mv index.tmp index.incremental
.Ve
.Sp
Then search with
.Sp
.Vb 1
\&    swish-e -w foo -f index.full index.incremental
.Ve
.Sp
or merge the indexes
.Sp
.Vb 3
\&    swish-e -M index.full index.incremental index.tmp
\&    mv index.tmp index.swish-e
\&    swish-e -w foo
.Ve
.IP "\-v [0|1|2|3] (verbosity level)" 4
.IX Item "-v [0|1|2|3] (verbosity level)"
The \f(CW\*(C`\-v\*(C'\fR option can take a numerical value from 0 to 3.
Specify 0 for completely silent operation and 3 for detailed reports.
.Sp
If no value is given then 1 is assumed.
See also \fBIndexReport\fR in the configuration file.
.Sp
Warnings and errors are reported regardless of the verbosity level.  In addition,
all error and warnings are written to standard out.  This is for historical reasons (many
scripts exist that parse standard out for error messages).
.SH "SEARCHING"
.IX Header "SEARCHING"
The following command line arguments are available when searching with Swish\-e.  These switches are used
to select the index to search, what fields to search, and how and what to print as results.
.PP
This section just lists the available command line arguments and their usage.
Please see SWISH-SEARCH for detailed searching instructions.
.PP
\&\fBWarning\fR: If using Swish-e via a \s-1CGI\s0 interface, please see \s-1CGI\s0 Danger!
.PP
Security Note: If the swish binary is named \fIswish-search\fR then swish will not allow any operation that
would cause swish to write to the index file.
.Sh "Searching Command Line Arguments"
.IX Subsection "Searching Command Line Arguments"
.IP "\-w *word1 word2 ...*  (query words)" 4
.IX Item "-w *word1 word2 ...*  (query words)"
This performs a case-insensitive search using a number of keywords.
If no index file to search is specified (via the \f(CW\*(C`\-f\*(C'\fR switch), swish-e will try to search a file called
index.swish\-e in the current directory.
.Sp
.Vb 1
\&    swish-e -w word
.Ve
.Sp
Phrase searching is accomplished by placing the quote delimiter (a double-quote by default) around
the search phrase.
.Sp
.Vb 1
\&    swish-e -w 'word or "this phrase"'
.Ve
.Sp
Search would should be protected from the shell by quotes.  Typically, this is single quotes when
running under Unix.
.Sp
Under Windows \fIcommand.com\fR you may not need to use quotes, but you will need to
backslash the quotes used to delimit phrases:
.Sp
.Vb 1
\&    swish-e -w \e"a phrase\e"
.Ve
.Sp
The phrase delimiter can be set with the \f(CW\*(C`\-P\*(C'\fR switch.
.Sp
The search may be limited to a \fIMetaName\fR.
For example:
.Sp
.Vb 1
\&    swish-e -w meta1=(foo or baz)
.Ve
.Sp
will only search within the \fBmeta1\fR tag.
.Sp
Please see SWISH-SEARCH for a description of MetaNames
.IP "\-f *file1 file2 ...* (index files)" 4
.IX Item "-f *file1 file2 ...* (index files)"
Specifies the index file(s) used while searching.  More than one file may be listed, and each
file will be searched.  If no \f(CW\*(C`\-f\*(C'\fR switch is specified then the file \fIindex.swish\-e\fR in the current
directory will be used as the index file.
.IP "\-m *number* (max results)" 4
.IX Item "-m *number* (max results)"
While searching, this specifies the maximum number of results to return.
The default is to return all results.
.Sp
This switch is often used in conjunction with the \f(CW\*(C`\-b\*(C'\fR switch to return results one
page at a time (strongly recommended for large indexes).
.IP "\-b *number* (beginning result)" 4
.IX Item "-b *number* (beginning result)"
Sets the \fIbegining\fR search result to return (records are numbered from 1).  This switch can be used
with the \f(CW\*(C`\-m\*(C'\fR switch to return results in groups or pages.
.Sp
Example:
.Sp
.Vb 2
\&    swish-e -w 'word' -b 1 -m 20    # first 'page'
\&    swish-e -w 'word' -b 21 -m 20   # second 'page'
.Ve
.IP "\-t HBthec (context searching)" 4
.IX Item "-t HBthec (context searching)"
The \f(CW\*(C`\-t\*(C'\fR option allows you to search for words that exist only
in specific \s-1HTML\s0 tags. Each character in the string you
specify in the argument to this option represents a
different tag in which to search for the word. H means all \s-1HEAD\s0
tags, B stands for \s-1BODY\s0 tags, t is all \s-1TITLE\s0 tags, h is H1
to H6 (header) tags, e is emphasized tags (this may be B, I,
\&\s-1EM\s0, or \s-1STRONG\s0), and c is \s-1HTML\s0 comment tags
.Sp
search only in header (<H*>) tags
.Sp
.Vb 1
\&    swish-e -w word -t h
.Ve
.IP "\-d *string* (delimiter)" 4
.IX Item "-d *string* (delimiter)"
Set the delimiter used when printing results.  By default, Swish-e separates
the output fields by a space, and places double-quotes around the document
title.  This output may be hard to parse, so it is recommended to use \f(CW\*(C`\-d\*(C'\fR to
specify a character or string used as a separator between fields.
.Sp
The string \f(CW\*(C`dq\*(C'\fR means \*(L"double\-quotes\*(R".
.Sp
.Vb 5
\&    swish-e -w word -d ,    # single char
\&    swish-e -w word -d ::   # string
\&    swish-e -w word -d '"'  # double quotes under Unix
\&    swish-e -w word -d \e"   # double quotes under Windows
\&    swish-e -w word -d dq   # double quotes
.Ve
.Sp
The following control characters may also be specified: \f(CW\*(C`\et \er \en \ef\*(C'\fR.
.Sp
Warning: This string is passed directly to \fIsprintf()\fR and therefore exposes a securty
hole.  Do not allow user data to set \-d format strings directly.
.IP "\-P *character*" 4
.IX Item "-P *character*"
Sets the delimiter used for phrase searches.  The default is double quotes \f(CW\*(C`"\*(C'\fR.
.Sp
Some examples under bash: (be careful about you shell metacharacters)
.Sp
.Vb 2
\&    swish-e -P ^ -w 'title=^words in a phrase^'
\&    swish-e -P \e' -w "title='words in a pharse"'
.Ve
.IP "\-p *property1 property2 ...*  (display properties)" 4
.IX Item "-p *property1 property2 ...*  (display properties)"
This causes swish to print the listed property in the search results.  The properties
are returned in the order they are listed in the \f(CW\*(C`\-p\*(C'\fR argument.
.Sp
Properties are defined by the \fBProperNames\fR directive in the configuration file (see SWISH-CONFIG)
and properties must also be defined in \fBMetaNames\fR.  Swish stores the text of the meta name as a \fIproperty\fR, and
then will return this text while searching if this option is used.
.Sp
Properties are very useful for returning data included in a source documnet without having to re-read
the source document while searching.  For example, this could be used to return a short document description.
See also see \fBDocument Summeries\fR and PropertyNames in SWISH-CONFIG.
.Sp
To return the subject and category properties while indexing.
.Sp
.Vb 1
\&    swish-e -w word -p subject category
.Ve
.Sp
Properties are returned in double quotes.   If a property contains a double quote it is \s-1HTML\s0 escaped (&quot;).
See the \f(CW\*(C`\-x\*(C'\fR switch for a more advanced method of returning a list of properties.
.Sp
\&\s-1NOTE:\s0 it is necessary to have indexed with the proper
PropertyNames directive in the user config file in order to
use this option.
.IP "\-s *property [asc|desc] ...*  (sort)" 4
.IX Item "-s *property [asc|desc] ...*  (sort)"
Normally, search results are printed out in order of relevancy, with the most relevant listed first.
The \f(CW\*(C`\-s\*(C'\fR sort switch allows you to sort results in order of a specified \fIproperty\fR, where a \fIproperty\fR
was defined using the \fBMetaNames\fR and \fBPropertyNames\fR directives during indexing
(see SWISH-CONFIG).
.Sp
The string passed can include the strings \f(CW\*(C`asc\*(C'\fR and \f(CW\*(C`desc\*(C'\fR to specify the sort order, and more than
one property may be specified to sort on more than one key.
.Sp
Examples:
.Sp
sort by title property ascending order
.Sp
.Vb 1
\&    -s title
.Ve
.Sp
sort descending by title, ascending by name
.Sp
.Vb 1
\&    -s title desc name asc
.Ve
.Sp
Note: Swish limits sort keys to 100 characters.  This limit can be changed
by changing \s-1MAX_SORT_STRING_LEN\s0 in src/config.h and rebuilding swish\-e.
.IP "\-L limit to a range of property values (Limit)" 4
.IX Item "-L limit to a range of property values (Limit)"
\&\fBThis is an experimental feature!\fR
.Sp
The \f(CW\*(C`\-L\*(C'\fR switch can be used to limit search results to a range of property values
.Sp
Example:
.Sp
.Vb 1
\&    swish-e -w foo -L swishtitle a m
.Ve
.Sp
finds all documents that contain the word \f(CW\*(C`foo\*(C'\fR, and where the
document's title is in the range of \f(CW\*(C`a\*(C'\fR to \f(CW\*(C`m\*(C'\fR, inclusive.
By default, the case of the property is ignored, but this can be
changed by using PropertyNamesCompareCase
configuation directive.
.Sp
Limiting may be done with user-defined properties, as well.
.Sp
For example, if you indexed documents that contain a created timestamp in a meta tag:
.Sp
.Vb 1
\&    <meta name="created_on" content="982648324">
.Ve
.Sp
Then you tell Swish that you have a property called \f(CW\*(C`created_on\*(C'\fR, and that
it's a timestamp.
.Sp
.Vb 1
\&    PropertyNamesDate created_on
.Ve
.Sp
After indexing you will be able to limit documents to a range of timestamps:
.Sp
.Vb 1
\&    -w foo -L created_on  946684800 949363199
.Ve
.Sp
will find documents containing the word foo and that have a created_on
date from the start of Jan 1, 2000 to the end of Jan 31, 2000.
.Sp
Note: swish currently does not parse dates; Unix timestamps must be used.
.Sp
Two special formats can be used:
.Sp
.Vb 2
\&    -L swishtitle <= m
\&    -L swishtitle >= m
.Ve
.Sp
Finds titles less than or equal, or grater than or equal to the letter \f(CW\*(C`m\*(C'\fR.
.Sp
This feature will not work with \f(CW\*(C`swishrank\*(C'\fR or \f(CW\*(C`swishdbfile\*(C'\fR properties.
.Sp
This feature takes advantages of the pre-sorted tables built by swish during indexing to
make this feature fast while searching.  
You should see in the indexing output a line such as:
.Sp
.Vb 1
\&   6 properties sorted.
.Ve
.Sp
That indicates that six pre-sorted tables were built during indexing.   
By default, all properties are presorted while indexing.
What properties are pre-sorted can be controlled by the configuration parameter \f(CW\*(C`PreSortedIndex\*(C'\fR.
.Sp
Using the \f(CW\*(C`\-L\*(C'\fR switch on a property that was not pre-sorted will still work, but may be \fImuch\fR
slower during searching.
.Sp
Note that the PropertyNamesSortKeyLength setting is used for sorting properties.
Using too small a PropertyNamesSortKeyLength could result in \-L selecting
the wrong properties due to incomplete sorting.
.Sp
This is an experimental feature, and its use and interface are subject to change.
.IP "\-x formatstring (extended output format)" 4
.IX Item "-x formatstring (extended output format)"
The \f(CW\*(C`\-x\*(C'\fR switch defines the output format string.  The format string can
contain plain text and property names (including swish-defined internal
property names) and is used to generate the output for every result.  In
addition, the output format of the property name can be controlled with C\-like
printf format strings.  This feature overrides the cmdline switches \f(CW\*(C`\-d\*(C'\fR and
\&\f(CW\*(C`\-p\*(C'\fR, and a warning will be generated if \f(CW\*(C`\-d\*(C'\fR or \f(CW\*(C`\-p\*(C'\fR are used with \f(CW\*(C`\-x\*(C'\fR.
.Sp
Warning: The format string (fmt) is passed directly to \fIsprintf()\fR and therefore exposes a securty
hole.  Do not allow user data to set \-x format strings directly.
.Sp
For example, to return just the title, one per line, in the search results:
.Sp
.Vb 1
\&    swish-e  -w ...   -x '<swishtitle>\en' ...
.Ve
.Sp
Note: the \f(CW\*(C`\en\*(C'\fR may need to be protected from your shell.
.Sp
See also ResultExtFormatName for a way to define \fInamed\fR
format strings in the swish configuration file.
.Sp
\&\fBFormat of \*(L"formatstring\*(R":\fR
.Sp
.Vb 1
\&    "text<propertyname>text<propertyname fmt=propfmtstr>text..."
.Ve
.Sp
Where \fBpropertyname\fR is:
.RS 4
.IP "*" 4
the name of a user property as specified with the config file
directive \*(L"PropertyNames\*(R"
.IP "*" 4
the name of a swish Auto property (see below).  These properties are
defined automatically by swish \*(-- you do not need to specify them
with PropertyNames directive.  (This may change in the future.)
.RE
.RS 4
.Sp
propertynames must be placed within "<\*(L" and \*(R">".
.Sp
\&\fBUser properties:\fR
.Sp
Swish-e allows you to specify certain \s-1META\s0 tags within your documents that can be used as \fBdocument properties\fR.
The contents of any \s-1META\s0 tag that has been identified as a document property can be returned as
part of the search results.  Doucment properties must be defined while indexing using the \fBPropertyNames\fR
configuration directive (see SWISH-CONFIG).
.Sp
Examples of user-defined PropertyNames:
.Sp
.Vb 5
\&    <keywords>
\&    <author>
\&    <deliveredby>
\&    <reference>
\&    <id>
.Ve
.Sp
\&\fBAuto properties:\fR
.Sp
Swish defines a number of \*(L"Auto\*(R" properties for each document indexed.
These are available for output when using the \f(CW\*(C`\-x\*(C'\fR format.
.Sp
.Vb 10
\&    Name               Type     Contents
\&    --------------     -------  ----------------------------------------------
\&    swishreccount      Integer  Result record counter
\&    swishtitle         String   Document title
\&    swishrank          Integer  Result rank for this hit
\&    swishdocpath       String   URL or filepath to document
\&    swishdocsize       Integer  Document size in bytes
\&    swishlastmodified  Date     Last modified date of document
\&    swishdescription   String   Description of document (see:StoreDescription)
\&    swishdbfile        String   Path of swish database indexfile
.Ve
.Sp
The Auto properties can also be specified using shortcuts:
.Sp
.Vb 10
\&    Shortcut    Property Name        
\&    --------    --------------
\&      %c        swishreccount
\&      %d        swishdescription
\&      %D        swishlastmodified
\&      %I        swishdbfile
\&      %p        swishdocpath
\&      %r        swishrank
\&      %l        swishdocsize
\&      %t        swishtitle
.Ve
.Sp
For example, these are equivalent:
.Sp
.Vb 2
\&   -x '<swishrank>:<swishdocpath>:<swishtitle>\en'
\&   -x '%r:%p:%t\en'
.Ve
.Sp
Use a double percent sign \*(L"%%\*(R" to enter a literal percent sign in the output.
.Sp
\&\fBFormatstrings of properties:\fR
.Sp
Properties listed in an \f(CW\*(C`\-x\*(C'\fR format string can include format control strings.
These \*(L"propertyformats\*(R" are used to control how the contents of the associated property are printed.
Property formats are used like C\-language printf formats.
The property format is specified by including the attribute \*(L"fmt\*(R" within the property tag.
.Sp
Format strings cannot be used with the \*(L"%\*(R" shortcuts described above.
.Sp
General syntax:
.Sp
.Vb 1
\&    -x '<propertyname fmt="propfmtstr">'
.Ve
.Sp
where \f(CW\*(C`subfmt\*(C'\fR controls the output format of \f(CW\*(C`propertyname\*(C'\fR.    
.Sp
Examples of property format strings:
.Sp
.Vb 3
\&        date type:    <swishlastmodified fmt="%d.%m.%Y">
\&        string type:  <swishtitle fmt="%-40.35s">
\&        integer type: <swishreccount fmt=/%8.8d/>
.Ve
.Sp
Please see the manual pages for \fIstrftime\fR\|(3) and \fIsprintf\fR\|(3) for an explanation of
format strings.  Note: some versions of strftime do not offer the \f(CW%s\fR format string
(number of seconds since the Epoch), so swish provides a special format string \*(L"%ld\*(R"
to display the number of seconds since the Epoch.
.Sp
The first character of a property format string defines the delimiter for the format string.
For example,
.Sp
.Vb 3
\&    -x  "<author  fmt=[%20s]> ...\en"
\&    -x  "<author  fmt='%20s'> ...\en"
\&    -x  "<author  fmt=/%20s/> ...\en"
.Ve
.Sp
\&\fBStandard predefined formats:\fR
.Sp
If you ommit the sub\-format, the following formats are used:
.Sp
.Vb 4
\&    String type:       "%s"  (like printf char *)
\&    Integer type:      "%d"  (like printf int)
\&    Float type:        "%f"  (like printf double) 
\&    Date type:         "%Y-%m-%d %H:%M:%S" (like strftime)
.Ve
.Sp
\&\fBText in \*(L"formatstring\*(R" or \*(L"propfmtstr\*(R":\fR
.Sp
Text will be output as-is in format strings (and property format strings).
Special characters can be escaped with a backslash.
To get a new line for each result hit, you have to include
the Newline-Character \*(L"\en\*(R" at the end of \*(L"fmtstr\*(R".
.Sp
.Vb 5
\&    -x "<swishreccount>|<swishrank>|<swishdocpath>\en"
\&    -x "Count=<swishreccount>, Rank=<swishrank>\en"
\&    -x "Title=\e<b\e><swishtitle>\e</b\e>"
\&    -x 'Date: <swishlastmodified fmt="%m/%d/%Y">\en'
\&    -x 'Date in seconds: <swishlastmodified fmt=/%ld/>\en'
.Ve
.Sp
\&\fBControl/Escape charcters:\fR
.Sp
you can use C\-like control escapes in the format string:
.Sp
.Vb 3
\&   known controls:      \ea, \eb, \ef, \en, \er, \et, \ev,
\&   digit escapes:       \exhexdigits   \e0octaldigits
\&   character escapes:   \eanychar
.Ve
.Sp
Example,
.Sp
.Vb 1
\&    swish -x "%c\et%r\et%p\et\e"<swishtitle fmt=/%40s/>\e"\en"
.Ve
.Sp
\&\fBExamples of \-x format strings:\fR
.Sp
.Vb 5
\&    -x "%c|%r|%p|%t|%D|%d\en"
\&    -x "%c|%r|%p|%t|<swishdate fmt=/%A, %d. %B %Y/>|%d\en"
\&    -x "<swishrank>\et<swishdocpath>\et<swishtitle>\et<keywords>\en
\&    -x "xml_out: \e<title\e><swishtitle>\e>\e</title\e>\en"
\&    -x "xml_out: <swishtitle fmt='<title>%s</title>'>\en"
.Ve
.RE
.IP "\-H [0|1|2|3|<n>]  (header output verbosity)" 4
.IX Item "-H [0|1|2|3|<n>]  (header output verbosity)"
The \f(CW\*(C`\-H n\*(C'\fR switch generates extened \fIheader\fR output.  This is most useful when searching more than one
index file at a time by specifying more than one index file with the \f(CW\*(C`\-f\*(C'\fR switch.
\&\f(CW\*(C`\-H 2\*(C'\fR will generate a set of headers specific to each index file.
This gives access to the settings used to generate each index file.
.Sp
Even when searching a single index file, \f(CW\*(C`\-H n\*(C'\fR will provided additional information about the index file,
how it was indexed, and how swish is interperting the query.
.Sp
.Vb 5
\&    -H 0 : print no header information, output only search result entries.
\&    -H 1 : print standard result header (default).
\&    -H 2 : print additional header information for each searched index file.
\&    -H 3 : enhanced header output (e.g. print stopwords).
\&    -H 9 : print diagnostic information in the header of the results (changed from: C<-v 4>)
.Ve
.IP "\-R [0|1] (Ranking Scheme)" 4
.IX Item "-R [0|1] (Ranking Scheme)"
\&\fBThis is an experimental feature!\fR
.Sp
The default ranking scheme in SWISH-E evaluates each word in a query in terms of its frequency
and position in each document. The default scheme is 0.
.Sp
New in version 2.4.3 you may optionally select an experimental ranking scheme that, in addition
to document frequency and position, uses Inverse Document Frequency (\s-1IDF\s0), 
or the relative frequency of each word across all the indexes
being searched, and Relative Density, or the normalization of the frequency of a word
in relationship to the number of words in the document.
.Sp
\&\fB\s-1NOTE:\s0\fR IgnoreTotalWordCountWhenRanking must be set to \fBno\fR or \fB0\fR in your index(es)
for \-R 1 to work.
.Sp
Specify \-R 1 to turn on \s-1IDF\s0 ranking. See the \s-1API\s0 documentation for how to set
the ranking scheme in your Perl or C program.
.SH "OTHER SWITCHES"
.IX Header "OTHER SWITCHES"
.IP "\-V (version)" 4
.IX Item "-V (version)"
Print the current version.
.IP "\-k *letter* (print out keywords)" 4
.IX Item "-k *letter* (print out keywords)"
The \f(CW\*(C`\-k\*(C'\fR switch is used for testing and will cause swish to print out all keywords
in the index beginning with that letter.  You may enter \f(CW\*(C`\-k '*'\*(C'\fR to generate a list of all words indexed
by swish.
.IP "\-D *index file*  (debug index)" 4
.IX Item "-D *index file*  (debug index)"
The \-D option is no longer supported in version 2.2.
.IP "\-T *options* (trace/debug swish)" 4
.IX Item "-T *options* (trace/debug swish)"
The \-T option is used to print out information that may be helpful when debugging swish\-e's
operation.  This option replaced the \f(CW\*(C`\-D\*(C'\fR option of previous versions.
.Sp
Running \f(CW\*(C`\-T help\*(C'\fR will print out a list of available *options*
.SH "Merging Index Files"
.IX Header "Merging Index Files"
In previous versions of Swish-e indexing would require a very large amount of memory and the indexing
process could be very slow.  Merging provided a way to index in chunks and then combine the indexes together
into a single index.
.PP
Indexing is much faster now and uses much less memory, and with the \f(CW\*(C`\-e\*(C'\fR switch very little memory is
needed to index a large site.
.PP
Still, at times it can be useful to merge different index files into one file for searching.
This could be because you want to keep separate site indexes and a common one for a global search, or
you have separate collections of documents that you wish to search all at one time, but manage separately.
.IP "\-M *index1 index2 ... indexN out_index" 4
.IX Item "-M *index1 index2 ... indexN out_index"
Merges the indexes specified on the command line \*(-- the last file name entered is the output file.
The output index must not exist (otherwise merge will not proceed).
.Sp
Only indexes that were indexed with common settings may be merged.
(e.g. don't mix stemming and non-stemming indexes, or indexes with different WordCharacter settings, etc.).
.Sp
Use the \f(CW\*(C`\-e\*(C'\fR switch while merging to reduce memory usage.
.Sp
Merge generates progress messages regardless of the setting of \f(CW\*(C`\-v\*(C'\fR.
.IP "\-c *configuration file*" 4
.IX Item "-c *configuration file*"
Specify a configuration file while indexing to add administrative information to the output index file.
.SH "Document Info"
.IX Header "Document Info"
$Id: \s-1SWISH\-RUN\s0.pod,v 1.35 2004/08/31 03:15:03 karman Exp $
.PP
\&.