views:

111

answers:

2

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?

A: 

I'm experiencing something similar, did you ever figure it out?

Arron
No. After all I went through I can just sum it up as following: Lucene is shit. Period. I would not recommend Lucene to my enemies. It is cumbersome, slow and painful to reindex. Switch to Sphinx right now, preferably yesterday.
John
A: 

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
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
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