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;
46
return wchartoutf8(t);
49
docdump(Document* doc) {
50
Document::FieldsType fields = doc->getFields();
51
for ( Document::FieldsType::iterator itr = fields.begin();
54
TCHAR* s = (*itr)->toString();
55
printf("%s\n", t2a(s).c_str());
60
indexdump(const char* dir) {
61
IndexReader* indexreader = IndexReader::open(dir);
62
int32_t max = indexreader->maxDoc();
63
for (int i=0; i<max; ++i) {
64
Document* doc = indexreader->document(i);
69
TermEnum* terms = indexreader->terms();
71
while (terms->next()) {
73
printf("%s: %s\n", t2a(t->field()).c_str(), t2a(t->text()).c_str());
78
main(int argc, char** argv) {
80
for (int i=1; i<argc; ++i) {
84
fprintf(stderr,"error while dumping index\n");