got the kio_slave working again

This commit is contained in:
dockes 2008-11-13 10:57:46 +00:00
parent 98a5723fb0
commit 484c5db4e9
5 changed files with 37 additions and 23 deletions

View File

@ -20,11 +20,10 @@ Implementation notes:
- You MUST install a kio_recoll.la in lib/kde3 along with kio_recoll.so,
else kdeinit won't be able to load the lib (probably uses the libltdl
crap?). The one in this directory was duplicated/adjusted from
kio_man.la
thingy?). The one in this directory was duplicated/adjusted from
kio_man.la. The contents don't seem too critical, just needs to exist.
- The current implementation always tries to retrieve 100 docs (doesn't
even stop if there are less). It would probably be easy to add state and
- Currently retrieves all results on one page. Need to add state and
previous/next buttons. As I didn't find this thing to be particularly
useful, I didn't bothered to.
@ -35,5 +34,7 @@ Implementation notes:
wherever kde keeps its plugins (ie: lib/kde3), and recoll.protocol in the
services directory (share/services ? look for other .protocol file).
- I saw after doing the build/config mockup that kdevelop can generate a kio_slave project. This would certainly be the next thing to do.
- I saw after doing the build/config mockup that kdevelop can generate a
kio_slave project. This might be the next thing to do. otoh would need to
separate the kio from the main source to avoid having to distribute 2megs
of kde build config files.

View File

@ -1,13 +1,20 @@
depth=../../..
include $(depth)/mk/sysconf
# Need to set this by hand until we decide how to autoconf this without
# bringing 2mbytes of kde config files.
# May also need to adjust stuff such as the --rpath's below
#
KDE_INCLUDES=/usr/include/kde
QT_INCLUDES=/usr/include/qt3
all: kio_recoll.so
DEPS_CXXFLAGS = -MT pop3.lo -MD -MP -MF .deps/pop3.Tpo
INC_CXXFLAGS = -I. \
-I/usr/local/include -I/usr/X11R6/include \
-I/opt/kde3/include -I$(QTDIR)/include \
-I$(KDE_INCLUDES) -I$(QT_INCLUDES) \
-I$(depth)/common -I$(depth)/query -I$(depth)/utils \
-I$(depth)/qtgui -I$(depth)/rcldb

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: kio_recoll.cpp,v 1.10 2008-09-29 11:33:55 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: kio_recoll.cpp,v 1.11 2008-11-13 10:57:46 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
#include <stdio.h>
@ -21,7 +21,8 @@ using namespace std;
#include "docseqdb.h"
#include "pathut.h"
#include "searchdata.h"
#include "wasastringtoquery.h"
#include "wasatorcl.h"
#include "plaintorich.h"
#include "kio_recoll.h"
@ -75,8 +76,7 @@ bool RecollProtocol::maybeOpenDb(string &reason)
}
if (!m_rcldb->isopen() && !m_rcldb->open(m_dbdir,
m_rclconfig->getStopfile(),
Rcl::Db::DbRO,
Rcl::Db::QO_STEM)) {
Rcl::Db::DbRO)) {
reason = "Could not open database in " + m_dbdir;
return false;
}
@ -106,23 +106,23 @@ void RecollProtocol::get(const KURL & url)
fprintf(stderr, "RecollProtocol::get:path [%s]\n", path.latin1());
QCString u8 = path.utf8();
RefCntr<Rcl::SearchData> sdata(new Rcl::SearchData(Rcl::SCLT_OR));
sdata->addClause(new Rcl::SearchDataClauseSimple(Rcl::SCLT_AND,
(const char *)u8));
Rcl::Query *query = new Rcl::Query(m_rcldb);
RefCntr<Rcl::SearchData> sdata = wasaStringToRcl((const char*)u8, m_reason);
sdata->setStemlang("english");
RefCntr<Rcl::Query>query(new Rcl::Query(m_rcldb));
if (!query->setQuery(sdata)) {
m_reason = "Internal Error: setQuery failed";
outputError(m_reason.c_str());
finished();
delete query;
return;
}
if (m_docsource)
delete m_docsource;
m_docsource = new DocSequenceDb(RefCntr<Rcl::Query>(query),
"Query results", sdata);
m_docsource = new DocSequenceDb(query, "Query results", sdata);
string explain = m_docsource->getDescription();
QByteArray output;
QTextStream os(output, IO_WriteOnly );
@ -134,8 +134,13 @@ void RecollProtocol::get(const KURL & url)
os << "<title>Recoll: query results</title>" << endl;
os << "</head><body>" << endl;
// outputError("EXPLAINING");
os << "<p><b>Actual query performed: </b>" << endl;
os << explain.c_str() << "</p>";
Rcl::Doc doc;
for (int i = 0; i < 100; i++) {
int cnt = query->getResCnt();
for (int i = 0; i < cnt; i++) {
string sh;
doc.erase();

View File

@ -32,4 +32,4 @@ dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/lib/kde3'
libdir='/usr/lib/kde3'

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: docseqdb.cpp,v 1.8 2008-09-29 11:33:55 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: docseqdb.cpp,v 1.9 2008-11-13 10:57:46 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -26,7 +26,8 @@ static char rcsid[] = "@(#$Id: docseqdb.cpp,v 1.8 2008-09-29 11:33:55 dockes Exp
DocSequenceDb::DocSequenceDb(RefCntr<Rcl::Query> q, const string &t,
RefCntr<Rcl::SearchData> sdata)
: DocSequence(t), m_q(q), m_sdata(sdata), m_rescnt(-1), m_filt(false)
: DocSequence(t), m_q(q), m_sdata(sdata), m_fsdata(sdata),
m_rescnt(-1), m_filt(false)
{
}