sareha
2008-04-23 07:15:51 UTC
Hi,
I am new to zend lucene framework .. I don't know how to use term query
along with range query. For example i want to display the businesses in
'london' with category 'healthcare' created between 'date 1' and 'date 2'.
How can I combine the different tyes of queries. I'm using zend 1.5.0.
The following queries are working: When used seperately
$query = 'category:healthcare AND location:london';
Zend_Search_Lucene_Search_QueryParser::setDefaultOperator(1);
$userQuery = Zend_Search_Lucene_Search_QueryParser::parse($query);
$results = $index->find($userQuery);
-----------------------------------------------------------------------------------------------------------------------
$userQuery = new Zend_Search_Lucene_Search_Query_MultiTerm();
$userQuery->addTerm(new Zend_Search_Lucene_Index_Term('london',
'location'), true);
$userQuery->addTerm(new Zend_Search_Lucene_Index_Term('healthcare',
'category'), true);
$results = $index->find($userQuery);
--------------------------------------------------------------------------------------------------------------------------
$from = new Zend_Search_Lucene_Index_Term('2008-03-13', 'created');
$to = new Zend_Search_Lucene_Index_Term('2008-03-15', 'created');
$userQuery = new Zend_Search_Lucene_Search_Query_Range($from, $to, true
);
$results = $index->find($userQuery);
Is there a way to combine these and build a single $userQuery? Can
someone send me an example to combine different queries? Please help me to
solve this problem.:-(:-((
Thanks,
Sareha.
I am new to zend lucene framework .. I don't know how to use term query
along with range query. For example i want to display the businesses in
'london' with category 'healthcare' created between 'date 1' and 'date 2'.
How can I combine the different tyes of queries. I'm using zend 1.5.0.
The following queries are working: When used seperately
$query = 'category:healthcare AND location:london';
Zend_Search_Lucene_Search_QueryParser::setDefaultOperator(1);
$userQuery = Zend_Search_Lucene_Search_QueryParser::parse($query);
$results = $index->find($userQuery);
-----------------------------------------------------------------------------------------------------------------------
$userQuery = new Zend_Search_Lucene_Search_Query_MultiTerm();
$userQuery->addTerm(new Zend_Search_Lucene_Index_Term('london',
'location'), true);
$userQuery->addTerm(new Zend_Search_Lucene_Index_Term('healthcare',
'category'), true);
$results = $index->find($userQuery);
--------------------------------------------------------------------------------------------------------------------------
$from = new Zend_Search_Lucene_Index_Term('2008-03-13', 'created');
$to = new Zend_Search_Lucene_Index_Term('2008-03-15', 'created');
$userQuery = new Zend_Search_Lucene_Search_Query_Range($from, $to, true
);
$results = $index->find($userQuery);
Is there a way to combine these and build a single $userQuery? Can
someone send me an example to combine different queries? Please help me to
solve this problem.:-(:-((
Thanks,
Sareha.
--
View this message in context: http://www.nabble.com/Zend_Lucene_Search-tp16832737p16832737.html
Sent from the Zend MFS mailing list archive at Nabble.com.
View this message in context: http://www.nabble.com/Zend_Lucene_Search-tp16832737p16832737.html
Sent from the Zend MFS mailing list archive at Nabble.com.