gui connected to rcldb (init)

This commit is contained in:
dockes
2005-01-25 14:37:35 +00:00
parent 5210139b85
commit 15855b018f
17 changed files with 621 additions and 265 deletions
+7 -27
View File
@@ -1,49 +1,29 @@
CXXFLAGS = -Wall -g -I. -I../index -I../utils -I../common -I/usr/local/include
BIGLIB=../lib/librcl.a
PROGS = qtry qxtry xadump
all: $(PROGS)
XADUMP_OBJS= xadump.o transcode.o
XADUMP_OBJS= xadump.o $(BIGLIB)
xadump : $(XADUMP_OBJS)
$(CXX) $(CXXFLAGS) -o xadump $(XADUMP_OBJS) \
-L/usr/local/lib -lxapian -liconv
QXTRY_OBJS= qxtry.o transcode.o
QXTRY_OBJS= qxtry.o $(BIGLIB)
qxtry : $(QXTRY_OBJS)
$(CXX) $(CXXFLAGS) -o qxtry $(QXTRY_OBJS) \
-L/usr/local/lib -lxapian -liconv
QTRY_OBJS= qtry.o conftree.o rclconfig.o \
rcldb.o transcode.o \
textsplit.o unac.o unacpp.o pathut.o
QTRY_OBJS= qtry.o $(BIGLIB)
qtry : $(QTRY_OBJS)
$(CXX) $(CXXFLAGS) -o qtry $(QTRY_OBJS) \
-L/usr/local/lib -lxapian -liconv
transcode.o : ../index/transcode.cpp ../index/transcode.h
$(CXX) $(CXXFLAGS) -c -o transcode.o ../index/transcode.cpp
conftree.o : ../utils/conftree.cpp ../utils/conftree.h
$(CXX) $(CXXFLAGS) -c -o conftree.o ../utils/conftree.cpp
rclconfig.o : ../common/rclconfig.cpp ../common/rclconfig.h
$(CXX) $(CXXFLAGS) -c -o rclconfig.o ../common/rclconfig.cpp
unacpp.o : ../common/unacpp.cpp ../common/unacpp.h
$(CXX) $(CXXFLAGS) -I../unac -c -o unacpp.o ../common/unacpp.cpp
pathut.o : ../utils/pathut.cpp ../utils/pathut.h
$(CXX) $(CXXFLAGS) -c -o pathut.o ../utils/pathut.cpp
rcldb.o : ../common/rcldb.cpp ../common/rcldb.h
$(CXX) $(CXXFLAGS) -c -o rcldb.o ../common/rcldb.cpp
textsplit.o : ../common/textsplit.cpp ../common/textsplit.h
$(CXX) $(CXXFLAGS) -c -o textsplit.o ../common/textsplit.cpp
CFLAGS = -g -I. -I../unac -I/usr/local/include -DUNAC_VERSION=\"1.0.7\"
unac.o : ../unac/unac.c ../unac/unac.h
$(CC) $(CFLAGS) -c -o unac.o ../unac/unac.c
$(BIGLIB):
cd ../lib;make
clean:
rm -f *.o $(PROGS)
alldeps:depend
+30 -4
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: qtry.cpp,v 1.1 2005-01-24 13:17:58 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: qtry.cpp,v 1.2 2005-01-25 14:37:21 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
// Tests with the query interface
@@ -14,6 +14,7 @@ static char rcsid[] = "@(#$Id: qtry.cpp,v 1.1 2005-01-24 13:17:58 dockes Exp $ (
#include "rclconfig.h"
#include "rcldb.h"
#include "transcode.h"
#include "mimehandler.h"
using namespace std;
@@ -86,7 +87,11 @@ int main(int argc, char **argv)
db->setQuery(query);
int i = 0;
Rcl::Doc doc;
while (db->getDoc(i++, doc)) {
for (i=0;;i++) {
doc.erase();
if (!db->getDoc(i, doc))
break;
cout << "Url: " << doc.url << endl;
cout << "Mimetype: " << doc.mimetype << endl;
cout << "Mtime: " << doc.mtime << endl;
@@ -96,8 +101,29 @@ int main(int argc, char **argv)
cout << "Keywords: " << doc.keywords << endl;
cout << "Abstract: " << doc.abstract << endl;
cout << endl;
doc.erase();
// Go to the file system to retrieve / convert the document text
// for preview:
// Look for appropriate handler
MimeHandlerFunc fun = getMimeHandler(doc.mimetype,
config->getMimeConf());
if (!fun) {
cout << "No mime handler !" << endl;
continue;
}
string fn = doc.url.substr(6, string::npos);
cout << "Filename: " << fn << endl;
Rcl::Doc fdoc;
if (!fun(config, fn, doc.mimetype, fdoc)) {
cout << "Failed to convert/preview document!" << endl;
continue;
}
string outencoding = "iso8859-1";
string printable;
transcode(fdoc.text, printable, "UTF-8", outencoding);
cout << printable << endl;
}
delete db;
cerr << "Exiting" << endl;
+8 -3
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: xadump.cpp,v 1.2 2004-12-17 15:50:48 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: xadump.cpp,v 1.3 2005-01-25 14:37:21 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
#include <strings.h>
@@ -17,7 +17,13 @@ using namespace std;
static string thisprog;
static string usage =
" -d <dbdir> -e <output encoding>"
" -d <dbdir> -e <output encoding>\n"
" -i docid -D : get document data for docid\n"
" -t term -E : term existence test\n"
" -t term -F : retrieve term frequency data\n"
" -t term -P : retrieve postings for term\n"
" -i docid -T : term list for doc docid\n"
" -T : list all terms\n"
" \n\n"
;
@@ -130,7 +136,6 @@ int main(int argc, char **argv)
} catch (const Xapian::Error &e) {
cout << "Exception: " << e.get_msg() << endl;
} catch (const string &s) {