0

Ok, so here's the deal: Lucene does the weirdes things to me. Everything is indexed properly, everything works, everything's fast etc etc.

So I search for a category in English. Hundreds of results pop out.

So I search for a country in English. Hundred of results pop out.

So I search for a category AND a country in English. A combination that I KNOW is valid. I get jack. Nothing. Zip.... Why?

Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive());
$index = Library_Search_Lucene::open(SearchIndexer::getIndexDirectory());     

$query = new Zend_Search_Lucene_Search_Query_Boolean();

$queryString = new Zend_Search_Lucene_Search_Query_MultiTerm();
$queryString->addTerm(new Zend_Search_Lucene_Index_Term('lang' . $language, 'langSite'));
$query->addSubquery($queryString, true);

if (isset($idCategory)) {
$queryCategory = new Zend_Search_Lucene_Search_Query_MultiTerm();
$queryCategory->addTerm(new Zend_Search_Lucene_Index_Term($idCategory, 'idCategory'));
$query->addSubquery($queryCategory, true);
}

if (isset($country)) {
$queryLocation = new Zend_Search_Lucene_Search_Query_MultiTerm();
$queryLocation->addTerm(new Zend_Search_Lucene_Index_Term($country, 'locationsClean'));
$query->addSubquery($queryLocation, true);
}

 $hits = $index->find($query);

$query->getQueryTerms() returns a valid array of terms. There are no errors. What the hell am I doing wrong?

John
  • 261
  • 1
  • 3
  • 16

1 Answers1

0

We have exactly the same problem. It is noted in the bugtracker, which is currently offline, but can be found at http://www.zendframework.com/issues. Maybe it will ever get fixed, but even then it is painfully slow.

Matthijs Bierman
  • 1,720
  • 9
  • 14
  • My suggestion is to drop Lucene alltogether. I have never worked with a slower engine. I can just as like do fulltext searches in mysql or in coma-separated txt files. – John Jan 26 '10 at 10:26
  • Be careful: Lucene is great, it's Zend_Search_Lucene that is crap. I work with the Java implementation a lot and I can tell you it's rock-stable and blazing fast! – Matthijs Bierman Jan 27 '10 at 15:01