Lucene++ - a full-featured, c++ search engine
API Documentation


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
IndexSearcher.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6 
7 #ifndef INDEXSEARCHER_H
8 #define INDEXSEARCHER_H
9 
10 #include "Searcher.h"
11 
12 namespace Lucene
13 {
23  class LPPAPI IndexSearcher : public Searcher
24  {
25  public:
31  IndexSearcher(DirectoryPtr path, bool readOnly = true);
32 
35 
38 
39  virtual ~IndexSearcher();
40 
42 
43  public:
44  IndexReaderPtr reader;
45 
46  protected:
48 
51 
54 
55  public:
57  IndexReaderPtr getIndexReader();
58 
62  virtual void close();
63 
64  virtual int32_t docFreq(TermPtr term);
65  virtual DocumentPtr doc(int32_t n);
66  virtual DocumentPtr doc(int32_t n, FieldSelectorPtr fieldSelector);
67  virtual int32_t maxDoc();
68 
69  using Searcher::search;
70  using Searcher::explain;
71 
72  virtual TopDocsPtr search(WeightPtr weight, FilterPtr filter, int32_t n);
73  virtual TopFieldDocsPtr search(WeightPtr weight, FilterPtr filter, int32_t n, SortPtr sort);
74 
81  virtual TopFieldDocsPtr search(WeightPtr weight, FilterPtr filter, int32_t n, SortPtr sort, bool fillFields);
82 
83  virtual void search(WeightPtr weight, FilterPtr filter, CollectorPtr results);
84  virtual QueryPtr rewrite(QueryPtr query);
85  virtual ExplanationPtr explain(WeightPtr weight, int32_t doc);
86 
93  virtual void setDefaultFieldSortScoring(bool doTrackScores, bool doMaxScore);
94 
95  protected:
96  void ConstructSearcher(IndexReaderPtr reader, bool closeReader);
97  void gatherSubReaders(Collection<IndexReaderPtr> allSubReaders, IndexReaderPtr reader);
98  void searchWithFilter(IndexReaderPtr reader, WeightPtr weight, FilterPtr filter, CollectorPtr collector);
99  };
100 }
101 
102 #endif

clucene.sourceforge.net