PHP extension by Wenqiang Song : make ready for external use.

- added minimal doc
- fixed build script to work around php/libtool issue
- have the module default to Query Language (instead of AND)
This commit is contained in:
Jean-Francois Dockes 2010-01-29 15:47:02 +01:00
parent f613f8a32e
commit 7ef5e08f70
3 changed files with 33 additions and 16 deletions

20
src/php/00README.txt Normal file
View File

@ -0,0 +1,20 @@
Recoll PHP extension:
Author: Wenqiang Song (wsong.cn, google mail)
This has minimum features for now.
The sample/ subdirectory has a minimal script which demonstrates the
interface.
Building the extension needs the librcl.a library (recoll-xxx/lib/librcl.a)
to have been built with PIC objects. This will be handled by the Recoll
build system in the future, but, for now, if using gcc, just add -fPIC
-DPIC to LOCALCXXFLAGS inside mk/localdefs, and run "make clean;make" inside
lib/ . For other compilers, adjust to taste :)
The recoll/ subdirectory has the C++ code and the build script
(make.sh). You'll need to "make install" after building.
If you want to clean up the recoll/ directory, you can run phpize --clean
in there.

View File

@ -1,7 +1,14 @@
#!/bin/sh
phpize --clean
phpize
rm aclocal.m4 -rf
autoreconf
# The version of libtool shipped with php at this time (2010-01-29)
# is buggy (ECHO/echo typo...)
# autoreconf -i should replace them with the system versions
# Another approach would be to ship an autoconf'd version to avoid
# needing autotools on the target compile system. What a mess.
rm -f ltmain.sh libtool
rm -f aclocal.m4
autoreconf -i
./configure --enable-recoll
make -j3

View File

@ -122,20 +122,10 @@ PHP_METHOD(Query, query)
pRclDb->setAbstractParams(-1, maxchars, ctxwords);
Rcl::SearchData *sd = 0;
sd = new Rcl::SearchData(Rcl::SCLT_AND);
Rcl::SearchDataClause *clp = 0;
// If there is no white space inside the query, then the user
// certainly means it as a phrase.
bool isreallyaphrase = false;
if (!TextSplit::hasVisibleWhite(qs))
isreallyaphrase = true;
clp = isreallyaphrase ?
new Rcl::SearchDataClauseDist(Rcl::SCLT_PHRASE, qs, 0) :
new Rcl::SearchDataClauseSimple(Rcl::SCLT_AND, qs);
if (sd)
sd->addClause(clp);
// jf: the original implementation built an AND clause. It would
// be nice to offer an option, but the next best thing is to
// default to the query language
sd = wasaStringToRcl(qs, reason);
if (!sd) {
cerr << "Query string interpretation failed: " << reason << endl;