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


SearchCancellation.h
Go to the documentation of this file.
1 // 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.
5 //
6 // Extended by UnionTech Software Technology Co., Ltd. (2024)
7 // Added search cancellation support for responsive user interactions
9 
10 #ifndef SEARCHCANCELLATION_H
11 #define SEARCHCANCELLATION_H
12 
13 #include "LuceneTypes.h"
14 #include <atomic>
15 
16 namespace Lucene {
17 
31 class LPPAPI SearchCancellation {
32 public:
37  static void setFlag(std::atomic<bool>* flag);
38 
43  static std::atomic<bool>* getFlag();
44 
48  static void clear();
49 
57  static bool shouldCancel();
58 };
59 
72 public:
73  explicit SearchCancellationGuard(std::atomic<bool>* flag);
75 
76  // Non-copyable and non-movable
78  SearchCancellationGuard& operator=(const SearchCancellationGuard&) = delete;
80  SearchCancellationGuard& operator=(SearchCancellationGuard&&) = delete;
81 };
82 
83 }
84 
85 #endif // SEARCHCANCELLATION_H
RAII guard for automatic cancellation flag management.
Definition: SearchCancellation.h:71
Definition: AbstractAllTermDocs.h:12
Global search cancellation context using thread-local storage.
Definition: SearchCancellation.h:31

clucene.sourceforge.net