Xpace
search.h
Go to the documentation of this file.
1 
2 /**************************************************************
3  **
4  ** @file index/search.h
5  **
6  ** Copyright (C) 2012 Xpace, LLC. All rights reserved
7  **
8  ** www.xpace.net
9  **
10  **************************************************************/
11 
12 #ifndef XPACE_SEARCH_H
13 #define XPACE_SEARCH_H
14 
15 #include "index/index.h"
16 #include "index/eval.h"
17 #include "index/indexlist.h"
18 #include "index/reflist/reflist.h"
19 
20 #include "data/store/table.h"
21 #include "data/store/store.h"
22 
23 namespace Xpace
24 {
25  #ifdef QDOM_H
26  XPACE_EXPORT void showQueryTree
27  (QDomNode node,
28  uint depth = 0);
29  #endif
30 
31  // ================================ SEARCH TABLE ============
32 
33  /// Search an Index, get results from a Table to a Table
34  /// @param index the Index
35  /// @param table the Table from which to get results
36  /// @param query the query
37  /// @return the table containing results
39  (const Index& index,
40  const Table& table,
41  const String& query);
42 
43  /// Search an IndexList, get results from an Table to a Table
44  /// @param indexList the IndexList
45  /// @param table the Table from which to get results
46  /// @param query the query
47  /// @return the table containing results
49  (const IndexList& indexList,
50  const Table& table,
51  const String& query);
52 
53  /// Search an Index, get results from a Table to a Sink
54  /// @param index the Index
55  /// @param table the Table from which to get results
56  /// @param query the query
57  /// @param sink call for each row and element
58  /// @param sinkCount when/if to call sink->getCount()
59  /// @param columns if not empty, return these columns in this order
60  /// @param sort the context with which to sort (if any)
61  /// @return true iff the Sink always returned true
63  (const Index& index,
64  const Table& table,
65  const String& query,
66  Table::Sink* sink,
67  SinkNotifyCount sinkCount = SNC_After,
68  const std::vector<uint>& columns = std::vector<uint>(),
69  const std::vector<SortContext>& sort = std::vector<SortContext>());
70 
71  /// Search an Indexlist, get results from a Table to a Sink
72  /// @param indexList the IndexList
73  /// @param table the Table from which to get results
74  /// @param query the query
75  /// @param sink call for each row and element
76  /// @param sinkCount when to call sink->getCount()
77  /// @param sort the context with which to sort (if any)
78  /// @param columns if not empty, return these columns in this order
79  /// @param sort the context with which to sort (if any)
80  /// @return true iff the Sink always returned true
82  (const IndexList& indexList,
83  const Table& table,
84  const String& query,
85  Table::Sink* sink,
86  SinkNotifyCount sinkCount = SNC_After,
87  const std::vector<uint>& columns = std::vector<uint>(),
88  const std::vector<SortContext>& sort = std::vector<SortContext>());
89 
90  /// Search IndexLists, get results from a Table to a Sink
91  /// NB Indexes, Table, and sort are fully specified in query, and must be open
92  /// @param sink called for each node
93  /// @return true iff the Sink always returned true
95  (const String& query,
96  Table::Sink* sink);
97 
98  // ================================ SEARCH STORE ============
99 
100  /// Search an Index, get results from a Store to a Store
101  /// @param index the Index
102  /// @param store the Store from which to get results
103  /// @param query the query
104  /// @return the store containing results
106  (const Index& index,
107  const Store& store,
108  const String& query);
109 
110  /// Search an IndexList, get results from an Store to a Store
111  /// @param indexList the IndexList
112  /// @param table the Store from which to get results
113  /// @param query the query
114  /// @return the store containing results
116  (const IndexList& indexList,
117  const Store& table,
118  const String& query);
119 
120  /// Search an Index, get results from a Store to a Sink
121  /// @param index the Index
122  /// @param store the Store from which to get results
123  /// @param query the query
124  /// @param sink called for each node
125  /// @param sinkCount when to call sink->getCount()
126  /// @param sort the context with which to sort (if any)
127  /// @param addressBy use this set of callbacks to Sink
128  /// @param nodes if not empty, return these nodes in store order
129  /// @return true iff the Sink always returned true
131  (const Index& index,
132  const Store& store,
133  const String& query,
134  Store::Sink* sink,
135  SinkNotifyCount sinkCount = SNC_After,
136  const std::vector<SortContext>& sort = std::vector<SortContext>(),
138  const std::vector<Store::Location>& nodes = std::vector<Store::Location>());
139 
140  /// Search an Indexlist, get results from a Store to a Sink
141  /// @param indexList the IndexList
142  /// @param store the Store from which to get results
143  /// @param query the query
144  /// @paran sink called for each node
145  /// @param sinkCount when to call sink->setCount()
146  /// @param sort the context with which to sort (if any)
147  /// @param nodes if not empty, return these nodes in store order
148  /// @param addressBy use this set of callbacks to Sink
149  /// @return true iff the Sink always returned true
151  (const IndexList& indexList,
152  const Store& store,
153  const String& query,
154  Store::Sink* sink,
155  SinkNotifyCount sinkCount = SNC_After,
156  const std::vector<SortContext>& sort = std::vector<SortContext>(),
158  const std::vector<Store::Location>& nodes = std::vector<Store::Location>());
159 
160  /// Search IndexLists, get results from a Store to a Sink
161  /// NB Indexes, Store, and sort are fully specified in query, and must be open
162  /// @param sink called for each node
163  /// @return true iff the Sink always returned true
165  (const String& query,
166  Store::Sink* sink);
167 
168  /// Thrown when a query contains an unknown or out-of-place operator
170  {
171  public:
173  (String op);
174  };
175 
176  /// Thrown when a query on an IndexList contains no Index identifier
178  {
179  public:
181  (String query = String());
182  };
183 
184 }
185 
186 #endif
187 
uint * columns
Definition: table_c.h:340
XPACE_EXPORT Store searchStore(const Index &index, const Store &store, const String &query)
Search an Index, get results from a Store to a Store.
LOC = Location.
Definition: store.h:99
A low-level data holder.
Definition: types_c.h:82
A string, Unicode UTF-16 and reference-counted.
Definition: types.h:269
Copyright (C) 2012 Xpace, LLC.
unsigned int uint
Definition: types_c.h:42
AddressBy
The LOC param to Sink.
Definition: store.h:97
XPACE_EXPORT Table searchTable(const Index &index, const Table &table, const String &query)
Search an Index, get results from a Table to a Table.
Thrown when a query contains an unknown or out-of-place operator.
Definition: search.h:169
uint uint64 Xpace_Table_Sink * sink
Definition: table_c.h:340
Thrown when a query on an IndexList contains no Index identifier.
Definition: search.h:177
Xpace project main namespace
Definition: datetime.h:18
get count after content (content comes immediately; search resolution continues after Sink returns fa...
Definition: data.h:255
SinkNotifyCount
Sink is an interface to an object that receives data.
Definition: data.h:251

current as of Wed Jun 10 2026 12:00:05