*** empty log message ***

This commit is contained in:
dockes 2005-02-01 08:42:56 +00:00
parent a93e619960
commit cc512e2ec0
11 changed files with 246 additions and 186 deletions

View File

@ -1,5 +1,5 @@
include ../mk/FreeBSD
BIGLIB = ../lib/librcl.a
CXXFLAGS = -Wall -g -I. -I../unac -I../utils -I/usr/local/include
PROGS = unacpp textsplit

View File

@ -1,5 +1,5 @@
CXXFLAGS = -Wall -g -I. -I../utils -I../common -I/usr/local/include
include ../mk/FreeBSD
BIGLIB = ../lib/librcl.a

View File

@ -1,10 +1,11 @@
#ifndef lint
static char rcsid[] = "@(#$Id: recollindex.cpp,v 1.8 2005-01-31 14:31:09 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: recollindex.cpp,v 1.9 2005-02-01 08:42:56 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
#include <stdio.h>
#include <signal.h>
#include "debuglog.h"
#include "indexer.h"
ConfIndexer *indexer;
@ -34,6 +35,8 @@ int main(int argc, const char **argv)
if (signal(SIGTERM, SIG_IGN) != SIG_IGN)
signal(SIGTERM, sigcleanup);
DebugLog::getdbl()->setloglevel(DEBDEB1);
DebugLog::setfilename("stderr");
RclConfig config;
if (!config.ok()) {
fprintf(stderr, "Config could not be built\n");

View File

@ -1,5 +1,4 @@
CXXFLAGS = -Wall -g -I. -I../index -I../utils -I../common \
-I../unac -I/usr/local/include
include ../mk/FreeBSD
UNACCFLAGS = -g -I. -I../unac -I/usr/local/include -DUNAC_VERSION=\"1.0.7\"

View File

@ -3,6 +3,7 @@
#include "indexer.h"
#include "debuglog.h"
#include "idxthread.h"
class IdxThread : public QThread {
virtual void run();
@ -11,9 +12,10 @@ class IdxThread : public QThread {
};
int startindexing;
int indexingdone;
bool indexingstatus;
int stopidxthread;
int indexingdone = 1;
bool indexingstatus = false;
static int stopidxthread;
void IdxThread::run()
{
@ -24,9 +26,10 @@ void IdxThread::run()
return;
}
if (startindexing) {
indexingdone = indexingstatus = startindexing = 0;
indexingdone = indexingstatus = 0;
fprintf(stderr, "Index thread :start index\n");
indexingstatus = indexer->index();
startindexing = 0;
indexingdone = 1;
}
msleep(100);

View File

@ -9,13 +9,12 @@
#include "rcldb.h"
#include "rclconfig.h"
#include "pathut.h"
#include "recoll.h"
RclConfig *rclconfig;
Rcl::Db *rcldb;
int recollNeedsExit;
extern void start_idxthread(RclConfig *cnf);
extern void stop_idxthread();
extern int startindexing;
void recollCleanup()
{
@ -26,7 +25,6 @@ void recollCleanup()
rclconfig = 0;
}
int recollNeedsExit;
static void sigcleanup(int sig)
{

View File

@ -29,156 +29,157 @@
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout10</cstring>
<cstring>layout3</cstring>
</property>
<vbox>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<widget class="QLineEdit">
<property name="name">
<cstring>layout8</cstring>
<cstring>queryText</cstring>
</property>
<property name="frameShape">
<enum>LineEditPanel</enum>
</property>
<property name="frameShadow">
<enum>Sunken</enum>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLineEdit">
<property name="name">
<cstring>queryText</cstring>
</property>
<property name="frameShape">
<enum>LineEditPanel</enum>
</property>
<property name="frameShadow">
<enum>Sunken</enum>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>Search</cstring>
</property>
<property name="text">
<string>Search</string>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>listPrevPb</cstring>
</property>
<property name="text">
<string>Previous page</string>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>listNextPB</cstring>
</property>
<property name="text">
<string>Next page</string>
</property>
</widget>
<spacer>
<property name="name">
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>346</width>
<height>20</height>
</size>
</property>
</spacer>
</hbox>
</widget>
<widget class="QSplitter">
<widget class="QPushButton">
<property name="name">
<cstring>splitter6</cstring>
<cstring>Search</cstring>
</property>
<property name="text">
<string>Search</string>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>clearqPB</cstring>
</property>
<property name="text">
<string>Clear</string>
</property>
<property name="accel">
<string>Ctrl+S</string>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>listPrevPb</cstring>
</property>
<property name="text">
<string>Previous page</string>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>listNextPB</cstring>
</property>
<property name="text">
<string>Next page</string>
</property>
</widget>
<spacer>
<property name="name">
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<widget class="QTextEdit">
<property name="name">
<cstring>reslistTE</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="textFormat">
<enum>RichText</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QSplitter">
<property name="name">
<cstring>splitter5</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>5</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<widget class="QTextEdit">
<property name="name">
<cstring>previewTextEdit</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>4</verstretch>
</sizepolicy>
</property>
<property name="textFormat">
<enum>RichText</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QTextEdit">
<property name="name">
<cstring>metaTextEdit</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="textFormat">
<enum>RichText</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</widget>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>346</width>
<height>20</height>
</size>
</property>
</spacer>
</hbox>
</widget>
<widget class="QSplitter">
<property name="name">
<cstring>splitter6</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<widget class="QTextEdit">
<property name="name">
<cstring>reslistTE</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="textFormat">
<enum>RichText</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QSplitter">
<property name="name">
<cstring>splitter5</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>5</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<widget class="QTextEdit">
<property name="name">
<cstring>previewTextEdit</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>4</verstretch>
</sizepolicy>
</property>
<property name="textFormat">
<enum>RichText</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</vbox>
<widget class="QTextEdit">
<property name="name">
<cstring>metaTextEdit</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="textFormat">
<enum>RichText</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</widget>
</widget>
</vbox>
</widget>
@ -189,6 +190,8 @@
<item text="&amp;File" name="fileMenu">
<separator/>
<separator/>
<action name="fileStart_IndexingAction"/>
<separator/>
<action name="fileExitAction"/>
</item>
<item text="&amp;Help" name="helpMenu">
@ -212,6 +215,17 @@
<string></string>
</property>
</action>
<action>
<property name="name">
<cstring>fileStart_IndexingAction</cstring>
</property>
<property name="text">
<string>Start Indexing</string>
</property>
<property name="menuText">
<string>Start Indexing</string>
</property>
</action>
</actions>
<connections>
<connection>
@ -256,6 +270,18 @@
<receiver>RecollMain</receiver>
<slot>reslistTE_clicked(int,int)</slot>
</connection>
<connection>
<sender>fileStart_IndexingAction</sender>
<signal>activated()</signal>
<receiver>RecollMain</receiver>
<slot>fileStart_IndexingAction_activated()</slot>
</connection>
<connection>
<sender>clearqPB</sender>
<signal>clicked()</signal>
<receiver>RecollMain</receiver>
<slot>clearqPB_clicked()</slot>
</connection>
</connections>
<includes>
<include location="local" impldecl="in implementation">recollmain.ui.h</include>
@ -267,10 +293,12 @@
<slots>
<slot>fileExit()</slot>
<slot>checkExit()</slot>
<slot>reslistTE_doubleClicked( int par, int car )</slot>
<slot>fileStart_IndexingAction_activated()</slot>
<slot>reslistTE_doubleClicked( int par, int )</slot>
<slot>reslistTE_clicked( int par, int car )</slot>
<slot>queryText_returnPressed()</slot>
<slot>Search_clicked()</slot>
<slot>clearqPB_clicked()</slot>
<slot>listPrevPB_clicked()</slot>
<slot>listNextPB_clicked()</slot>
</slots>

View File

@ -23,24 +23,34 @@
#include "debuglog.h"
#include "mimehandler.h"
#include "pathut.h"
#include "recoll.h"
extern RclConfig *rclconfig;
extern Rcl::Db *rcldb;
extern void recollCleanup();
void RecollMain::fileExit()
{
LOGDEB(("RecollMain: fileExit\n"));
exit(0);
}
extern int recollNeedsExit;
// Misnomer. This is called on a 100ms timer and actually checks for different
// things apart from a need to exit
void RecollMain::checkExit()
{
if (indexingstatus) {
indexingstatus = false;
// Make sure we reopen the db to get the results.
fprintf(stderr, "Indexing done: closing query database\n");
rcldb->close();
}
if (recollNeedsExit)
fileExit();
}
void RecollMain::fileStart_IndexingAction_activated()
{
if (indexingdone == 1)
startindexing = 1;
}
static string plaintorich(const string &in)
{
string out = "<qt><head><title></title></head><body><p>";
@ -60,7 +70,7 @@ static string urltolocalpath(string url)
}
// Use external viewer to display file
void RecollMain::reslistTE_doubleClicked(int par, int car)
void RecollMain::reslistTE_doubleClicked(int par, int)
{
// restlistTE_clicked(par, car);
Rcl::Doc doc;
@ -215,6 +225,10 @@ void RecollMain::Search_clicked()
queryText_returnPressed();
}
void RecollMain::clearqPB_clicked()
{
queryText->clear();
}
static const int respagesize = 10;
void RecollMain::listPrevPB_clicked()
@ -307,3 +321,4 @@ void RecollMain::listNextPB_clicked()
}
}

View File

@ -1,5 +1,4 @@
CXXFLAGS = -Wall -g -I. -I../index -I../utils -I../common -I/usr/local/include
include ../mk/FreeBSD
BIGLIB=../lib/librcl.a

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.14 2005-01-31 14:31:09 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.15 2005-02-01 08:42:55 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
#include <sys/stat.h>
@ -57,6 +57,7 @@ Rcl::Db::~Db()
ndb->iswritable));
if (ndb->isopen == false)
return;
string ermsg;
try {
LOGDEB(("Rcl::Db::~Db: deleting native database\n"));
if (ndb->iswritable == true)
@ -64,15 +65,15 @@ Rcl::Db::~Db()
delete ndb;
return;
} catch (const Xapian::Error &e) {
cerr << "Exception: " << e.get_msg() << endl;
ermsg = e.get_msg();
} catch (const string &s) {
cerr << "Exception: " << s << endl;
ermsg = s;
} catch (const char *s) {
cerr << "Exception: " << s << endl;
ermsg = s;
} catch (...) {
cerr << "Caught unknown exception" << endl;
ermsg = "Caught unknown exception";
}
LOGERR(("Rcl::Db::~Db: got exception\n"));
LOGERR(("Rcl::Db::~Db: got exception: %s\n", ermsg.c_str()));
}
bool Rcl::Db::open(const string& dir, OpenMode mode)
@ -93,7 +94,11 @@ bool Rcl::Db::open(const string& dir, OpenMode mode)
case DbUpd:
ndb->wdb =
Xapian::WritableDatabase(dir, Xapian::DB_CREATE_OR_OPEN);
LOGDEB(("Rcl::Db::open: lastdocid: %d\n",
ndb->wdb.get_lastdocid()));
ndb->updated.resize(ndb->wdb.get_lastdocid() + 1);
for (unsigned int i = 0; i < ndb->updated.size(); i++)
ndb->updated[i] = false;
ndb->iswritable = true;
break;
case DbTrunc:
@ -133,27 +138,27 @@ bool Rcl::Db::close()
ndb->iswritable));
if (ndb->isopen == false)
return true;
string ermsg;
try {
if (ndb->iswritable == true)
if (ndb->iswritable == true) {
ndb->wdb.flush();
LOGDEB(("Called xapian flush\n"));
}
delete ndb;
pdata = new Native;
if (pdata)
return true;
} catch (const Xapian::Error &e) {
cerr << "Exception: " << e.get_msg() << endl;
return false;
ermsg = e.get_msg();
} catch (const string &s) {
cerr << "Exception: " << s << endl;
return false;
ermsg = s;
} catch (const char *s) {
cerr << "Exception: " << s << endl;
return false;
ermsg = s;
} catch (...) {
cerr << "Caught unknown exception" << endl;
return false;
ermsg = "Caught unknown exception";
}
pdata = new Native;
if (pdata)
return true;
LOGERR(("Rcl::Db:close: exception while deleting db: %s\n",
ermsg.c_str()));
return false;
}
@ -290,9 +295,9 @@ bool Rcl::Db::add(const string &fn, const Rcl::Doc &doc)
ndb->wdb.replace_document(pathterm, newdocument);
if (did < ndb->updated.size()) {
ndb->updated[did] = true;
LOGDEB(("%s updated\n", fnc));
LOGDEB(("docid %d updated [%s]\n", did, fnc));
} else {
LOGDEB(("%s added\n", fnc));
LOGDEB(("docid %d added [%s]\n", did, fnc));
}
} catch (...) {
// FIXME: is this ever actually needed?
@ -318,15 +323,13 @@ bool Rcl::Db::needUpdate(const string &filename, const struct stat *stp)
if (did == ndb->wdb.postlist_end(pathterm))
return true;
Xapian::Document doc = ndb->wdb.get_document(*did);
if (*did < ndb->updated.size())
ndb->updated[*did] = true;
string data = doc.get_data();
//cerr << "DOCUMENT EXISTS " << data << endl;
const char *cp = strstr(data.c_str(), "mtime=");
cp += 6;
long mtime = atol(cp);
if (mtime >= stp->st_mtime) {
// cerr << "DOCUMENT UP TO DATE" << endl;
if (*did < ndb->updated.size())
ndb->updated[*did] = true;
return false;
}
} catch (...) {
@ -338,18 +341,31 @@ bool Rcl::Db::needUpdate(const string &filename, const struct stat *stp)
bool Rcl::Db::purge()
{
LOGDEB(("Rcl::Db::purge\n"));
// There seems to be problems with the document delete code, when
// we do this, the database is not actually updated. Especially,
// if we delete a bunch of docs, so that there is a hole in the
// docids at the beginning, we can't add anything (appears to work
// and does nothing). Maybe related to the exceptions below when
// trying to delete an unexistant document ?
// Flushing before trying the deletes seeems to work around the problem
if (pdata == 0)
return false;
Native *ndb = (Native *)pdata;
LOGDEB(("Rcl::Db::purge: isopen %d iswritable %d\n", ndb->isopen,
ndb->iswritable));
if (ndb->isopen == false || ndb->iswritable == false)
return false;
ndb->wdb.flush();
for (Xapian::docid did = 1; did < ndb->updated.size(); ++did) {
if (!ndb->updated[did]) {
try {
ndb->wdb.delete_document(did);
LOGDEB(("Rcl::Db::purge: deleted document #%d\n", did));
} catch (const Xapian::DocNotFoundError &) {
LOGDEB(("Rcl::Db::purge: document #%d not found\n", did));
}
}
}

View File

@ -1,5 +1,4 @@
CXXFLAGS = -I. -g
include ../mk/FreeBSD
BIGLIB = ../lib/librcl.a