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

« back to all changes in this revision

Viewing changes to test/search/TestSearch.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2008-02-21 08:43:54 UTC
  • mfrom: (3.1.4 hardy)
  • Revision ID: james.westby@ubuntu.com-20080221084354-bzl2ied6qgvwwfr8
Tags: 0.9.20-3
* Lower compat/debhelper to 5.
* Re-enable static library build.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
                Hits* h = NULL;
17
17
                try{
18
18
                        q = QueryParser::parse(qry , _T("contents"), analyzer);
19
 
                        h = search->search( q );
 
19
                        if ( q != NULL ){
 
20
                            h = search->search( q );
 
21
                            
 
22
                            if ( h->length() > 0 ){
 
23
                                //check for explanation memory leaks...
 
24
                                        Explanation expl1;
 
25
                                        search->explain(q, h->id(0), &expl1);
 
26
                                        TCHAR* tmp = expl1.toString();
 
27
                                        _CLDELETE_CARRAY(tmp);
 
28
                                        if ( h->length() > 1 ){ //do a second one just in case
 
29
                                                Explanation expl2;
 
30
                                                search->explain(q, h->id(1), &expl2);
 
31
                                                tmp = expl2.toString();
 
32
                                                _CLDELETE_CARRAY(tmp);
 
33
                                        }
 
34
                                }
 
35
                        }
20
36
                }_CLFINALLY(
21
37
                _CLDELETE(h);
22
38
                _CLDELETE(q);
224
240
 
225
241
                writer.addDocument(d);
226
242
                _CLDELETE(d);
227
 
        }     
228
 
        writer.optimize();
 
243
        }
229
244
        writer.close();
230
245
 
231
246
        IndexReader* reader = IndexReader::open(&ram);