1 #ifndef _ExactWordQuery_h_ 2 #define _ExactWordQuery_h_ 3 4 // 5 // ExactWordQuery.h 6 // 7 // ExactWordQuery: A Query tree leaf object. Wraps a database access 8 // that generates ResultLists for word matches. 9 // 10 // Part of the ht://Dig package <http://www.htdig.org/> 11 // Copyright (c) 1995-2004 The ht://Dig Group 12 // For copyright details, see the file COPYING in your distribution 13 // or the GNU Library General Public License (LGPL) version 2 or later 14 // <http://www.gnu.org/copyleft/lgpl.html> 15 // 16 // $Id: ExactWordQuery.h,v 1.4 2004/05/28 13:15:24 lha Exp $ 17 // 18 19 #ifdef HAVE_CONFIG_H 20 #include "htconfig.h" 21 #endif 22 23 #include "Query.h" 24 25 class WordSearcher; 26 27 class ExactWordQuery : public Query 28 { 29 public: 30 // construct for word w ExactWordQuery(const String & w)31 ExactWordQuery(const String &w) : 32 word(w), weight(1.0) {} 33 34 // destruct ~ExactWordQuery()35 ~ExactWordQuery() {} 36 37 // set the common db wrapper SetSearcher(WordSearcher * c)38 static void SetSearcher(WordSearcher *c) { searcher = c; } 39 40 // weight accessor SetWeight(double x)41 void SetWeight(double x) { weight = x; } GetWeight()42 double GetWeight() const { return weight; } 43 44 private: 45 // forbidden ExactWordQuery()46 ExactWordQuery() {} 47 48 // go search the db 49 ResultList *Evaluate(); 50 51 // set my weight to the list 52 void AdjustWeight(ResultList &); 53 54 // unparse GetLogicalWords()55 String GetLogicalWords() const { return word; } 56 57 // unique cache index GetSignature()58 String GetSignature() const 59 { return String("Exact:")+GetLogicalWords(); } 60 61 // i represent this 62 String word; 63 64 // my weight 65 double weight; 66 67 // db wrapper common to all word queries 68 static WordSearcher *searcher; 69 }; 70 71 #endif 72