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, - 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 else kdeinit won't be able to load the lib (probably uses the libltdl
crap?). The one in this directory was duplicated/adjusted from thingy?). The one in this directory was duplicated/adjusted from
kio_man.la 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 - Currently retrieves all results on one page. Need to add state and
even stop if there are less). It would probably be easy to add state and
previous/next buttons. As I didn't find this thing to be particularly previous/next buttons. As I didn't find this thing to be particularly
useful, I didn't bothered to. 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 wherever kde keeps its plugins (ie: lib/kde3), and recoll.protocol in the
services directory (share/services ? look for other .protocol file). 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=../../.. depth=../../..
include $(depth)/mk/sysconf 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 all: kio_recoll.so
DEPS_CXXFLAGS = -MT pop3.lo -MD -MP -MF .deps/pop3.Tpo DEPS_CXXFLAGS = -MT pop3.lo -MD -MP -MF .deps/pop3.Tpo
INC_CXXFLAGS = -I. \ INC_CXXFLAGS = -I. \
-I/usr/local/include -I/usr/X11R6/include \ -I$(KDE_INCLUDES) -I$(QT_INCLUDES) \
-I/opt/kde3/include -I$(QTDIR)/include \
-I$(depth)/common -I$(depth)/query -I$(depth)/utils \ -I$(depth)/common -I$(depth)/query -I$(depth)/utils \
-I$(depth)/qtgui -I$(depth)/rcldb -I$(depth)/qtgui -I$(depth)/rcldb

View File

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

View File

@ -32,4 +32,4 @@ dlopen=''
dlpreopen='' dlpreopen=''
# Directory that this library needs to be installed in: # 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 #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 #endif
/* /*
* This program is free software; you can redistribute it and/or modify * 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, DocSequenceDb::DocSequenceDb(RefCntr<Rcl::Query> q, const string &t,
RefCntr<Rcl::SearchData> sdata) 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)
{ {
} }