Foxit PDF SDK
fs_fulltextsearch.h
浏览该文件的文档.
1 
15 #ifndef FS_FULLTEXTSEARCH_H_
16 #define FS_FULLTEXTSEARCH_H_
17 
18 #include "common/fs_common.h"
19 
25 namespace foxit {
29 namespace fts {
38  public:
44  virtual void Release() = 0;
59  virtual int RetrieveSearchResult(const wchar_t* file_path, int page_index, const WString& match_result,
60  int match_start_text_index, int match_end_text_index, const WString& sentence,
61  int match_sentence_start_text_index, int match_sentence_end_text_index) = 0;
62 
68  virtual bool NeedToCancel() = 0;
69 
70  protected:
71  ~SearchCallback() {}
72 };
73 
78 class DocumentsSource FS_FINAL : public Base{
79  public:
85  explicit DocumentsSource(const char* directory);
93  DocumentsSource(const DocumentsSource& other);
102 
110  bool operator == (const DocumentsSource& other) const;
118  bool operator != (const DocumentsSource& other) const;
119 
127  bool IsEmpty() const;
128 
129  // 强烈建议用户不要使用此方法;否则可能出现未知情况。
130  explicit DocumentsSource(FS_HANDLE handle = NULL);
131 
132 };
133 
137 class FullTextSearch FS_FINAL : public Base{
138  public:
144  typedef enum _RankMode {
157  } RankMode;
158 
159 
161  FullTextSearch();
163  ~FullTextSearch();
169  FullTextSearch(const FullTextSearch& other);
178 
186  bool operator == (const FullTextSearch& other) const;
194  bool operator != (const FullTextSearch& other) const;
202  bool IsEmpty() const;
203 
218  void SetDataBasePath(const char* path_of_data_base);
219 
240  bool reupdate = false);
241 
251  bool UpdateIndexWithFilePath(const char* file_path);
252 
269  bool SearchOf(const char* match_string, RankMode rank_mode, SearchCallback* callback);
270 
281  void SetIgnoreSpace(bool ignore_space);
282 
283  // 强烈建议用户不要使用此方法;否则可能出现未知情况。
284  explicit FullTextSearch(FS_HANDLE handle);
285 };
286 } // namespace fts
287 }; // namespace foxit
288 
289 #endif // FS_FULLTEXTSEARCH_H_
290 
virtual void Release()=0
用于释放当前回调对象本身的回调函数。
DocumentsSource(const char *directory)
用目录构造函数。
Definition: fs_fulltextsearch.h:78
搜索结果不使用排序模式。
Definition: fs_fulltextsearch.h:146
Definition: fs_fulltextsearch.h:37
bool IsEmpty() const
检查当前对象是否为空。
bool UpdateIndexWithFilePath(const char *file_path)
更新指定PDF文件的索引结果。
宽字符串类
Definition: fx_string.h:1457
根据结果与预期搜索模式的匹配程度对搜索结果进行排序, 按降序排列(从相同或最相似到相似度较低)。
Definition: fs_fulltextsearch.h:156
void SetIgnoreSpace(bool ignore_space)
设置匹配搜索结果时是否忽略字符之间的空白。
FullTextSearch & operator=(const FullTextSearch &other)
赋值操作符。
Definition: fs_fulltextsearch.h:137
void SetDataBasePath(const char *path_of_data_base)
设置文件路径作为用于存储索引数据的sqlite数据库。
DocumentsSource & operator=(const DocumentsSource &other)
赋值操作符。
~FullTextSearch()
析构函数。
RankMode
全文搜索的排序模式枚举。
Definition: fs_fulltextsearch.h:144
Definition: fx_basic.h:3737
Definition: fs_common.h:377
void * FS_HANDLE
句柄类型。
Definition: fs_basictypes.h:213
通用定义和类的头文件。
~DocumentsSource()
析构函数。
bool operator !=(const FullTextSearch &other) const
不相等操作符。
Definition: fs_basictypes.h:471
bool SearchOf(const char *match_string, RankMode rank_mode, SearchCallback *callback)
在已索引的PDF文件中搜索指定的文本。
bool operator==(const DocumentsSource &other) const
相等操作符。
common::Progressive StartUpdateIndex(const DocumentsSource &source, common::PauseCallback *pause=0, bool reupdate=false)
开始更新文档源对象中定义的PDF文件的索引。
Foxit 命名空间。
Definition: fs_accessibility.h:28
bool operator !=(const DocumentsSource &other) const
不相等操作符。
bool IsEmpty() const
检查当前对象是否为空。
#define NULL
空指针值。
Definition: fx_system.h:792
FullTextSearch()
构造函数。
virtual bool NeedToCancel()=0
用于检查是否需要取消搜索的回调函数。
根据结果与预期搜索模式的匹配程度对搜索结果进行排序, 按升序排列(从相似度较低到最相似或相同)。
Definition: fs_fulltextsearch.h:151
bool operator==(const FullTextSearch &other) const
相等操作符。
virtual int RetrieveSearchResult(const wchar_t *file_path, int page_index, const WString &match_result, int match_start_text_index, int match_end_text_index, const WString &sentence, int match_sentence_start_text_index, int match_sentence_end_text_index)=0
用于检索搜索结果的回调函数。