~ubuntu-branches/ubuntu/raring/clucene-core/raring-proposed

« back to all changes in this revision

Viewing changes to src/test/search/TestSearch.cpp

  • Committer: Package Import Robot
  • Author(s): Fathi Boudra
  • Date: 2012-08-11 09:33:38 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120811093338-fgrx41ftqew3qt6a
Tags: 2.3.3.4-1
* New upstream release (Closes: #661703).
* Convert package to multiarch.
* Drop obsolete patches:
  - 01_add_missing_include_bug505667.diff
  - 02_posixness_fix_bug530308.diff
* Add patches:
  - Fixing_ZLIB_configuration_in_shared_CMakeLists.patch
  - Fix-pkgconfig-file-by-adding-clucene-shared-library.patch
  - Install-contribs-lib.patch
  - multiarch.patch
* Update debian/compat: bump to 8.
* Update debian/control:
  - update build dependencies (add cmake, libboost-dev and libz-dev).
  - bump Standards-Version to 3.9.3.
  - rename packages due to ABI bump: libclucene0ldbl -> libclucene-core1.
  - add libclucene-contribs1 package.
* Update debian/rules:
  - rewrite to use CMake.
  - add multiarch support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*------------------------------------------------------------------------------
 
2
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
 
3
*
 
4
* Distributable under the terms of either the Apache License (Version 2.0) or
 
5
* the GNU Lesser General Public License, as specified in the COPYING file.
 
6
------------------------------------------------------------------------------*/
 
7
#include <assert.h>
 
8
#include "test.h"
 
9
#include <stdio.h>
 
10
 
 
11
#include "CLucene/search/MultiPhraseQuery.h"
 
12
 
 
13
        SimpleAnalyzer a;
 
14
        StandardAnalyzer aStd;
 
15
        WhitespaceAnalyzer aWS;
 
16
        IndexSearcher* s=NULL;
 
17
 
 
18
        void _TestSearchesRun(CuTest *tc, Analyzer* analyzer, Searcher* search, const TCHAR* qry){
 
19
                Query* q = NULL;
 
20
                Hits* h = NULL;
 
21
                try{
 
22
                        q = QueryParser::parse(qry , _T("contents"), analyzer);
 
23
                        if ( q != NULL ){
 
24
                            h = search->search( q );
 
25
 
 
26
                            if ( h->length() > 0 ){
 
27
                            //check for explanation memory leaks...
 
28
          CL_NS(search)::Explanation expl1;
 
29
                                        search->explain(q, h->id(0), &expl1);
 
30
                                        TCHAR* tmp = expl1.toString();
 
31
                                        _CLDELETE_CARRAY(tmp);
 
32
                                        if ( h->length() > 1 ){ //do a second one just in case
 
33
                                                CL_NS(search)::Explanation expl2;
 
34
                                                search->explain(q, h->id(1), &expl2);
 
35
                                                tmp = expl2.toString();
 
36
                                                _CLDELETE_CARRAY(tmp);
 
37
                                        }
 
38
                                }
 
39
                        }
 
40
    }catch(CLuceneError& err){
 
41
      CuFail(tc,_T("Error: %s\n"), err.twhat());
 
42
    }catch(...){
 
43
      CuFail(tc,_T("Error: unknown\n"));
 
44
    }
 
45
                _CLDELETE(h);
 
46
                _CLDELETE(q);
 
47
        }
 
48
 
 
49
        void testSrchOpenIndex(CuTest *tc ){
 
50
                char loc[1024];
 
51
                strcpy(loc, clucene_data_location);
 
52
                strcat(loc, "/reuters-21578-index");
 
53
 
 
54
                CuAssert(tc,_T("Index does not exist"), Misc::dir_Exists(loc));
 
55
                s=_CLNEW IndexSearcher(loc);
 
56
  }
 
57
        void testSrchCloseIndex(CuTest* /*tc*/ ){
 
58
                if ( s!=NULL ){
 
59
                        s->close();
 
60
                        _CLDELETE(s);
 
61
                }
 
62
  }
 
63
 
 
64
        void testSrchPunctuation(CuTest *tc ){
 
65
                CuAssert(tc,_T("Searcher was not open"),s!=NULL);
 
66
 
 
67
                //test punctuation
 
68
                _TestSearchesRun(tc, &a,s, _T("a&b") );
 
69
                _TestSearchesRun(tc, &a,s, _T("a&&b") );
 
70
                _TestSearchesRun(tc, &a,s, _T(".NET") );
 
71
        }
 
72
 
 
73
        void testSrchSlop(CuTest *tc ){
 
74
#ifdef NO_FUZZY_QUERY
 
75
                CuNotImpl(tc,_T("Fuzzy"));
 
76
#else
 
77
                CuAssert(tc,_T("Searcher was not open"),s!=NULL);
 
78
                //test slop
 
79
                _TestSearchesRun(tc, &a,s, _T("\"term germ\"~2") );
 
80
                _TestSearchesRun(tc, &a,s, _T("\"term germ\"~2 flork") );
 
81
                _TestSearchesRun(tc, &a,s, _T("\"term\"~2") );
 
82
                _TestSearchesRun(tc, &a,s, _T("\" \"~2 germ") );
 
83
                _TestSearchesRun(tc, &a,s, _T("\"term germ\"~2^2") );
 
84
#endif
 
85
        }
 
86
 
 
87
        void testSrchNumbers(CuTest *tc ){
 
88
                CuAssert(tc,_T("Searcher was not open"),s!=NULL);
 
89
 
 
90
                // The numbers go away because SimpleAnalzyer ignores them
 
91
                _TestSearchesRun(tc, &a,s, _T("3") );
 
92
                _TestSearchesRun(tc, &a,s, _T("term 1.0 1 2") );
 
93
                _TestSearchesRun(tc, &a,s, _T("term term1 term2") );
 
94
 
 
95
                _TestSearchesRun(tc, &aStd,s, _T("3") );
 
96
                _TestSearchesRun(tc, &aStd,s, _T("term 1.0 1 2") );
 
97
                _TestSearchesRun(tc, &aStd,s, _T("term term1 term2") );
 
98
        }
 
99
 
 
100
        void testSrchWildcard(CuTest *tc ){
 
101
#ifdef NO_WILDCARD_QUERY
 
102
                CuNotImpl(tc,_T("Wildcard"));
 
103
#else
 
104
                CuAssert(tc,_T("Searcher was not open"),s!=NULL);
 
105
                //testWildcard
 
106
                _TestSearchesRun(tc, &a,s, _T("term*") );
 
107
                _TestSearchesRun(tc, &a,s, _T("term*^2") );
 
108
                _TestSearchesRun(tc, &a,s, _T("term~") );
 
109
                _TestSearchesRun(tc, &a,s, _T("term^2~") );
 
110
                _TestSearchesRun(tc, &a,s, _T("term~^2") );
 
111
                _TestSearchesRun(tc, &a,s, _T("term*germ") );
 
112
                _TestSearchesRun(tc, &a,s, _T("term*germ^3") );
 
113
 
 
114
                //test problem reported by Gary Mangum
 
115
                BooleanQuery* bq = _CLNEW BooleanQuery();
 
116
                Term* upper = _CLNEW Term(_T("contents"),_T("0105"));
 
117
                Term* lower = _CLNEW Term(_T("contents"),_T("0105"));
 
118
                RangeQuery* rq=_CLNEW RangeQuery(lower,upper,true);
 
119
                bq->add(rq,true,true,false);
 
120
                _CLDECDELETE(upper);
 
121
                _CLDECDELETE(lower);
 
122
 
 
123
                Term* prefix = _CLNEW Term(_T("contents"),_T("reuters21578"));
 
124
                PrefixQuery* pq = _CLNEW PrefixQuery(prefix);
 
125
                _CLDECDELETE(prefix);
 
126
                bq->add(pq,true,true,false);
 
127
 
 
128
                Hits* h = NULL;
 
129
                try{
 
130
                        h = s->search( bq );
 
131
                }_CLFINALLY(
 
132
                _CLDELETE(h);
 
133
                _CLDELETE(bq);
 
134
                );
 
135
#endif
 
136
        }
 
137
 
 
138
        void testSrchEscapes(CuTest *tc ){
 
139
                CuAssert(tc,_T("Searcher was not open"),s!=NULL);
 
140
                //testEscaped
 
141
                _TestSearchesRun(tc, &aWS,s, _T("\\[brackets") );
 
142
                _TestSearchesRun(tc, &a,s, _T("\\[brackets") );
 
143
                _TestSearchesRun(tc, &aWS,s, _T("\\\\") );
 
144
                _TestSearchesRun(tc, &aWS,s, _T("\\+blah") );
 
145
                _TestSearchesRun(tc, &aWS,s, _T("\\(blah") );
 
146
        }
 
147
 
 
148
        void testSrchRange(CuTest *tc ){
 
149
#ifdef NO_RANGE_QUERY
 
150
                CuNotImpl(tc,_T("Range"));
 
151
#else
 
152
                CuAssert(tc,_T("Searcher was not open"),s!=NULL);
 
153
                //testRange
 
154
                _TestSearchesRun(tc, &a,s, _T("[ j m]") );
 
155
                _TestSearchesRun(tc, &a,s, _T("[ j m ]") );
 
156
                _TestSearchesRun(tc, &a,s, _T("{ j m}") );
 
157
                _TestSearchesRun(tc, &a,s, _T("{ j m }") );
 
158
                _TestSearchesRun(tc, &a,s, _T("{a TO b}") );
 
159
                _TestSearchesRun(tc, &a,s, _T("{ j m }^2.0") );
 
160
                _TestSearchesRun(tc, &a,s, _T("[ j m] OR bar") );
 
161
                _TestSearchesRun(tc, &a,s, _T("[ j m] AND bar") );
 
162
                _TestSearchesRun(tc, &a,s, _T("( bar blar { j m}) ") );
 
163
                _TestSearchesRun(tc, &a,s, _T("gack ( bar blar { j m}) ") );
 
164
#endif
 
165
        }
 
166
 
 
167
        void testSrchSimple(CuTest *tc ){
 
168
                CuAssert(tc,_T("Searcher was not open"),s!=NULL);
 
169
        //simple tests
 
170
                _TestSearchesRun(tc, &a,s, _T("a AND b") );
 
171
 
 
172
                _TestSearchesRun(tc, &a,s, _T("term term term") );
 
173
 
 
174
#ifdef _UCS2
 
175
                TCHAR tmp1[100];
 
176
                lucene_utf8towcs(tmp1,"t\xc3\xbcrm term term",100);
 
177
                _TestSearchesRun(tc, &a,s, tmp1 );
 
178
 
 
179
                lucene_utf8towcs(tmp1,"\xc3\xbcmlaut",100);
 
180
                _TestSearchesRun(tc, &a,s, tmp1 );
 
181
#endif
 
182
 
 
183
                _TestSearchesRun(tc, &a,s, _T("(a AND b)") );
 
184
                _TestSearchesRun(tc, &a,s, _T("c OR (a AND b)") );
 
185
                _TestSearchesRun(tc, &a,s, _T("a AND NOT b") );
 
186
                _TestSearchesRun(tc, &a,s, _T("a AND -b") );
 
187
                _TestSearchesRun(tc, &a,s, _T("a AND !b") );
 
188
                _TestSearchesRun(tc, &a,s, _T("a && b") );
 
189
                _TestSearchesRun(tc, &a,s, _T("a && ! b") );
 
190
 
 
191
                _TestSearchesRun(tc, &a,s, _T("a OR b") );
 
192
                _TestSearchesRun(tc, &a,s, _T("a || b") );
 
193
                _TestSearchesRun(tc, &a,s, _T("a OR !b") );
 
194
                _TestSearchesRun(tc, &a,s, _T("a OR ! b") );
 
195
                _TestSearchesRun(tc, &a,s, _T("a OR -b") );
 
196
 
 
197
                _TestSearchesRun(tc, &a,s, _T("+term -term term") );
 
198
                _TestSearchesRun(tc, &a,s, _T("foo:term AND field:anotherTerm") );
 
199
                _TestSearchesRun(tc, &a,s, _T("term AND \"phrase phrase\"") );
 
200
                _TestSearchesRun(tc, &a,s, _T("search AND \"meaningful direction\"") );
 
201
                _TestSearchesRun(tc, &a,s, _T("\"hello there\"") );
 
202
 
 
203
                _TestSearchesRun(tc, &a,s,  _T("a AND b") );
 
204
                _TestSearchesRun(tc, &a,s,  _T("hello") );
 
205
                _TestSearchesRun(tc, &a,s,  _T("\"hello there\"") );
 
206
 
 
207
                _TestSearchesRun(tc, &a,s, _T("germ term^2.0") );
 
208
                _TestSearchesRun(tc, &a,s, _T("term^2.0") );
 
209
                _TestSearchesRun(tc, &a,s, _T("term^2") );
 
210
                _TestSearchesRun(tc, &a,s, _T("term^2.3") );
 
211
                _TestSearchesRun(tc, &a,s, _T("\"germ term\"^2.0") );
 
212
                _TestSearchesRun(tc, &a,s, _T("\"term germ\"^2") );
 
213
 
 
214
                _TestSearchesRun(tc, &a,s, _T("(foo OR bar) AND (baz OR boo)") );
 
215
                _TestSearchesRun(tc, &a,s, _T("((a OR b) AND NOT c) OR d") );
 
216
                _TestSearchesRun(tc, &a,s, _T("+(apple \"steve jobs\") -(foo bar baz)") );
 
217
 
 
218
                _TestSearchesRun(tc, &a,s, _T("+title:(dog OR cat) -author:\"bob dole\"") );
 
219
 
 
220
 
 
221
                _TestSearchesRun(tc, &a,s, _T(".*") );
 
222
                _TestSearchesRun(tc, &a,s, _T("<*") );
 
223
                _TestSearchesRun(tc, &a,s, _T("/*") );
 
224
                _TestSearchesRun(tc, &a,s, _T(";*") );
 
225
        }
 
226
 
 
227
void SearchTest(CuTest *tc, bool bram) {
 
228
        uint64_t start = Misc::currentTimeMillis();
 
229
 
 
230
        SimpleAnalyzer analyzer;
 
231
 
 
232
        char fsdir[CL_MAX_PATH];
 
233
        _snprintf(fsdir,CL_MAX_PATH,"%s/%s",cl_tempDir, "test.search");
 
234
        Directory* ram = (bram?(Directory*)_CLNEW RAMDirectory():(Directory*)FSDirectory::getDirectory(fsdir) );
 
235
 
 
236
        IndexWriter writer( ram, &analyzer, true);
 
237
        writer.setUseCompoundFile(false);
 
238
  writer.setMaxBufferedDocs(3);
 
239
 
 
240
        const TCHAR* docs[] = { _T("a b c d e asdf"),
 
241
                _T("a b c d e a b c d e asdg"),
 
242
                _T("a b c d e f g h i j"),
 
243
                _T("a c e"),
 
244
                _T("e c a"),
 
245
                _T("a c e a c e asef"),
 
246
                _T("a c e a b c")
 
247
        };
 
248
 
 
249
        for (int j = 0; j < 7; j++) {
 
250
                Document* d = _CLNEW Document();
 
251
                //no need to delete fields... document takes ownership
 
252
                d->add(*_CLNEW Field(_T("contents"),docs[j],Field::STORE_YES | Field::INDEX_TOKENIZED));
 
253
 
 
254
                writer.addDocument(d);
 
255
                _CLDELETE(d);
 
256
        }
 
257
        writer.close();
 
258
 
 
259
        if (!bram){
 
260
                ram->close();
 
261
                _CLDECDELETE(ram);
 
262
                ram = (Directory*)FSDirectory::getDirectory(fsdir);
 
263
        }
 
264
 
 
265
        IndexReader* reader = IndexReader::open(ram);
 
266
        IndexSearcher searcher(reader);
 
267
 
 
268
        const TCHAR* queries[] = {
 
269
    _T("a AND NOT b"),
 
270
    _T("+a -b"),
 
271
                _T("\"a b\""),
 
272
                _T("\"a b c\""),
 
273
                _T("a AND b"),
 
274
                _T("a c"),
 
275
                _T("\"a c\""),
 
276
                _T("\"a c e\"")
 
277
        };
 
278
        int shouldbe[] = {3,3,4,4,4,7,3,3};
 
279
        Hits* hits = NULL;
 
280
        QueryParser parser(_T("contents"), &analyzer);
 
281
 
 
282
        for (int k = 0; k < 8; k++) {
 
283
                Query* query = parser.parse(queries[k]);
 
284
 
 
285
                TCHAR* qryInfo = query->toString(_T("contents"));
 
286
                hits = searcher.search(query);
 
287
                CLUCENE_ASSERT( hits->length() == shouldbe[k] );
 
288
                _CLDELETE_CARRAY(qryInfo);
 
289
                _CLDELETE(hits);
 
290
                _CLDELETE(query);
 
291
        }
 
292
 
 
293
  //test MultiPositionQuery...
 
294
  {
 
295
    MultiPhraseQuery* query = _CLNEW MultiPhraseQuery();
 
296
    RefCountArray<Term*> terms(3);
 
297
    Term* termE = _CLNEW Term(_T("contents"), _T("e"));
 
298
    terms[0] = _CLNEW Term(_T("contents"), _T("asdf"));
 
299
    terms[1] = _CLNEW Term(_T("contents"), _T("asdg"));
 
300
    terms[2] = _CLNEW Term(_T("contents"), _T("asef"));
 
301
 
 
302
    query->add(termE);
 
303
                _CLDECDELETE(termE);
 
304
    
 
305
    query->add(&terms);
 
306
    terms.deleteValues();
 
307
 
 
308
                TCHAR* qryInfo = query->toString(_T("contents"));
 
309
                hits = searcher.search(query);
 
310
                CLUCENE_ASSERT( hits->length() == 3 );
 
311
                _CLDELETE_CARRAY(qryInfo);
 
312
                _CLDELETE(hits);
 
313
                _CLDELETE(query);
 
314
  }
 
315
  
 
316
        searcher.close();
 
317
    reader->close();
 
318
        _CLDELETE( reader );
 
319
 
 
320
        ram->close();
 
321
        _CLDECDELETE(ram);
 
322
 
 
323
        CuMessageA (tc,"took %d milliseconds\n", (int32_t)(Misc::currentTimeMillis()-start));
 
324
}
 
325
 
 
326
void testNormEncoding(CuTest *tc) {
 
327
        //just a quick test of the default similarity
 
328
        CLUCENE_ASSERT(CL_NS(search)::Similarity::getDefault()->queryNorm(1)==1.0);
 
329
 
 
330
    float_t f = CL_NS(search)::Similarity::getDefault()->queryNorm(9);
 
331
    f -= (1.0/3.0);
 
332
    if ( f < 0 )
 
333
        f *= -1;
 
334
        CLUCENE_ASSERT(f < 0.1);
 
335
 
 
336
    //test that div by zero is handled
 
337
    float_t tmp = CL_NS(search)::Similarity::getDefault()->lengthNorm(_T("test"),0);
 
338
    tmp = CL_NS(search)::Similarity::getDefault()->queryNorm(0);
 
339
 
 
340
        //test that norm encoding is working properly
 
341
        CLUCENE_ASSERT( CL_NS(search)::Similarity::encodeNorm(-1)==0 );
 
342
        CLUCENE_ASSERT( CL_NS(search)::Similarity::encodeNorm(0)==0 );
 
343
        CLUCENE_ASSERT( CL_NS(search)::Similarity::encodeNorm(1)==124 );
 
344
        CLUCENE_ASSERT( CL_NS(search)::Similarity::encodeNorm(1)==124 );
 
345
        CLUCENE_ASSERT( CL_NS(search)::Similarity::encodeNorm(7516192768.0 )==255);
 
346
 
 
347
 
 
348
        CLUCENE_ASSERT( CL_NS(search)::Similarity::decodeNorm(124)==1 );
 
349
        CLUCENE_ASSERT( CL_NS(search)::Similarity::decodeNorm(255)==7516192768.0 );
 
350
 
 
351
    //well know value:
 
352
    CLUCENE_ASSERT( CL_NS(search)::Similarity::encodeNorm(0.5f) == 120 );
 
353
 
 
354
    //can decode self
 
355
    CLUCENE_ASSERT( CL_NS(search)::Similarity::encodeNorm(CL_NS(search)::Similarity::decodeNorm(57)) == 57 );
 
356
}
 
357
 
 
358
void testSrchManyHits(CuTest* /*tc*/) {
 
359
  SimpleAnalyzer analyzer;
 
360
        RAMDirectory ram;
 
361
        IndexWriter writer( &ram, &analyzer, true);
 
362
 
 
363
        const TCHAR* docs[] = { _T("a b c d e"),
 
364
                _T("a b c d e a b c d e"),
 
365
                _T("a b c d e f g h i j"),
 
366
                _T("a c e"),
 
367
                _T("e c a"),
 
368
                _T("a c e a c e"),
 
369
                _T("a c e a b c")
 
370
        };
 
371
 
 
372
        for (int j = 0; j < 140; j++) {
 
373
                Document* d = _CLNEW Document();
 
374
                //no need to delete fields... document takes ownership
 
375
                int x = j%7;
 
376
                d->add(*_CLNEW Field(_T("contents"),docs[x],Field::STORE_YES | Field::INDEX_TOKENIZED));
 
377
 
 
378
                writer.addDocument(d);
 
379
                _CLDELETE(d);
 
380
        }
 
381
        writer.close();
 
382
 
 
383
        IndexSearcher searcher(&ram);
 
384
 
 
385
        BooleanQuery query;
 
386
        Term* t = _CLNEW Term(_T("contents"), _T("a"));
 
387
        query.add(_CLNEW TermQuery(t),true,false, false);
 
388
        _CLDECDELETE(t);
 
389
        Hits* hits = searcher.search(&query);
 
390
        for ( size_t x=0;x<hits->length();x++ ){
 
391
              hits->doc(x);
 
392
        }
 
393
        _CLDELETE(hits);
 
394
        searcher.close();
 
395
}
 
396
 
 
397
void testSrchMulti(CuTest *tc) {
 
398
  SimpleAnalyzer analyzer;
 
399
        RAMDirectory ram0;
 
400
        IndexWriter writer0( &ram0, &analyzer, true);
 
401
 
 
402
        const TCHAR* docs0[] = {
 
403
                _T("a")
 
404
        };
 
405
 
 
406
        Document* d = _CLNEW Document();
 
407
        //no need to delete fields... document takes ownership
 
408
        d->add(*_CLNEW Field(_T("contents"),docs0[0],Field::STORE_YES | Field::INDEX_TOKENIZED));
 
409
 
 
410
        writer0.addDocument(d);
 
411
        _CLDELETE(d);
 
412
        writer0.close();
 
413
 
 
414
        RAMDirectory ram1;
 
415
        IndexWriter writer1( &ram1, &analyzer, true);
 
416
 
 
417
        const TCHAR* docs1[] = {
 
418
                _T("e")
 
419
        };
 
420
 
 
421
        d = _CLNEW Document();
 
422
        //no need to delete fields... document takes ownership
 
423
        d->add(*_CLNEW Field(_T("contents"),docs1[0],Field::STORE_YES | Field::INDEX_TOKENIZED));
 
424
 
 
425
        writer1.addDocument(d);
 
426
        _CLDELETE(d);
 
427
        writer1.close();
 
428
 
 
429
        IndexSearcher searcher0(&ram0);
 
430
        IndexSearcher searcher1(&ram1);
 
431
 
 
432
        Searchable* searchers[3];
 
433
 
 
434
        searchers[0] = &searcher0;
 
435
        searchers[1] = &searcher1;
 
436
        searchers[2] = NULL;
 
437
 
 
438
        MultiSearcher searcher(searchers);
 
439
 
 
440
  Term* termA = _CLNEW Term(_T("contents"), _T("a"));
 
441
  Term* termC = _CLNEW Term(_T("contents"), _T("c"));
 
442
        RangeQuery query(termA, termC, true);
 
443
  _CLDECDELETE(termA);
 
444
  _CLDECDELETE(termC);
 
445
 
 
446
        Query* rewritten = searcher.rewrite(&query);
 
447
        Hits* hits = searcher.search(rewritten);
 
448
        for ( size_t x=0;x<hits->length();x++ ){
 
449
          hits->doc(x);
 
450
        }
 
451
  CLUCENE_ASSERT(hits->length() == 1);
 
452
        if (&query != rewritten) {
 
453
                _CLDELETE(rewritten);
 
454
        }
 
455
        _CLDELETE(hits);
 
456
        searcher.close();
 
457
}
 
458
 
 
459
void ramSearchTest(CuTest *tc) { SearchTest(tc, true); }
 
460
void fsSearchTest(CuTest *tc) { SearchTest(tc, false); }
 
461
 
 
462
CuSuite *testsearch(void)
 
463
{
 
464
        CuSuite *suite = CuSuiteNew(_T("CLucene Search Test"));
 
465
  SUITE_ADD_TEST(suite, ramSearchTest);
 
466
        SUITE_ADD_TEST(suite, fsSearchTest);
 
467
 
 
468
        SUITE_ADD_TEST(suite, testNormEncoding);
 
469
        SUITE_ADD_TEST(suite, testSrchManyHits);
 
470
        SUITE_ADD_TEST(suite, testSrchMulti);
 
471
        SUITE_ADD_TEST(suite, testSrchOpenIndex);
 
472
        SUITE_ADD_TEST(suite, testSrchPunctuation);
 
473
        SUITE_ADD_TEST(suite, testSrchSlop);
 
474
        SUITE_ADD_TEST(suite, testSrchNumbers);
 
475
        SUITE_ADD_TEST(suite, testSrchWildcard);
 
476
        SUITE_ADD_TEST(suite, testSrchEscapes);
 
477
        SUITE_ADD_TEST(suite, testSrchRange);
 
478
        SUITE_ADD_TEST(suite, testSrchSimple);
 
479
        SUITE_ADD_TEST(suite, testSrchCloseIndex);
 
480
 
 
481
    return suite;
 
482
}
 
483
// EOF