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

« back to all changes in this revision

Viewing changes to src/CLucene/search/MultiSearcher.h

  • 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
 
#ifndef _lucene_search_multisearcher
8
 
#define _lucene_search_multisearcher
9
 
 
10
 
#if defined(_LUCENE_PRAGMA_ONCE)
11
 
# pragma once
12
 
#endif
13
 
 
14
 
#include "SearchHeader.h"
15
 
#include "CLucene/document/Document.h"
16
 
#include "CLucene/index/Term.h"
17
 
 
18
 
CL_NS_DEF(search)
19
 
    
20
 
    class MultiHitCollector: public HitCollector{
21
 
    private:
22
 
      HitCollector* results;
23
 
      int32_t start;
24
 
    public: 
25
 
      MultiHitCollector(HitCollector* _results, int32_t _start);
26
 
      void collect(const int32_t doc, const float_t score) ;
27
 
    };
28
 
    
29
 
    
30
 
 /** Implements search over a set of <code>Searchables</code>.
31
 
        *
32
 
        * <p>Applications usually need only call the inherited {@link #search(Query)}
33
 
        * or {@link #search(Query,Filter)} methods.
34
 
        */
35
 
        class MultiSearcher: public Searcher {
36
 
  private:
37
 
    Searchable** searchables;
38
 
                int32_t searchablesLen;
39
 
    int32_t* starts;
40
 
    int32_t _maxDoc;
41
 
        protected:
42
 
                int32_t* getStarts() {
43
 
                        return starts;
44
 
                }
45
 
 
46
 
  public:
47
 
      /** Creates a searcher which searches <i>Searchables</i>. */
48
 
      MultiSearcher(Searchable** searchables);
49
 
      
50
 
      ~MultiSearcher();
51
 
 
52
 
      /** Frees resources associated with this <code>Searcher</code>. */
53
 
      void close() ;
54
 
 
55
 
          int32_t docFreq(const CL_NS(index)::Term* term) const ;
56
 
 
57
 
      /** For use by {@link HitCollector} implementations. */
58
 
          bool doc(int32_t n, CL_NS(document)::Document* document);
59
 
 
60
 
      /** For use by {@link HitCollector} implementations to identify the
61
 
       * index of the sub-searcher that a particular hit came from. */
62
 
      int32_t searcherIndex(int32_t n) const;
63
 
 
64
 
          int32_t subSearcher(int32_t n) const;
65
 
 
66
 
          int32_t subDoc(int32_t n) const;
67
 
 
68
 
      int32_t maxDoc() const;
69
 
    
70
 
      TopDocs* _search(Query* query, Filter* filter, const int32_t nDocs) ;
71
 
      
72
 
      TopFieldDocs* _search (Query* query, Filter* filter, const int32_t n, const Sort* sort);
73
 
     
74
 
      /** Lower-level search API.
75
 
       *
76
 
       * <p>{@link HitCollector#collect(int32_t,float_t)} is called for every non-zero
77
 
       * scoring document.
78
 
       *
79
 
       * <p>Applications should only use this if they need <i>all</i> of the
80
 
       * matching documents.  The high-level search API ({@link
81
 
       * Searcher#search(Query)}) is usually more efficient, as it skips
82
 
       * non-high-scoring hits.
83
 
       *
84
 
       * @param query to match documents
85
 
       * @param filter if non-null, a bitset used to eliminate some documents
86
 
       * @param results to receive hits
87
 
       */
88
 
        void _search(Query* query, Filter* filter, HitCollector* results);
89
 
 
90
 
                Query* rewrite(Query* original);
91
 
                void explain(Query* query, int32_t doc, Explanation* ret);
92
 
    };
93
 
 
94
 
CL_NS_END
95
 
#endif