*** empty log message ***
This commit is contained in:
parent
0dde2934d6
commit
5210139b85
24
src/common/Makefile
Normal file
24
src/common/Makefile
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
CXXFLAGS = -Wall -g -I. -I../unac -I../utils -I/usr/local/include
|
||||||
|
CFLAGS = -g -I. -I../unac -I/usr/local/include -DUNAC_VERSION=\"1.0.7\"
|
||||||
|
|
||||||
|
|
||||||
|
PROGS = unacpp
|
||||||
|
all: $(PROGS)
|
||||||
|
|
||||||
|
UNACPP_OBJS= trunacpp.o unacpp.o unac.o readfile.o
|
||||||
|
unacpp : $(UNACPP_OBJS)
|
||||||
|
$(CXX) $(CXXFLAGS) -o unacpp $(UNACPP_OBJS) \
|
||||||
|
-L/usr/local/lib -liconv
|
||||||
|
|
||||||
|
unac.o : ../unac/unac.c ../unac/unac.h
|
||||||
|
$(CC) $(CFLAGS) -c -o unac.o ../unac/unac.c
|
||||||
|
|
||||||
|
readfile.o : ../utils/readfile.cpp ../utils/readfile.h
|
||||||
|
$(CXX) $(CXXFLAGS) -c -o readfile.o ../utils/readfile.cpp
|
||||||
|
|
||||||
|
trunacpp.o : unacpp.cpp unacpp.h
|
||||||
|
$(CXX) $(CXXFLAGS) -DTEST_UNACPP -c -o trunacpp.o unacpp.cpp
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o $(PROGS)
|
||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.2 2004-12-15 15:00:36 dockes Exp $ (C) 2004 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.3 2005-01-24 13:17:58 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -54,7 +54,7 @@ RclConfig::RclConfig()
|
|||||||
cerr << "No mime conf file" << endl;
|
cerr << "No mime conf file" << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mimeconf->list();
|
// mimeconf->list();
|
||||||
m_ok = true;
|
m_ok = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
#ifndef _TEXTSPLIT_H_INCLUDED_
|
#ifndef _TEXTSPLIT_H_INCLUDED_
|
||||||
#define _TEXTSPLIT_H_INCLUDED_
|
#define _TEXTSPLIT_H_INCLUDED_
|
||||||
/* @(#$Id: textsplit.h,v 1.2 2004-12-17 13:01:01 dockes Exp $ (C) 2004 J.F.Dockes */
|
/* @(#$Id: textsplit.h,v 1.3 2005-01-24 13:17:58 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Split text into words.
|
* Split text into words.
|
||||||
* See comments at top of .cpp for more explanations.
|
* See comments at top of .cpp for more explanations.
|
||||||
* This used a callback function. It could be done with an iterator instead,
|
* This uses a callback function. It could be done with an iterator instead,
|
||||||
* but 'ts much simpler this way...
|
* but 'ts much simpler this way...
|
||||||
*/
|
*/
|
||||||
class TextSplit {
|
class TextSplit {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: unacpp.cpp,v 1.1 2004-12-17 15:36:13 dockes Exp $ (C) 2004 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: unacpp.cpp,v 1.2 2005-01-24 13:17:58 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TEST_UNACPP
|
#ifndef TEST_UNACPP
|
||||||
@ -26,6 +26,7 @@ bool unac_cpp(const std::string &in, std::string &out, const char *encoding)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
out.assign(cout, out_len);
|
out.assign(cout, out_len);
|
||||||
|
free(cout);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
73
src/index/Makefile
Normal file
73
src/index/Makefile
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
|
||||||
|
CXXFLAGS = -Wall -g -I. -I../utils -I../common -I/usr/local/include
|
||||||
|
|
||||||
|
|
||||||
|
PROGS = transcode textsplit idxdriver csguess
|
||||||
|
all: $(PROGS)
|
||||||
|
|
||||||
|
IDXDRIVER_OBJS= idxdriver.o pathut.o conftree.o rclconfig.o fstreewalk.o \
|
||||||
|
mimetype.o rcldb.o readfile.o transcode.o csguess.o \
|
||||||
|
textsplit.o unac.o unacpp.o
|
||||||
|
|
||||||
|
idxdriver : $(IDXDRIVER_OBJS)
|
||||||
|
$(CXX) $(CXXFLAGS) -o idxdriver $(IDXDRIVER_OBJS) \
|
||||||
|
-L/usr/local/lib -lxapian -liconv
|
||||||
|
|
||||||
|
TEXTSPLIT_OBJS= trtextsplit.o textsplit.o readfile.o
|
||||||
|
textsplit : $(TEXTSPLIT_OBJS)
|
||||||
|
$(CXX) $(CXXFLAGS) -o textsplit $(TEXTSPLIT_OBJS)
|
||||||
|
trtextsplit.o : ../common/textsplit.cpp ../common/textsplit.h
|
||||||
|
$(CXX) $(CXXFLAGS) -DTEST_TEXTSPLIT -c -o trtextsplit.o \
|
||||||
|
../common/textsplit.cpp
|
||||||
|
|
||||||
|
pathut.o : ../utils/pathut.cpp ../utils/pathut.h
|
||||||
|
$(CXX) $(CXXFLAGS) -c -o pathut.o ../utils/pathut.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
|
||||||
|
fstreewalk.o : ../utils/fstreewalk.cpp ../utils/fstreewalk.h
|
||||||
|
$(CXX) $(CXXFLAGS) -c -o fstreewalk.o ../utils/fstreewalk.cpp
|
||||||
|
readfile.o : ../utils/readfile.cpp ../utils/readfile.h
|
||||||
|
$(CXX) $(CXXFLAGS) -c -o readfile.o ../utils/readfile.cpp
|
||||||
|
|
||||||
|
|
||||||
|
unacpp.o : ../common/unacpp.cpp ../common/unacpp.h
|
||||||
|
$(CXX) $(CXXFLAGS) -I../unac -c -o unacpp.o ../common/unacpp.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
|
||||||
|
|
||||||
|
CSGUESS_OBJS= trcsguess.o csguess.o readfile.o
|
||||||
|
csguess : $(CSGUESS_OBJS)
|
||||||
|
$(CXX) $(CXXFLAGS) -o csguess $(CSGUESS_OBJS) \
|
||||||
|
-L/usr/local/lib -liconv
|
||||||
|
trcsguess.o : csguess.cpp csguess.h
|
||||||
|
$(CXX) $(CXXFLAGS) -DTEST_CSGUESS -c -o trcsguess.o \
|
||||||
|
csguess.cpp
|
||||||
|
TRANSCODE_OBJS= trtranscode.o transcode.o readfile.o
|
||||||
|
transcode : $(TRANSCODE_OBJS)
|
||||||
|
$(CXX) $(CXXFLAGS) -o transcode $(TRANSCODE_OBJS) \
|
||||||
|
-L/usr/local/lib -liconv
|
||||||
|
trtranscode.o : transcode.cpp transcode.h
|
||||||
|
$(CXX) $(CXXFLAGS) -DTEST_TRANSCODE -c -o trtranscode.o \
|
||||||
|
transcode.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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o $(PROGS)
|
||||||
|
|
||||||
|
alldeps:depend
|
||||||
|
depend:
|
||||||
|
$(CXX) $(CXXFLAGS) -M *.cpp > alldeps
|
||||||
|
include alldeps
|
||||||
|
|
||||||
245
src/qtgui/form1.ui
Normal file
245
src/qtgui/form1.ui
Normal file
@ -0,0 +1,245 @@
|
|||||||
|
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||||
|
<class>Form1</class>
|
||||||
|
<widget class="QMainWindow">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>Form1</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>774</width>
|
||||||
|
<height>619</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="caption">
|
||||||
|
<string>Form1</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QLayoutWidget">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>layout7</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>11</x>
|
||||||
|
<y>11</y>
|
||||||
|
<width>752</width>
|
||||||
|
<height>41</height>
|
||||||
|
</rect>
|
||||||
|
</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>pushButton1</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>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</hbox>
|
||||||
|
</widget>
|
||||||
|
<widget class="QSplitter">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>splitter9</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>11</x>
|
||||||
|
<y>58</y>
|
||||||
|
<width>752</width>
|
||||||
|
<height>491</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="QTextEdit">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>resTextEdit</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QSplitter">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>splitter8</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="QTextEdit">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>textEdit12</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QTextEdit">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>textEdit13</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<menubar>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>MenuBar</cstring>
|
||||||
|
</property>
|
||||||
|
<item text="&File" name="fileMenu">
|
||||||
|
<separator/>
|
||||||
|
<separator/>
|
||||||
|
<action name="fileExitAction"/>
|
||||||
|
</item>
|
||||||
|
<item text="&Help" name="helpMenu">
|
||||||
|
<action name="helpContentsAction"/>
|
||||||
|
<action name="helpIndexAction"/>
|
||||||
|
<separator/>
|
||||||
|
<action name="helpAboutAction"/>
|
||||||
|
</item>
|
||||||
|
</menubar>
|
||||||
|
<toolbars>
|
||||||
|
</toolbars>
|
||||||
|
<actions>
|
||||||
|
<action>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>fileExitAction</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Exit</string>
|
||||||
|
</property>
|
||||||
|
<property name="menuText">
|
||||||
|
<string>E&xit</string>
|
||||||
|
</property>
|
||||||
|
<property name="accel">
|
||||||
|
<string></string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>helpContentsAction</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Contents</string>
|
||||||
|
</property>
|
||||||
|
<property name="menuText">
|
||||||
|
<string>&Contents...</string>
|
||||||
|
</property>
|
||||||
|
<property name="accel">
|
||||||
|
<string></string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>helpIndexAction</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Index</string>
|
||||||
|
</property>
|
||||||
|
<property name="menuText">
|
||||||
|
<string>&Index...</string>
|
||||||
|
</property>
|
||||||
|
<property name="accel">
|
||||||
|
<string></string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>helpAboutAction</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>About</string>
|
||||||
|
</property>
|
||||||
|
<property name="menuText">
|
||||||
|
<string>&About</string>
|
||||||
|
</property>
|
||||||
|
<property name="accel">
|
||||||
|
<string></string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
</actions>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>fileExitAction</sender>
|
||||||
|
<signal>activated()</signal>
|
||||||
|
<receiver>Form1</receiver>
|
||||||
|
<slot>fileExit()</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>helpIndexAction</sender>
|
||||||
|
<signal>activated()</signal>
|
||||||
|
<receiver>Form1</receiver>
|
||||||
|
<slot>helpIndex()</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>helpContentsAction</sender>
|
||||||
|
<signal>activated()</signal>
|
||||||
|
<receiver>Form1</receiver>
|
||||||
|
<slot>helpContents()</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>helpAboutAction</sender>
|
||||||
|
<signal>activated()</signal>
|
||||||
|
<receiver>Form1</receiver>
|
||||||
|
<slot>helpAbout()</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>resTextEdit</sender>
|
||||||
|
<signal>clicked(int,int)</signal>
|
||||||
|
<receiver>Form1</receiver>
|
||||||
|
<slot>resTextEdit_clicked(int,int)</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>resTextEdit</sender>
|
||||||
|
<signal>returnPressed()</signal>
|
||||||
|
<receiver>Form1</receiver>
|
||||||
|
<slot>resTextEdit_returnPressed()</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>fileExitAction</sender>
|
||||||
|
<signal>activated()</signal>
|
||||||
|
<receiver>Form1</receiver>
|
||||||
|
<slot>fileExit()</slot>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
<includes>
|
||||||
|
<include location="local" impldecl="in implementation">form1.ui.h</include>
|
||||||
|
</includes>
|
||||||
|
<slots>
|
||||||
|
<slot>fileExit()</slot>
|
||||||
|
<slot>helpIndex()</slot>
|
||||||
|
<slot>helpContents()</slot>
|
||||||
|
<slot>helpAbout()</slot>
|
||||||
|
<slot>resTextEdit_clicked( int par, int car )</slot>
|
||||||
|
<slot>resTextEdit_returnPressed()</slot>
|
||||||
|
</slots>
|
||||||
|
<pixmapinproject/>
|
||||||
|
<layoutdefaults spacing="6" margin="11"/>
|
||||||
|
</UI>
|
||||||
60
src/qtgui/form1.ui.h
Normal file
60
src/qtgui/form1.ui.h
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
** ui.h extension file, included from the uic-generated form implementation.
|
||||||
|
**
|
||||||
|
** If you want to add, delete, or rename functions or slots, use
|
||||||
|
** Qt Designer to update this file, preserving your code.
|
||||||
|
**
|
||||||
|
** You should not define a constructor or destructor in this file.
|
||||||
|
** Instead, write your code in functions called init() and destroy().
|
||||||
|
** These will automatically be called by the form's constructor and
|
||||||
|
** destructor.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
void Form1::fileExit()
|
||||||
|
{
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Form1::helpIndex()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Form1::helpContents()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Form1::helpAbout()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Form1::resTextEdit_clicked( int par, int car )
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Clicked at paragraph %d, char %d\n", par, car);
|
||||||
|
}
|
||||||
|
#include "qfontdialog.h"
|
||||||
|
|
||||||
|
#define BS 200000
|
||||||
|
void Form1::resTextEdit_returnPressed()
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ReturnPressed()\n");
|
||||||
|
resTextEdit->setFont( QFontDialog::getFont( 0, resTextEdit->font() ) );
|
||||||
|
const char *fname = "utf8.txt";
|
||||||
|
FILE *fp = fopen(fname, "r");
|
||||||
|
if (fp) {
|
||||||
|
char buf[BS];
|
||||||
|
memset(buf,0, sizeof(buf));
|
||||||
|
int n = fread(buf, 1, BS-1, fp);
|
||||||
|
fclose(fp);
|
||||||
|
QString str = QString::fromUtf8(buf, n);
|
||||||
|
resTextEdit->setTextFormat(RichText);
|
||||||
|
resTextEdit->setText(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
11
src/qtgui/main.cpp
Normal file
11
src/qtgui/main.cpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include <qapplication.h>
|
||||||
|
#include "form1.h"
|
||||||
|
|
||||||
|
int main( int argc, char ** argv )
|
||||||
|
{
|
||||||
|
QApplication a( argc, argv );
|
||||||
|
Form1 w;
|
||||||
|
w.show();
|
||||||
|
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
|
||||||
|
return a.exec();
|
||||||
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
CXXFLAGS = -Wall -g -I. -I../index -I../utils -I../common -I/usr/local/include
|
CXXFLAGS = -Wall -g -I. -I../index -I../utils -I../common -I/usr/local/include
|
||||||
|
|
||||||
|
|
||||||
PROGS = xadump
|
PROGS = qtry qxtry xadump
|
||||||
all: $(PROGS)
|
all: $(PROGS)
|
||||||
|
|
||||||
XADUMP_OBJS= xadump.o transcode.o
|
XADUMP_OBJS= xadump.o transcode.o
|
||||||
@ -10,8 +10,44 @@ xadump : $(XADUMP_OBJS)
|
|||||||
$(CXX) $(CXXFLAGS) -o xadump $(XADUMP_OBJS) \
|
$(CXX) $(CXXFLAGS) -o xadump $(XADUMP_OBJS) \
|
||||||
-L/usr/local/lib -lxapian -liconv
|
-L/usr/local/lib -lxapian -liconv
|
||||||
|
|
||||||
|
QXTRY_OBJS= qxtry.o transcode.o
|
||||||
|
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 : $(QTRY_OBJS)
|
||||||
|
$(CXX) $(CXXFLAGS) -o qtry $(QTRY_OBJS) \
|
||||||
|
-L/usr/local/lib -lxapian -liconv
|
||||||
|
|
||||||
transcode.o : ../index/transcode.cpp ../index/transcode.h
|
transcode.o : ../index/transcode.cpp ../index/transcode.h
|
||||||
$(CXX) $(CXXFLAGS) -c -o transcode.o ../index/transcode.cpp
|
$(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
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o $(PROGS)
|
rm -f *.o $(PROGS)
|
||||||
|
alldeps:depend
|
||||||
|
depend:
|
||||||
|
$(CXX) $(CXXFLAGS) -M *.cpp > alldeps
|
||||||
|
include alldeps
|
||||||
|
|
||||||
|
|||||||
105
src/query/qtry.cpp
Normal file
105
src/query/qtry.cpp
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
#ifndef lint
|
||||||
|
static char rcsid[] = "@(#$Id: qtry.cpp,v 1.1 2005-01-24 13:17:58 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Tests with the query interface
|
||||||
|
|
||||||
|
#include <strings.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "conftree.h"
|
||||||
|
#include "rclconfig.h"
|
||||||
|
#include "rcldb.h"
|
||||||
|
#include "transcode.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include "rcldb.h"
|
||||||
|
|
||||||
|
static string thisprog;
|
||||||
|
|
||||||
|
static string usage =
|
||||||
|
" -d <dbdir> -e <interface encoding> term [term] ..."
|
||||||
|
" \n\n"
|
||||||
|
;
|
||||||
|
|
||||||
|
static void
|
||||||
|
Usage(void)
|
||||||
|
{
|
||||||
|
cerr << thisprog << ": usage:\n" << usage;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int op_flags;
|
||||||
|
#define OPT_e 0x2
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
string encoding = "ISO8859-1";
|
||||||
|
|
||||||
|
thisprog = argv[0];
|
||||||
|
argc--; argv++;
|
||||||
|
|
||||||
|
while (argc > 0 && **argv == '-') {
|
||||||
|
(*argv)++;
|
||||||
|
if (!(**argv))
|
||||||
|
/* Cas du "adb - core" */
|
||||||
|
Usage();
|
||||||
|
while (**argv)
|
||||||
|
switch (*(*argv)++) {
|
||||||
|
case 'e': op_flags |= OPT_e; if (argc < 2) Usage();
|
||||||
|
encoding = *(++argv);
|
||||||
|
argc--;
|
||||||
|
goto b1;
|
||||||
|
default: Usage(); break;
|
||||||
|
}
|
||||||
|
b1: argc--; argv++;
|
||||||
|
}
|
||||||
|
if (argc < 1)
|
||||||
|
Usage();
|
||||||
|
|
||||||
|
RclConfig *config = new RclConfig;
|
||||||
|
|
||||||
|
if (!config->ok())
|
||||||
|
cerr << "Config could not be built" << endl;
|
||||||
|
|
||||||
|
string dbdir;
|
||||||
|
if (config->getConfParam(string("dbdir"), dbdir) == 0) {
|
||||||
|
cerr << "No database directory in configuration" << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Rcl::Db *db = new Rcl::Db;
|
||||||
|
|
||||||
|
if (!db->open(dbdir, Rcl::Db::DbRO)) {
|
||||||
|
fprintf(stderr, "Could not open database\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TOBEDONE: query syntax. Yes it's mighty stupid to cat terms.
|
||||||
|
string query;
|
||||||
|
while (argc--)
|
||||||
|
query += string(*argv++) + " " ;
|
||||||
|
db->setQuery(query);
|
||||||
|
int i = 0;
|
||||||
|
Rcl::Doc doc;
|
||||||
|
while (db->getDoc(i++, doc)) {
|
||||||
|
cout << "Url: " << doc.url << endl;
|
||||||
|
cout << "Mimetype: " << doc.mimetype << endl;
|
||||||
|
cout << "Mtime: " << doc.mtime << endl;
|
||||||
|
cout << "Origcharset: " << doc.origcharset << endl;
|
||||||
|
cout << "Title: " << doc.title << endl;
|
||||||
|
cout << "Text: " << doc.text << endl;
|
||||||
|
cout << "Keywords: " << doc.keywords << endl;
|
||||||
|
cout << "Abstract: " << doc.abstract << endl;
|
||||||
|
cout << endl;
|
||||||
|
|
||||||
|
doc.erase();
|
||||||
|
}
|
||||||
|
delete db;
|
||||||
|
cerr << "Exiting" << endl;
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
109
src/query/qxtry.cpp
Normal file
109
src/query/qxtry.cpp
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
#ifndef lint
|
||||||
|
static char rcsid[] = "@(#$Id: qxtry.cpp,v 1.1 2005-01-24 13:17:58 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
|
#endif
|
||||||
|
// Tests with direct xapian questions
|
||||||
|
|
||||||
|
#include <strings.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "transcode.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include "xapian.h"
|
||||||
|
|
||||||
|
static string thisprog;
|
||||||
|
|
||||||
|
static string usage =
|
||||||
|
" -d <dbdir> -e <interface encoding> term [term] ..."
|
||||||
|
" \n\n"
|
||||||
|
;
|
||||||
|
|
||||||
|
static void
|
||||||
|
Usage(void)
|
||||||
|
{
|
||||||
|
cerr << thisprog << ": usage:\n" << usage;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int op_flags;
|
||||||
|
#define OPT_d 0x1
|
||||||
|
#define OPT_e 0x2
|
||||||
|
|
||||||
|
Xapian::Database db;
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
string dbdir = "/home/dockes/tmp/xapiandb";
|
||||||
|
string encoding = "ISO8859-1";
|
||||||
|
|
||||||
|
thisprog = argv[0];
|
||||||
|
argc--; argv++;
|
||||||
|
|
||||||
|
while (argc > 0 && **argv == '-') {
|
||||||
|
(*argv)++;
|
||||||
|
if (!(**argv))
|
||||||
|
/* Cas du "adb - core" */
|
||||||
|
Usage();
|
||||||
|
while (**argv)
|
||||||
|
switch (*(*argv)++) {
|
||||||
|
case 'd': op_flags |= OPT_e; if (argc < 2) Usage();
|
||||||
|
dbdir = *(++argv);
|
||||||
|
argc--;
|
||||||
|
goto b1;
|
||||||
|
case 'e': op_flags |= OPT_d; if (argc < 2) Usage();
|
||||||
|
encoding = *(++argv);
|
||||||
|
argc--;
|
||||||
|
goto b1;
|
||||||
|
default: Usage(); break;
|
||||||
|
}
|
||||||
|
b1: argc--; argv++;
|
||||||
|
}
|
||||||
|
if (argc < 1)
|
||||||
|
Usage();
|
||||||
|
|
||||||
|
vector<string> qterms;
|
||||||
|
while (argc--) {
|
||||||
|
qterms.push_back(*argv++);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
db = Xapian::Auto::open(dbdir, Xapian::DB_OPEN);
|
||||||
|
|
||||||
|
cout << "DB: ndocs " << db.get_doccount() << " lastdocid " <<
|
||||||
|
db.get_lastdocid() << " avglength " << db.get_avlength() << endl;
|
||||||
|
|
||||||
|
Xapian::Enquire enquire(db);
|
||||||
|
|
||||||
|
Xapian::Query query(Xapian::Query::OP_OR, qterms.begin(),
|
||||||
|
qterms.end());
|
||||||
|
cout << "Performing query `" <<
|
||||||
|
query.get_description() << "'" << endl;
|
||||||
|
enquire.set_query(query);
|
||||||
|
|
||||||
|
Xapian::MSet matches = enquire.get_mset(0, 10);
|
||||||
|
cout << "Estimated results: " << matches.get_matches_lower_bound() <<
|
||||||
|
endl;
|
||||||
|
Xapian::MSetIterator i;
|
||||||
|
for (i = matches.begin(); i != matches.end(); ++i) {
|
||||||
|
cout << "Document ID " << *i << "\t";
|
||||||
|
cout << i.get_percent() << "% ";
|
||||||
|
Xapian::Document doc = i.get_document();
|
||||||
|
cout << "[" << doc.get_data() << "]" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (const Xapian::Error &e) {
|
||||||
|
cout << "Exception: " << e.get_msg() << endl;
|
||||||
|
} catch (const string &s) {
|
||||||
|
cout << "Exception: " << s << endl;
|
||||||
|
} catch (const char *s) {
|
||||||
|
cout << "Exception: " << s << endl;
|
||||||
|
} catch (...) {
|
||||||
|
cout << "Caught unknown exception" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.5 2004-12-17 15:50:48 dockes Exp $ (C) 2004 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.6 2005-01-24 13:17:58 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -14,18 +14,23 @@ using namespace std;
|
|||||||
#include "textsplit.h"
|
#include "textsplit.h"
|
||||||
#include "transcode.h"
|
#include "transcode.h"
|
||||||
#include "unacpp.h"
|
#include "unacpp.h"
|
||||||
|
#include "conftree.h"
|
||||||
|
|
||||||
#include "xapian.h"
|
#include "xapian.h"
|
||||||
|
|
||||||
// Data for a xapian database
|
// Data for a xapian database. There could actually be 2 different ones for
|
||||||
|
// indexing or query as there is not much in common.
|
||||||
class Native {
|
class Native {
|
||||||
public:
|
public:
|
||||||
bool isopen;
|
bool isopen;
|
||||||
bool iswritable;
|
bool iswritable;
|
||||||
class Xapian::Database db;
|
// Indexing
|
||||||
class Xapian::WritableDatabase wdb;
|
Xapian::WritableDatabase wdb;
|
||||||
vector<bool> updated;
|
vector<bool> updated;
|
||||||
|
|
||||||
|
// Querying
|
||||||
|
Xapian::Database db;
|
||||||
|
Xapian::Query query;
|
||||||
Native() : isopen(false), iswritable(false) {}
|
Native() : isopen(false), iswritable(false) {}
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -37,6 +42,7 @@ Rcl::Db::Db()
|
|||||||
|
|
||||||
Rcl::Db::~Db()
|
Rcl::Db::~Db()
|
||||||
{
|
{
|
||||||
|
cerr << "Rcl::Db::~Db" << endl;
|
||||||
if (pdata == 0)
|
if (pdata == 0)
|
||||||
return;
|
return;
|
||||||
Native *ndb = (Native *)pdata;
|
Native *ndb = (Native *)pdata;
|
||||||
@ -45,6 +51,7 @@ Rcl::Db::~Db()
|
|||||||
try {
|
try {
|
||||||
// There is nothing to do for an ro db.
|
// There is nothing to do for an ro db.
|
||||||
if (ndb->isopen == false || ndb->iswritable == false) {
|
if (ndb->isopen == false || ndb->iswritable == false) {
|
||||||
|
cerr << "Deleting native database" << endl;
|
||||||
delete ndb;
|
delete ndb;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -82,8 +89,8 @@ bool Rcl::Db::open(const string& dir, OpenMode mode)
|
|||||||
case DbRO:
|
case DbRO:
|
||||||
default:
|
default:
|
||||||
ndb->iswritable = false;
|
ndb->iswritable = false;
|
||||||
cerr << "Not ready to open RO yet" << endl;
|
ndb->db = Xapian::Auto::open(dir, Xapian::DB_OPEN);
|
||||||
exit(1);
|
break;
|
||||||
}
|
}
|
||||||
ndb->isopen = true;
|
ndb->isopen = true;
|
||||||
return true;
|
return true;
|
||||||
@ -142,7 +149,8 @@ class wsData {
|
|||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool splitCb(void *cdata, const std::string &term, int pos)
|
// Callback for the document to word splitting class during indexation
|
||||||
|
static bool splitCb(void *cdata, const std::string &term, int pos)
|
||||||
{
|
{
|
||||||
wsData *data = (wsData*)cdata;
|
wsData *data = (wsData*)cdata;
|
||||||
|
|
||||||
@ -172,7 +180,7 @@ bool dumb_string(const string &in, string &out)
|
|||||||
out.erase();
|
out.erase();
|
||||||
if (!unac_cpp(in, inter))
|
if (!unac_cpp(in, inter))
|
||||||
return false;
|
return false;
|
||||||
out.resize(inter.length());
|
out.reserve(inter.length());
|
||||||
for (unsigned int i = 0; i < inter.length(); i++) {
|
for (unsigned int i = 0; i < inter.length(); i++) {
|
||||||
if (inter[i] >= 'A' && inter[i] <= 'Z')
|
if (inter[i] >= 'A' && inter[i] <= 'Z')
|
||||||
out += inter[i] + 'a' - 'A';
|
out += inter[i] + 'a' - 'A';
|
||||||
@ -239,8 +247,10 @@ bool Rcl::Db::add(const string &fn, const Rcl::Doc &doc)
|
|||||||
// If this document has already been indexed, update the existing
|
// If this document has already been indexed, update the existing
|
||||||
// entry.
|
// entry.
|
||||||
try {
|
try {
|
||||||
Xapian::docid did = ndb->wdb.replace_document(pathterm,
|
#if 0
|
||||||
newdocument);
|
Xapian::docid did =
|
||||||
|
#endif
|
||||||
|
ndb->wdb.replace_document(pathterm, newdocument);
|
||||||
#if 0
|
#if 0
|
||||||
if (did < updated.size()) {
|
if (did < updated.size()) {
|
||||||
updated[did] = true;
|
updated[did] = true;
|
||||||
@ -297,3 +307,73 @@ bool Rcl::Db::needUpdate(const string &filename, const struct stat *stp)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class wsQData {
|
||||||
|
public:
|
||||||
|
vector<string> terms;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Callback for the document to word splitting class during indexation
|
||||||
|
static bool splitQCb(void *cdata, const std::string &term, int )
|
||||||
|
{
|
||||||
|
wsQData *data = (wsQData*)cdata;
|
||||||
|
|
||||||
|
cerr << "splitQCb: term '" << term << "'" << endl;
|
||||||
|
cerr << "splitQCb: term length: " << term.length() << endl;
|
||||||
|
//string printable;
|
||||||
|
//transcode(term, printable, "UTF-8", "ISO8859-1");
|
||||||
|
//cerr << "Adding " << printable << endl;
|
||||||
|
|
||||||
|
data->terms.push_back(term);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Rcl::Db::setQuery(const std::string &querystring)
|
||||||
|
{
|
||||||
|
wsQData splitData;
|
||||||
|
TextSplit splitter(splitQCb, &splitData);
|
||||||
|
|
||||||
|
string noacc;
|
||||||
|
if (!dumb_string(querystring, noacc)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// noacc = querystring;
|
||||||
|
splitter.text_to_words(noacc);
|
||||||
|
|
||||||
|
Native *ndb = (Native *)pdata;
|
||||||
|
|
||||||
|
// splitData.terms.resize(0);
|
||||||
|
// splitData.terms.push_back(string("le"));
|
||||||
|
ndb->query = Xapian::Query(Xapian::Query::OP_OR, splitData.terms.begin(),
|
||||||
|
splitData.terms.end());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Rcl::Db::getDoc(int i, Doc &doc)
|
||||||
|
{
|
||||||
|
// cerr << "Rcl::Db::getDoc: " << i << endl;
|
||||||
|
Native *ndb = (Native *)pdata;
|
||||||
|
|
||||||
|
Xapian::Enquire enquire(ndb->db);
|
||||||
|
enquire.set_query(ndb->query);
|
||||||
|
Xapian::MSet matches = enquire.get_mset(i, 1);
|
||||||
|
|
||||||
|
// cerr << "Query `" << ndb->query.get_description() << "'" <<
|
||||||
|
// "Estimated results: " << matches.get_matches_lower_bound() << endl;
|
||||||
|
|
||||||
|
if (matches.empty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Xapian::Document xdoc = matches.begin().get_document();
|
||||||
|
|
||||||
|
// Parse xapian document's data and populate doc fields
|
||||||
|
string data = xdoc.get_data();
|
||||||
|
ConfSimple parms(&data);
|
||||||
|
parms.get(string("mtype"), doc.mimetype);
|
||||||
|
parms.get(string("mtime"), doc.mtime);
|
||||||
|
parms.get(string("url"), doc.url);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@ -1,9 +1,22 @@
|
|||||||
#ifndef _DB_H_INCLUDED_
|
#ifndef _DB_H_INCLUDED_
|
||||||
#define _DB_H_INCLUDED_
|
#define _DB_H_INCLUDED_
|
||||||
/* @(#$Id: rcldb.h,v 1.3 2004-12-17 13:01:01 dockes Exp $ (C) 2004 J.F.Dockes */
|
/* @(#$Id: rcldb.h,v 1.4 2005-01-24 13:17:58 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
// rcldb defines an interface for a 'real' text database. The current
|
||||||
|
// implementation uses xapian only, and xapian-related code is in rcldb.cpp
|
||||||
|
// If support was added for other backend, the xapian code would be moved in
|
||||||
|
// rclxapian.cpp, another file would be created for the new backend, and the
|
||||||
|
// configuration/compile/link code would be adjusted to allow choosing. There
|
||||||
|
// is no plan for supporting multiple different backends.
|
||||||
|
//
|
||||||
|
// In no case does this try to implement a useful virtualized text-db interface
|
||||||
|
// The main goal is simplicity and good matching to usage inside the recoll
|
||||||
|
// user interface. In other words, this is not exhaustive or well-designed or
|
||||||
|
// reusable.
|
||||||
|
|
||||||
|
|
||||||
struct stat;
|
struct stat;
|
||||||
|
|
||||||
namespace Rcl {
|
namespace Rcl {
|
||||||
@ -13,6 +26,7 @@ namespace Rcl {
|
|||||||
*/
|
*/
|
||||||
class Doc {
|
class Doc {
|
||||||
public:
|
public:
|
||||||
|
string url;
|
||||||
string mimetype;
|
string mimetype;
|
||||||
string mtime; // Modification time as decimal ascii
|
string mtime; // Modification time as decimal ascii
|
||||||
string origcharset;
|
string origcharset;
|
||||||
@ -20,6 +34,16 @@ class Doc {
|
|||||||
string text;
|
string text;
|
||||||
string keywords;
|
string keywords;
|
||||||
string abstract;
|
string abstract;
|
||||||
|
void erase() {
|
||||||
|
url.erase();
|
||||||
|
mimetype.erase();
|
||||||
|
mtime.erase();
|
||||||
|
origcharset.erase();
|
||||||
|
title.erase();
|
||||||
|
text.erase();
|
||||||
|
keywords.erase();
|
||||||
|
abstract.erase();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,14 +51,27 @@ class Doc {
|
|||||||
*/
|
*/
|
||||||
class Db {
|
class Db {
|
||||||
void *pdata;
|
void *pdata;
|
||||||
|
Doc curdoc;
|
||||||
public:
|
public:
|
||||||
Db();
|
Db();
|
||||||
~Db();
|
~Db();
|
||||||
enum OpenMode {DbRO, DbUpd, DbTrunc};
|
enum OpenMode {DbRO, DbUpd, DbTrunc};
|
||||||
bool open(const std::string &dbdir, OpenMode mode);
|
bool open(const std::string &dbdir, OpenMode mode);
|
||||||
bool close();
|
bool close();
|
||||||
|
|
||||||
|
// Update-related functions
|
||||||
bool add(const string &filename, const Doc &doc);
|
bool add(const string &filename, const Doc &doc);
|
||||||
bool needUpdate(const string &filename, const struct stat *stp);
|
bool needUpdate(const string &filename, const struct stat *stp);
|
||||||
|
|
||||||
|
// Query-related functions
|
||||||
|
|
||||||
|
// Parse query string and initialize query
|
||||||
|
bool setQuery(const std::string &q);
|
||||||
|
|
||||||
|
// Get document at rank i. This is probably vastly inferior to the type
|
||||||
|
// of interface in Xapian, but we have to start with something simple
|
||||||
|
// to experiment with the GUI
|
||||||
|
bool getDoc(int i, Doc &doc);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
23
src/utils/Makefile
Normal file
23
src/utils/Makefile
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
CXXFLAGS = -I.
|
||||||
|
|
||||||
|
PROGS = trfstreewalk pathut execmd
|
||||||
|
all: $(PROGS)
|
||||||
|
|
||||||
|
FSTREEWALK_OBJS= trfstreewalk.o fstreewalk.o pathut.o
|
||||||
|
trfstreewalk : $(FSTREEWALK_OBJS)
|
||||||
|
$(CXX) -o trfstreewalk $(FSTREEWALK_OBJS)
|
||||||
|
trfstreewalk.o : fstreewalk.cpp fstreewalk.h
|
||||||
|
$(CXX) -o trfstreewalk.o -c $(CXXFLAGS) \
|
||||||
|
-DTEST_FSTREEWALK fstreewalk.cpp
|
||||||
|
PATHUT_OBJS= trpathut.o pathut.o
|
||||||
|
trpathut : $(PATHUT_OBJS)
|
||||||
|
$(CXX) -o trpathut $(PATHUT_OBJS)
|
||||||
|
trpathut.o : pathut.cpp pathut.h
|
||||||
|
$(CXX) -o trpathut.o -c $(CXXFLAGS) \
|
||||||
|
-DTEST_PATHUT pathut.cpp
|
||||||
|
execmd: pathut.o
|
||||||
|
$(CXX) -o execmd $(CXXFLAGS) execmd.cpp pathut.o
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o $(PROGS)
|
||||||
Loading…
x
Reference in New Issue
Block a user