Hi everyone,

I am having a really strange issue and was wondering if anyone could help me
figure out what is going on. I am trying to do a range query of a Lucene
index built using Zend_Search_Lucene. The problem is that for some reason,
it only comes back with results for the min value of the range. Meaning, if
I search for values between 200,000 and 300,000, it will only give me
results that have 200,000 as the value. It is the same exact results given
if I just search using a term for 200,000. I really don't understand what is
going on and have been pulling my hair for a few days now.

Here is what I am testing with to figure out the issue:

   1. $index = Zend_Search_Lucene::open(dirname <http://www.php.net/dirname>
   (__FILE__) . '/system/modules/searchlucene/indexes/mls-search');
   2.
   3. $query = new Zend_Search_Lucene_Search_Query_Boolean();
   4.
   5. $query->addSubquery(new Zend_Search_Lucene_Search_Query_Range(
   6.     new Zend_Search_Lucene_Index_Term('150000', 'sale_price'),
   7.     new Zend_search_LUcene_Index_Term('200000', 'sale_price'),
   8.     true
   9. ), true);
   10.
   11. $hits = $index->find(
   12.     $query
   13. );
   14.
   15. echo <http://www.php.net/echo> count <http://www.php.net/count>($hits
   ) . "\n";
   16.
   17. foreach ($hits as $hit)
   18. {
   19.     echo <http://www.php.net/echo> 'HIT: ';
   20.     echo <http://www.php.net/echo> "\t" . 'Title: ' . $hit->title . '
   ';
   21.     echo <http://www.php.net/echo> "\t" . 'City: ' . $hit->city . ' '
   ;
   22.     echo <http://www.php.net/echo> "\t" . 'Sales Price: ' . $hit->
   sale_price . ' ';
   23.     echo <http://www.php.net/echo> "\n";
   24. }

Is there something I am doing wrong? I am using a boolean query because I
was testing with multiple results, but have removed them to test just this
query. I get the same results if I only use the range query.

Thank you for your time, and appreciate any input you can provide.

Jamal Fanaian

Reply via email to