[Xapian-discuss] Xapian DatabaseError

Senior Boss seniorboss at hotmail.it
Mon Aug 17 18:55:07 BST 2009

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

  $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
require_once 'xapian.php';
function simpleSearch($query,$path){
try {
    $database = new XapianDatabase($path);
    $enquire = new XapianEnquire($database);
     $qp = new XapianQueryParser();
     $stemmer = new XapianStem("italian");
     $query = $qp->parse_query($query);
    echo "<br>Parsed query is: {$query->get_description()}\n";
    $matches = $enquire->get_mset(0, 10);


3) To test the code as php script --> As php script it work as php page not work
require_once 'search_function.inc';

More information about the Xapian-discuss mailing list