Debian Codegraph @

test/t_search

raw ◀ ▶
1 Debian patch touch this file
1 #
•2 # Part of the ht://Dig package <https://htdig.sourceforge.net/>
3 # Copyright (c) 1999-2004 The ht://Dig Group
4 # For copyright details, see the file COPYING in your distribution
5 # or the GNU Library General Public License (LGPL) version 2 or later
6 # <http://www.gnu.org/copyleft/lgpl.html>
7 #
8 # $Id: t_search,v 1.4 2004/05/28 13:15:30 lha Exp $
9 #
10
11 . ./test_functions
12
13 export MIFLUZ_CONFIG ; MIFLUZ_CONFIG=${srcdir}/mifluz-search.conf
14
15 #
16 # Test the query parser
17 #
18
19 #
20 # Run $1 and expect $2 as a result
21 #
22 runparser() {
23 command="$1"
24 expected="$2"
25 out=`eval "$command"`
26 if [ "$expected" != "$out" ]
27 then
28 echo "running $command: expected
29 $expected
30 but got
31 $out"
32 exit 1
33 fi
34 }
35
36 #
37 # Simple test
38 #
39 runparser "./search -n -f '( and scope1 the world )' $VERBOSE" \
40 '( and "scope1" the world )'
41
42 #
43 # All boolean constructions
44 #
45 runparser "./search -n -f '( and scope1 ( not scope2 the ) world ( or scope3 is coming to ( near scope4 an ( literal scope5 end ) ) ) )' $VERBOSE" \
46 '( and "scope1" ( not "scope2" the ) world ( or "scope3" is coming to ( near "scope4" an ( literal "scope5" end ) ) ) )'
47
48 #
49 # Mandatory and Forbiden nodes
50 #
51 runparser "./search -n -f '( or scope1 ( mandatory scope2 the ) world ( forbiden scope3 is ) )' $VERBOSE" \
52 '( or "scope1" ( mandatory "scope2" the ) world ( not "scope3" is ) )'
53
54 #
55 # Test the WordExclude* classes
56 #
57 ./search -e || exit 1
58
59 #
60 # Run queries with various operators on an index built from the content
61 # of search.txt.
62 #
63
64 ./txt2mifluz $VERBOSE < $srcdir/search.txt
65
66 #
67 # Run $1 and expect $2 as a result (all lines starting with match:)
68 # Feed the context variable with output starting with context:, stripping
69 # context: itself.
70 #
71 runsearch() {
72 command="$1"
73 expected="$2"
74 if [ "$VERBOSE" ]
75 then
76 echo "running $command" >&2
77 fi
78 out=`eval "$command"`
79 match=`echo "$out" | grep '^match:'`
80 context=`echo "$out" | sed -n -e 's/^context: *//p'`
81 # echo "context: $context" >&2
82 if [ "$expected" != "$match" ]
83 then
84 echo "running $command: expected
85 $expected
86 but got
87 $match"
88 exit 1
89 fi
90 }
91
92
93 #
94 # Test context restoration on WordTreeLiteral
95 #
96 runsearch "./search -c 1 -f 'lazy' $VERBOSE" \
97 'match: <UNDEF> <DEF> 0 1 11 <UNDEF> '
98
99 runsearch "./search -c 1 -C '$context' -f 'lazy' $VERBOSE" \
100 'match: <UNDEF> <DEF> 0 1 21 <UNDEF> '
101
102 #
103 # Literal search using scope : only want documents with Flags set to 5
104 # Be carefull to use tabulation in scope.
105 #
106 runsearch "./search -f '( literal \"<UNDEF> <UNDEF> <UNDEF> 5 <UNDEF> <UNDEF>\" lazy )' $VERBOSE" \
107 'match: <UNDEF> <DEF> 0 5 9 <UNDEF>
108 match: <UNDEF> <DEF> 0 5 21 <UNDEF>
109 match: <UNDEF> <DEF> 0 5 53 <UNDEF>
110 match: <UNDEF> <DEF> 0 5 56 <UNDEF> '
111
112 #
113 # And search using scope : only want documents with Flags set to 5
114 # Be carefull to use tabulation in scope.
115 #
116 runsearch "./search -f '( and \"\" ( literal \"<UNDEF> <UNDEF> <UNDEF> 5 <UNDEF> <UNDEF>\" lazy ) dog )' $VERBOSE" \
117 'match: <UNDEF> <DEF> 0 5 21 <UNDEF> (dog lazy )
118 match: <UNDEF> <DEF> 0 5 53 <UNDEF> (dog lazy )
119 match: <UNDEF> <DEF> 0 5 56 <UNDEF> (dog lazy )'
120
121 #
122 # And/Not : document 20 is excluded because it contains 'an'
123 #
124 runsearch "./search -f '( and \"\" world ( not \"\" an ) the )' $VERBOSE" \
125 'match: <UNDEF> <DEF> 0 0 5 <UNDEF> (world the )
126 match: <UNDEF> <DEF> 0 0 21 <UNDEF> (world the )
127 match: <UNDEF> <DEF> 0 0 51 <UNDEF> (world the )
128 match: <UNDEF> <DEF> 0 0 71 <UNDEF> (world the )
129 match: <UNDEF> <DEF> 0 0 81 <UNDEF> (world the )'
130
131 #
132 # Or/Not : document 20 is excluded because it contains 'an'
133 #
134 runsearch "./search -f '( or \"\" world ( not \"\" an ) the )' $VERBOSE" \
135 'match: <UNDEF> <DEF> 0 0 3 <UNDEF> (the )
136 match: <UNDEF> <DEF> 0 0 5 <UNDEF> (world the )
137 match: <UNDEF> <DEF> 0 0 11 <UNDEF> (world )
138 match: <UNDEF> <DEF> 0 0 21 <UNDEF> (world the )
139 match: <UNDEF> <DEF> 0 0 51 <UNDEF> (world the )
140 match: <UNDEF> <DEF> 0 0 71 <UNDEF> (world the )
141 match: <UNDEF> <DEF> 0 0 81 <UNDEF> (world the )'
142
143 #
144 # Or : each word matches only once in separate documents
145 #
146 runsearch "./search -c 2 -f '( or \"\" comes end )' $VERBOSE" \
147 'match: <UNDEF> <DEF> 0 0 6 <UNDEF> (comes )
148 match: <UNDEF> <DEF> 0 0 20 <UNDEF> (end )'
149
150 #
151 # Or : each word matches only once in separate documents
152 # docid 20 contains 'the' and 'end', therefore first
153 # docid 6 contains 'comes', is second before any document
154 # containing 'the' alone because 'comes' is less frequent than 'the'
155 # other docid only contain 'the'.
156 #
157 runsearch "./search -c 8 -f '( or \"\" the comes end )' $VERBOSE" \
158 'match: <UNDEF> <DEF> 0 0 3 <UNDEF> (the )
159 match: <UNDEF> <DEF> 0 0 5 <UNDEF> (the )
160 match: <UNDEF> <DEF> 0 0 6 <UNDEF> (comes )
161 match: <UNDEF> <DEF> 0 0 20 <UNDEF> (the end )
162 match: <UNDEF> <DEF> 0 0 21 <UNDEF> (the )
163 match: <UNDEF> <DEF> 0 0 51 <UNDEF> (the )
164 match: <UNDEF> <DEF> 0 0 71 <UNDEF> (the )
165 match: <UNDEF> <DEF> 0 0 81 <UNDEF> (the )'
166
167 #
168 # Run the same search in 3 times using context to resume search
169 #
170 runsearch "./search -c 2 -f '( or \"\" the comes end )' $VERBOSE" \
171 'match: <UNDEF> <DEF> 0 0 3 <UNDEF> (the )
172 match: <UNDEF> <DEF> 0 0 5 <UNDEF> (the )'
173
174 runsearch "./search -c 2 -C '$context' -f '( or \"\" the comes end )' $VERBOSE" \
175 'match: <UNDEF> <DEF> 0 0 6 <UNDEF> (comes )
176 match: <UNDEF> <DEF> 0 0 20 <UNDEF> (the end )'
177
178 runsearch "./search -c 5 -C '$context' -f '( or \"\" the comes end )' $VERBOSE" \
179 'match: <UNDEF> <DEF> 0 0 21 <UNDEF> (the )
180 match: <UNDEF> <DEF> 0 0 51 <UNDEF> (the )
181 match: <UNDEF> <DEF> 0 0 71 <UNDEF> (the )
182 match: <UNDEF> <DEF> 0 0 81 <UNDEF> (the )'
183
184 #
185 # After a search that stopped because there was not matches left, there
186 # must be no context for resuming.
187 #
188 if test "$context" != ""
189 then
190 echo "Expected empty context after fulfilled search"
191 exit 1
192 fi
193
194 #
195 # Or search with word not in database (klklk)
196 #
197 runsearch "./search -f '( or \"\" the klkl )' $VERBOSE" \
198 'match: <UNDEF> <DEF> 0 0 3 <UNDEF> (the )
199 match: <UNDEF> <DEF> 0 0 5 <UNDEF> (the )
200 match: <UNDEF> <DEF> 0 0 20 <UNDEF> (the )
201 match: <UNDEF> <DEF> 0 0 21 <UNDEF> (the )
202 match: <UNDEF> <DEF> 0 0 51 <UNDEF> (the )
203 match: <UNDEF> <DEF> 0 0 71 <UNDEF> (the )
204 match: <UNDEF> <DEF> 0 0 81 <UNDEF> (the )'
205
206 #
207 # Compound boolean query: nested 'and'
208 #
209 runsearch "./search -f '( and \"\" the ( and \"\" an end ) )' $VERBOSE" \
210 'match: <UNDEF> <DEF> 0 0 20 <UNDEF> (an end the )'
211
212 #
213 # Compound boolean query: nested 'and' that fails immediately
214 # because 'foo' is not in the inverted index.
215 #
216 runsearch "./search -f '( and \"\" the ( and \"\" an foo ) )' $VERBOSE" \
217 'match: none'
218
219 #
220 # Compound boolean query: 'or' & 'and'
221 #
222 runsearch "./search -f '( and \"\" the ( or \"\" comes end ) )' $VERBOSE" \
223 'match: <UNDEF> <DEF> 0 0 20 <UNDEF> (end the )'
224
225 runsearch "./search -f '( or \"\" comes ( and \"\" the world ) )' $VERBOSE" \
226 'match: <UNDEF> <DEF> 0 0 5 <UNDEF> (world the )
227 match: <UNDEF> <DEF> 0 0 6 <UNDEF> (comes )
228 match: <UNDEF> <DEF> 0 0 20 <UNDEF> (world the )
229 match: <UNDEF> <DEF> 0 0 21 <UNDEF> (world the )
230 match: <UNDEF> <DEF> 0 0 51 <UNDEF> (world the )
231 match: <UNDEF> <DEF> 0 0 71 <UNDEF> (world the )
232 match: <UNDEF> <DEF> 0 0 81 <UNDEF> (world the )'
233
234 runsearch "./search -P 1 -f '( or \"\" comes ( near \"\" lazy dog ) )' $VERBOSE" \
235 'match: <UNDEF> <DEF> 0 0 6 <UNDEF> (comes )
236 match: <UNDEF> <DEF> 0 1 11 <UNDEF> (lazy dog proximity )
237 match: <UNDEF> <DEF> 0 1 21 <UNDEF> (lazy dog proximity )
238 match: <UNDEF> <DEF> 0 5 21 <UNDEF> (lazy dog proximity )
239 match: <UNDEF> <DEF> 0 5 56 <UNDEF> (lazy dog proximity )'
240
241 #
242 # Compound boolean query: limit to 2 documents
243 #
244 runsearch "./search -f '( or \"\" comes ( or \"\" the world ) )' $VERBOSE" \
245 'match: <UNDEF> <DEF> 0 0 3 <UNDEF> (the )
246 match: <UNDEF> <DEF> 0 0 5 <UNDEF> (the world )
247 match: <UNDEF> <DEF> 0 0 6 <UNDEF> (comes )
248 match: <UNDEF> <DEF> 0 0 11 <UNDEF> (world )
249 match: <UNDEF> <DEF> 0 0 20 <UNDEF> (the world )
250 match: <UNDEF> <DEF> 0 0 21 <UNDEF> (the world )
251 match: <UNDEF> <DEF> 0 0 51 <UNDEF> (the world )
252 match: <UNDEF> <DEF> 0 0 71 <UNDEF> (the world )
253 match: <UNDEF> <DEF> 0 0 81 <UNDEF> (the world )'
254
255 runsearch "./search -c 1 -f '( or \"\" comes ( or \"\" the world ) )' $VERBOSE" \
256 'match: <UNDEF> <DEF> 0 0 3 <UNDEF> (the )'
257
258 runsearch "./search -c 4 -C '$context' -f '( or \"\" comes ( or \"\" the world ) )' $VERBOSE" \
259 'match: <UNDEF> <DEF> 0 0 5 <UNDEF> (the world )
260 match: <UNDEF> <DEF> 0 0 6 <UNDEF> (comes )
261 match: <UNDEF> <DEF> 0 0 11 <UNDEF> (world )
262 match: <UNDEF> <DEF> 0 0 20 <UNDEF> (the world )'
263
264
265 #
266 # Compound boolean query: nested 'optional'
267 #
268 runsearch "./search -f '( optional \"\" the ( optional \"\" world foo ) )' $VERBOSE" \
269 'match: <UNDEF> <DEF> 0 0 5 <UNDEF> (world the proximity)
270 match: <UNDEF> <DEF> 0 0 20 <UNDEF> (world the )
271 match: <UNDEF> <DEF> 0 0 21 <UNDEF> (world the )
272 match: <UNDEF> <DEF> 0 0 51 <UNDEF> (world the )
273 match: <UNDEF> <DEF> 0 0 71 <UNDEF> (world the )
274 match: <UNDEF> <DEF> 0 0 81 <UNDEF> (world the )
275 match: <UNDEF> <DEF> 0 0 11 <UNDEF> (world )
276 match: <UNDEF> <DEF> 0 0 3 <UNDEF> (the )'
277
278 #
279 #
280 # Most simple search : single word
281 #
282 runsearch "./search -f 'the' $VERBOSE" \
283 'match: <UNDEF> <DEF> 0 0 3 <UNDEF>
284 match: <UNDEF> <DEF> 0 0 5 <UNDEF>
285 match: <UNDEF> <DEF> 0 0 20 <UNDEF>
286 match: <UNDEF> <DEF> 0 0 21 <UNDEF>
287 match: <UNDEF> <DEF> 0 0 51 <UNDEF>
288 match: <UNDEF> <DEF> 0 0 71 <UNDEF>
289 match: <UNDEF> <DEF> 0 0 81 <UNDEF> '
290
291 #
292 # Get all we can
293 #
294 runsearch "./search -f '( and \"\" the world )' $VERBOSE" \
295 'match: <UNDEF> <DEF> 0 0 5 <UNDEF> (world the )
296 match: <UNDEF> <DEF> 0 0 20 <UNDEF> (world the )
297 match: <UNDEF> <DEF> 0 0 21 <UNDEF> (world the )
298 match: <UNDEF> <DEF> 0 0 51 <UNDEF> (world the )
299 match: <UNDEF> <DEF> 0 0 71 <UNDEF> (world the )
300 match: <UNDEF> <DEF> 0 0 81 <UNDEF> (world the )'
301
302 #
303 # First two
304 #
305 runsearch "./search -c 2 -f '( and \"\" the world )' $VERBOSE" \
306 'match: <UNDEF> <DEF> 0 0 5 <UNDEF> (world the )
307 match: <UNDEF> <DEF> 0 0 20 <UNDEF> (world the )'
308
309 #
310 # The next two
311 #
312 runsearch "./search -b 2 -c 2 -f '( and \"\" the world )' $VERBOSE" \
313 'match: <UNDEF> <DEF> 0 0 21 <UNDEF> (world the )
314 match: <UNDEF> <DEF> 0 0 51 <UNDEF> (world the )'
315
316 #
317 # First four
318 #
319 runsearch "./search -c 4 -f '( and \"\" the world )' $VERBOSE" \
320 'match: <UNDEF> <DEF> 0 0 5 <UNDEF> (world the )
321 match: <UNDEF> <DEF> 0 0 20 <UNDEF> (world the )
322 match: <UNDEF> <DEF> 0 0 21 <UNDEF> (world the )
323 match: <UNDEF> <DEF> 0 0 51 <UNDEF> (world the )'
324
325 #
326 # Next document, using last document returned
327 #
328 runsearch "./search -c 1 -C '$context' -f '( and \"\" the world )' $VERBOSE" \
329 'match: <UNDEF> <DEF> 0 0 71 <UNDEF> (world the )'
330
331 #
332 # Implicit or : each word matches only once in separate documents
333 #
334 runsearch "./search -c 2 -f '( optional \"\" comes end )' $VERBOSE" \
335 'match: <UNDEF> <DEF> 0 0 6 <UNDEF> (comes )
336 match: <UNDEF> <DEF> 0 0 20 <UNDEF> (end )'
337
338 #
339 # Implicit or : each word matches only once in separate documents
340 # docid 20 contains 'the' and 'end', therefore first
341 # docid 6 contains 'comes', is second before any document
342 # containing 'the' alone because 'comes' is less frequent than 'the'
343 # other docid only contain 'the'.
344 #
345 runsearch "./search -c 8 -f '( optional \"\" the comes end )' $VERBOSE" \
346 'match: <UNDEF> <DEF> 0 0 20 <UNDEF> (end the proximity)
347 match: <UNDEF> <DEF> 0 0 6 <UNDEF> (comes )
348 match: <UNDEF> <DEF> 0 0 3 <UNDEF> (the )
349 match: <UNDEF> <DEF> 0 0 5 <UNDEF> (the )
350 match: <UNDEF> <DEF> 0 0 21 <UNDEF> (the )
351 match: <UNDEF> <DEF> 0 0 51 <UNDEF> (the )
352 match: <UNDEF> <DEF> 0 0 71 <UNDEF> (the )
353 match: <UNDEF> <DEF> 0 0 81 <UNDEF> (the )'
354
355 #
356 # Run the same search in 3 times using context to resume search
357 #
358 runsearch "./search -c 2 -f '( optional \"\" the comes end )' $VERBOSE" \
359 'match: <UNDEF> <DEF> 0 0 20 <UNDEF> (end the proximity)
360 match: <UNDEF> <DEF> 0 0 6 <UNDEF> (comes )'
361
362 runsearch "./search -c 2 -C '$context' -f '( optional \"\" the comes end )' $VERBOSE" \
363 'match: <UNDEF> <DEF> 0 0 3 <UNDEF> (the )
364 match: <UNDEF> <DEF> 0 0 5 <UNDEF> (the )'
365
366 runsearch "./search -c 5 -C '$context' -f '( optional \"\" the comes end )' $VERBOSE" \
367 'match: <UNDEF> <DEF> 0 0 21 <UNDEF> (the )
368 match: <UNDEF> <DEF> 0 0 51 <UNDEF> (the )
369 match: <UNDEF> <DEF> 0 0 71 <UNDEF> (the )
370 match: <UNDEF> <DEF> 0 0 81 <UNDEF> (the )'
371
372 #
373 # After a search that stopped because there was not matches left, there
374 # must be no context for resuming.
375 #
376 if test "$context" != ""
377 then
378 echo "Expected empty context after fulfilled search"
379 exit 1
380 fi
381
382 #
383 # Or search with word not in database (klklk)
384 #
385 runsearch "./search -f '( optional \"\" the klkl )' $VERBOSE" \
386 'match: <UNDEF> <DEF> 0 0 3 <UNDEF> (the )
387 match: <UNDEF> <DEF> 0 0 5 <UNDEF> (the )
388 match: <UNDEF> <DEF> 0 0 20 <UNDEF> (the )
389 match: <UNDEF> <DEF> 0 0 21 <UNDEF> (the )
390 match: <UNDEF> <DEF> 0 0 51 <UNDEF> (the )
391 match: <UNDEF> <DEF> 0 0 71 <UNDEF> (the )
392 match: <UNDEF> <DEF> 0 0 81 <UNDEF> (the )'
393
394 #
395 # And search with word not in database (klklk)
396 #
397 runsearch "./search -c 1 -f '( and \"\" comes klkl )' $VERBOSE" \
398 'match: none'
399
400 #
401 # From there we deal with more complex keys (TAG,SERVER,URL)
402 # instead of URL alone above.
403 #
404
405 #
406 # And search with 'dog lazy'
407 #
408 runsearch "./search -c 3 -f '( and \"\" dog lazy )' $VERBOSE" \
409 'match: <UNDEF> <DEF> 0 1 11 <UNDEF> (dog lazy )
410 match: <UNDEF> <DEF> 0 1 21 <UNDEF> (dog lazy )
411 match: <UNDEF> <DEF> 0 5 21 <UNDEF> (dog lazy )'
412
413 #
414 # And search with 'dog lazy' one URL per server only (-S)
415 #
416 runsearch "./search -S -f '( and \"\" dog lazy )' $VERBOSE" \
417 'match: <UNDEF> <DEF> 0 1 11 <UNDEF> (dog lazy )
418 match: <UNDEF> <DEF> 0 5 21 <UNDEF> (dog lazy )
419 match: <UNDEF> <DEF> 0 6 1 <UNDEF> (dog lazy )'
420
421 #
422 # Or search with 'dog lazy' one URL per server only (-S)
423 #
424 runsearch "./search -S -f '( optional \"\" dog lazy )' $VERBOSE" \
425 'match: <UNDEF> <DEF> 0 1 11 <UNDEF> (dog lazy proximity)
426 match: <UNDEF> <DEF> 0 5 21 <UNDEF> (dog lazy )
427 match: <UNDEF> <DEF> 0 6 1 <UNDEF> (dog lazy )
428 match: <UNDEF> <DEF> 0 5 9 <UNDEF> (lazy )'
429
430 #
431 # Near search with 'lazy dog'
432 #
433 runsearch "./search -f '( near \"\" lazy dog )' $VERBOSE" \
434 'match: <UNDEF> <DEF> 0 1 11 <UNDEF> (lazy dog proximity)
435 match: <UNDEF> <DEF> 0 1 21 <UNDEF> (lazy dog proximity)
436 match: <UNDEF> <DEF> 0 5 21 <UNDEF> (lazy dog proximity)
437 match: <UNDEF> <DEF> 0 5 56 <UNDEF> (lazy dog proximity)'
438
439 #
440 # Near search with 'dog lazy'
441 #
442 runsearch "./search -f '( near \"\" dog lazy )' $VERBOSE" \
443 'match: <UNDEF> <DEF> 0 1 11 <UNDEF> (dog lazy proximity)'
444
445 #
446 # Near search with 'dog lazy', order of term is not meaningfull
447 # matching 'dog lazy' and 'lazy dog'
448 #
449 runsearch "./search -P -1 -f '( near \"\" dog lazy )' $VERBOSE" \
450 'match: <UNDEF> <DEF> 0 1 11 <UNDEF> (dog lazy proximity)
451 match: <UNDEF> <DEF> 0 1 21 <UNDEF> (dog lazy proximity)
452 match: <UNDEF> <DEF> 0 5 21 <UNDEF> (dog lazy proximity)
453 match: <UNDEF> <DEF> 0 5 56 <UNDEF> (dog lazy proximity)'
454
455 #
456 # Near search with 'dog lazy', order of term is not meaningfull
457 # tolerance is -2, adding match for 'dog ? lazy' and 'lazy ? dog'
458 #
459 runsearch "./search -P -2 -f '( near \"\" dog lazy )' $VERBOSE" \
460 'match: <UNDEF> <DEF> 0 1 11 <UNDEF> (dog lazy proximity)
461 match: <UNDEF> <DEF> 0 1 21 <UNDEF> (dog lazy proximity)
462 match: <UNDEF> <DEF> 0 5 21 <UNDEF> (dog lazy proximity)
463 match: <UNDEF> <DEF> 0 5 53 <UNDEF> (dog lazy proximity)
464 match: <UNDEF> <DEF> 0 5 56 <UNDEF> (dog lazy proximity)'
465
466 #
467 # Near search with 'dog lazy', order of term is meaningfull
468 # tolerance is 3, adding match for 'dog ? lazy' and 'dog ? ? lazy'
469 #
470 runsearch "./search -P 3 -f '( near \"\" dog lazy )' $VERBOSE" \
471 'match: <UNDEF> <DEF> 0 1 11 <UNDEF> (dog lazy proximity)
472 match: <UNDEF> <DEF> 0 6 1 <UNDEF> (dog lazy proximity)'
473
474 #
475 # Near search with 'lazy dog', only first 2
476 #
477 runsearch "./search -c 2 -f '( near \"\" lazy dog )' $VERBOSE" \
478 'match: <UNDEF> <DEF> 0 1 11 <UNDEF> (lazy dog proximity)
479 match: <UNDEF> <DEF> 0 1 21 <UNDEF> (lazy dog proximity)'
480
481 #
482 # Near search with 'lazy dog', resume from previous search
483 # and get 2 more.
484 #
485 runsearch "./search -c 2 -C '$context' -f '( near \"\" lazy dog )' $VERBOSE" \
486 'match: <UNDEF> <DEF> 0 5 21 <UNDEF> (lazy dog proximity)
487 match: <UNDEF> <DEF> 0 5 56 <UNDEF> (lazy dog proximity)'
488
489 #
490 # Near search with non existent word
491 #
492 runsearch "./search -f '( near \"\" lazy bar )' $VERBOSE" \
493 'match: none'
494
495 #
496 # Or search using proximity (document 0 5 53 contains lazy ? dog)
497 # order of term is meaningfull.
498 #
499 runsearch "./search -P 2 -f '( optional \"\" lazy dog )' $VERBOSE" \
500 'match: <UNDEF> <DEF> 0 1 11 <UNDEF> (dog lazy proximity)
501 match: <UNDEF> <DEF> 0 1 21 <UNDEF> (dog lazy )
502 match: <UNDEF> <DEF> 0 5 21 <UNDEF> (dog lazy )
503 match: <UNDEF> <DEF> 0 5 53 <UNDEF> (dog lazy )
504 match: <UNDEF> <DEF> 0 5 56 <UNDEF> (dog lazy )
505 match: <UNDEF> <DEF> 0 6 1 <UNDEF> (dog lazy )
506 match: <UNDEF> <DEF> 0 5 9 <UNDEF> (lazy )'
507
508 #
509 # Or search using proximity (document 0 5 53 contains lazy ? dog)
510 # order of term is not meaningfull.
511 #
512 runsearch "./search -P -2 -f '( optional \"\" lazy dog )' $VERBOSE" \
513 'match: <UNDEF> <DEF> 0 1 11 <UNDEF> (dog lazy proximity)
514 match: <UNDEF> <DEF> 0 1 21 <UNDEF> (dog lazy proximity)
515 match: <UNDEF> <DEF> 0 5 21 <UNDEF> (dog lazy proximity)
516 match: <UNDEF> <DEF> 0 5 53 <UNDEF> (dog lazy proximity)
517 match: <UNDEF> <DEF> 0 5 56 <UNDEF> (dog lazy proximity)
518 match: <UNDEF> <DEF> 0 6 1 <UNDEF> (dog lazy )
519 match: <UNDEF> <DEF> 0 5 9 <UNDEF> (lazy )'