Hi, I've a problem to integrate xapian in my web application. I've
developed the code for index e for search the documents published through my
application.
The app is developed in PHP. I've created a file that contain some function
for search (called simpleSearch and advSearch).
The problem is that if i run the code through the IDE (Zend for Eclipse) as PHP
script it work correctly, but when i run the code as php page I receive the
error message: DatabaseOpeningError: Couldn't detect type of database. The
code is the same but runned in two different modality didn't work.
To test my page in local I use EasyPhp, I've loaded the php_xapian.dll
extension and the problem remains. Why?
all the file and dir: search.php, search_function.inc, xapian_db are in the same
dir
1) This is the code of search page
if(isset($_GET['query'])){
$query = $_GET['query'];
require_once 'search_function.inc';
simpleSearch($query,"xapian_db"); --> xapian_db is the path where
is stored xapian db
}
2) This is the code of search function.inc
<?php
require_once 'xapian.php';
function simpleSearch($query,$path){
try {
$database = new XapianDatabase($path);
$enquire = new XapianEnquire($database);
$qp = new XapianQueryParser();
$stemmer = new XapianStem("italian");
$qp->set_stemmer($stemmer);
$qp->set_database($database);
$qp->set_stemming_strategy(XapianQueryParser::STEM_SOME);
$query = $qp->parse_query($query);
echo "<br>Parsed query is:
{$query->get_description()}\n";
$enquire->set_query($query);
$matches = $enquire->get_mset(0, 10);
......
?>
3) To test the code as php script --> As php script it work as php page not
work
<?php
require_once 'search_function.inc';
simpleSearch("hello","xapian_db");
?>