This file is indexed.

/usr/include/strigi/indexwriter.h is in libstreamanalyzer-dev 0.7.7-1.1ubuntu3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
/* This file is part of Strigi Desktop Search
 *
 * Copyright (C) 2006 Jos van den Oever <jos@vandenoever.info>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */
#ifndef STRIGI_INDEXWRITER_H
#define STRIGI_INDEXWRITER_H

#include <string>
#include <vector>
#include <strigi/strigiconfig.h>
#include "streamanalyzer.h"

namespace Strigi {

template <class T> class StreamBase;
class FieldRegister;

class AnalysisResult;
class RegisteredField;

/**
 * Abstract class that provides write access to a Strigi index.
 *
 * Instances of the class should be obtained by calling the function
 * IndexManager::indexWriter() and should not be used from threads other
 * than the thread that called IndexManager::indexWriter().
 *
 * The lifecycle of an IndexWriter should be:
 * <pre>
 * - create indexwriter
 * for all streams {
 * - create an indexable
 * - add the indexwriter to it
 * - add a stream to the indexable (optional)
 * - add fields to indexable (optional)
 * - delete the indexable
 * }
 * - delete the indexwriter
 * </pre>
 *
 * Where the functions have default implementations, they
 * do not do anything.
 */
class STREAMANALYZER_EXPORT IndexWriter {
friend class AnalysisResult;
public:
    /**
     * @brief Notifies the IndexWriter that a new stream is being analyzed.
     *
     * @param result the AnalysisResult for the stream that is being
     * analyzed.
     */
    virtual void startAnalysis(const AnalysisResult*) = 0;
    /**
     * @brief Add a fragment of text to the index.
     *
     * See AnalysisResult::addText() for more information.
     *
     * @param result the AnalysisResult for the object that is
     * being analyzed
     * @param text a pointer to a fragment of utf8 encoded text
     * @param length the length of the fragment
     */
    virtual void addText(const AnalysisResult* result, const char* text, int32_t length)=0;
    /**
     * @brief Add a field to the index.
     *
     * See AnalysisResult::addValue() for more information.
     *
     * @param result the AnalysisResult for the object that is
     * being analyzed
     * @param field description of the field
     * @param value value of the field
     */
    virtual void addValue(const AnalysisResult* result, const RegisteredField* field,
        const std::string& value) = 0;
    /**
     * @brief Add a field to the index.
     *
     * See AnalysisResult::addValue() for more information.
     *
     * @param result the AnalysisResult for the object that is
     * being analyzed
     * @param field description of the field
     * @param data value of the field
     * @param size length of the data
     */
    virtual void addValue(const AnalysisResult* result, const RegisteredField* field,
        const unsigned char* data, uint32_t size) = 0;
    /**
     * @brief Add a field to the index.
     *
     * See AnalysisResult::addValue() for more information.
     *
     * @param result the AnalysisResult for the object that is
     * being analyzed
     * @param field description of the field
     * @param value value of the field
     */
    virtual void addValue(const AnalysisResult* result, const RegisteredField* field,
        int32_t value) = 0;
    /**
     * @brief Add a field to the index.
     *
     * See AnalysisResult::addValue() for more information.
     *
     * @param result the AnalysisResult for the object that is
     * being analyzed
     * @param field description of the field
     * @param value value of the field
     */
    virtual void addValue(const AnalysisResult* result, const RegisteredField* field,
        uint32_t value) = 0;
    /**
     * @brief Add a field to the index.
     *
     * See AnalysisResult::addValue() for more information.
     *
     * @param result the AnalysisResult for the object that is
     * being analyzed
     * @param field description of the field
     * @param value value of the field
     */
    virtual void addValue(const AnalysisResult* result, const RegisteredField* field,
        double value) = 0;
    /**
     * @brief Add a field to the index.
     *
     * See AnalysisResult::addValue() for more information.
     *
     * @param result the AnalysisResult for the object that is
     * being analyzed
     * @param field description of the field
     * @param name
     * @param value value of the field
     */
    virtual void addValue(const AnalysisResult* result, const RegisteredField* field,
        const std::string& name, const std::string& value) = 0;
    /**
     * @brief Notifies the IndexWriter that the analysis of this
     * stream is complete.
     *
     * @param result the AnalysisResult for the stream that has finished
     * being analyzed.
     */
    virtual void finishAnalysis(const AnalysisResult* result) = 0;
    /**
     * @brief Add a complete RDF triplet.
     *
     * @param subject
     * @param predicate
     * @param object
     **/
    virtual void addTriplet(const std::string& subject,
        const std::string& predicate, const std::string& object) = 0;
public:
    virtual ~IndexWriter() {}
    /**
     * @brief Flush the accumulated changes to disk.
     **/
    virtual void commit() { return; }
    /**
     * @brief Delete the entries with the given paths from the index.
     *
     * @param entries the paths of the files that should be deleted
     **/
    virtual void deleteEntries(const std::vector<std::string>& entries) = 0;
    /**
     * @brief Delete all indexed documents from the index.
     **/
    virtual void deleteAllEntries() = 0;
    /**
     * @brief Return the number of objects that are currently in the cache.
     **/
    virtual int itemsInCache() { return 0; }
    /**
     * @brief Optimize the index.
     *
     * This can be computationally intensive and may cause the index to
     * temporarily use the double amount of diskspace.
     **/
    virtual void optimize() {}
    /**
     * @brief Initialise the writer data of the fields.
     *
     * This performs initialization on the writer data of the fields in
     * @p fieldRegister.  When called, the writer data is set to a 0-pointer
     * for every field.
     *
     * For example, this function may create an object to store the value for
     * the field.  The following example is based on code from xmlindexer:
     * @code
     * map<string, RegisteredField*>::const_iterator i;
     * map<string, RegisteredField*>::const_iterator end = fieldRegister.fields().end();
     * for (i = fieldRegister.fields().begin(); i != end; ++i) {
     *     Tag* tag = new Tag();
     *     const string name(i->first);
     *     tag->open = "  <value name='" + name + "'>";
     *     tag->close = "</value>\n";
     *     i->second->setWriterData(tag);
     * }
     * @endcode
     *
     * This function must be called on a fieldRegister before any of its
     * fields are passed to any addValue() function.
     *
     * @param fieldRegister the FieldRegister to initialize
     */
    virtual void initWriterData(const Strigi::FieldRegister& /*fieldRegister*/){
    }
    /**
     * @brief Clean up the writer data of the fields.
     *
     * This cleans up the writer data set with initWriterData() and/or addValue().
     * Typically, this will mean deleting the memory used by the writer data:
     * @code
     * map<string, RegisteredField*>::const_iterator i;
     * map<string, RegisteredField*>::const_iterator end = f.fields().end();
     * for (i = f.fields().begin(); i != end; ++i) {
     *     delete static_cast<Tag*>(i->second->writerData());
     * }
     * @endcode
     *
     * No further calls may be made to addValue() with any Strigi::RegisteredField
     * that has already been passed to this function in a Strigi::FieldRegister.
     *
     * This function may only be called once for each corresponding call of
     * initWriterData() with the same Strigi::FieldRegister, and this must take
     * place after the call to initWriterData().
     *
     * @param fieldRegister contains the fields to be cleaned up after
     */
    virtual void releaseWriterData(const Strigi::FieldRegister &/*fieldRegister*/) {
    }
};

} // end namespace Strigi

#endif