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 
2 // Copyright (c) 2009-2014 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 public:
30  IndexSearcher(const DirectoryPtr& path, bool readOnly = true);
31 
33  IndexSearcher(const IndexReaderPtr& reader);
34 
36  IndexSearcher(const IndexReaderPtr& reader, Collection<IndexReaderPtr> subReaders, Collection<int32_t> docStarts);
37 
38  virtual ~IndexSearcher();
39 
41 
42 public:
43  IndexReaderPtr reader;
44 
45 protected:
47 
50 
53 
54 public:
56  IndexReaderPtr getIndexReader();
57 
61  virtual void close();
62 
63  virtual int32_t docFreq(const TermPtr& term);
64  virtual DocumentPtr doc(int32_t n);
65  virtual DocumentPtr doc(int32_t n, const FieldSelectorPtr& fieldSelector);
66  virtual int32_t maxDoc();
67 
68  using Searcher::search;
69  using Searcher::explain;
70 
71  virtual TopDocsPtr search(const WeightPtr& weight, const FilterPtr& filter, int32_t n);
72  virtual TopFieldDocsPtr search(const WeightPtr& weight, const FilterPtr& filter, int32_t n, const SortPtr& sort);
73 
80  virtual TopFieldDocsPtr search(const WeightPtr& weight, const FilterPtr& filter, int32_t n, const SortPtr& sort, bool fillFields);
81 
82  virtual void search(const WeightPtr& weight, const FilterPtr& filter, const CollectorPtr& results);
83  virtual QueryPtr rewrite(const QueryPtr& query);
84  virtual ExplanationPtr explain(const WeightPtr& weight, int32_t doc);
85 
92  virtual void setDefaultFieldSortScoring(bool doTrackScores, bool doMaxScore);
93 
94 protected:
95  void ConstructSearcher(const IndexReaderPtr& reader, bool closeReader);
96  void gatherSubReaders(Collection<IndexReaderPtr> allSubReaders, const IndexReaderPtr& reader);
97  void searchWithFilter(const IndexReaderPtr& reader, const WeightPtr& weight, const FilterPtr& filter, const CollectorPtr& collector);
98 };
99 
100 }
101 
102 #endif

clucene.sourceforge.net