1
/* This file is part of Strigi Desktop Search
3
* Copyright (C) 2006 Jos van den Oever <jos@vandenoever.info>
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Library General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Library General Public License for more details.
15
* You should have received a copy of the GNU Library General Public License
16
* along with this library; see the file COPYING.LIB. If not, write to
17
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
* Boston, MA 02110-1301, USA.
21
#include <CLucene/search/QueryFilter.h>
22
#include "../cluceneindexmanager.h"
23
#include "../tcharutils.h"
28
using lucene::search::Hits;
29
using lucene::search::IndexSearcher;
30
using lucene::document::Document;
31
using lucene::document::Field;
32
using lucene::index::Term;
33
using lucene::index::TermEnum;
34
using lucene::search::TermQuery;
35
using lucene::search::WildcardQuery;
36
using lucene::search::BooleanQuery;
37
using lucene::search::RangeQuery;
38
using lucene::search::QueryFilter;
39
using lucene::search::HitCollector;
40
using lucene::util::BitSet;
41
using lucene::document::DocumentFieldEnumeration;
42
using lucene::index::IndexReader;
45
docdump(Document* doc) {
46
DocumentFieldEnumeration* e = doc->fields();
47
Field* f = e->nextElement();
55
return wchartoutf8(t);
58
indexdump(const char* dir) {
59
IndexReader* indexreader = IndexReader::open(dir);
60
int32_t max = indexreader->maxDoc();
61
for (int i=0; i<max; ++i) {
62
Document* doc = indexreader->document(i);
67
TermEnum* terms = indexreader->terms();
68
while (terms->next()) {
69
Term* t = terms->term();
70
printf("%s: %s\n", t2a(t->field()).c_str(), t2a(t->text()).c_str());
75
main(int argc, char** argv) {
77
for (int i=1; i<argc; ++i) {
81
fprintf(stderr,"error while dumping index\n");