00001 #ifndef LUX_INDEX_SEARCHINDEX_H 00002 #define LUX_INDEX_SEARCHINDEX_H 00003 00004 #include "lux/lux.h" 00005 #include "index_result.h" 00006 00007 namespace Lux { 00008 00009 class Document; 00010 class Query; 00011 class TermQuery; 00012 class PhraseQuery; 00013 class BooleanQuery; 00014 00015 class SearchIndex { 00016 00017 public: 00018 virtual ~SearchIndex() {}; 00019 virtual bool open(std::string storage_dir, db_flags_t open_params) = 0; 00020 virtual bool close(void) = 0; 00021 virtual bool add(const Document *doc) = 0; 00022 virtual bool add(const Document &doc) = 0; 00023 virtual void flush(void) = 0; 00024 virtual uint32_t get_buffer_size(void) = 0; 00025 virtual void print_buffer(void) {}; 00026 virtual void set_sys_cond(sys_cond_t sys_cond) = 0; 00027 virtual IndexResultSet search(Query *query) = 0; 00028 virtual IndexResultSet search_term(TermQuery *qterm) = 0; 00029 virtual IndexResultSet search_phrase(PhraseQuery *qphrase) = 0; 00030 virtual IndexResultSet search_boolean(BooleanQuery *bquery) = 0; 00031 }; 00032 } 00033 00034 #endif