7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
16 * @package Zend_Search_Lucene
18 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: Empty.php 16971 2009-07-22 18:05:45Z mikaelkael $
24 /** Zend_Search_Lucene_Search_Query */
25 require_once 'Zend/Search/Lucene/Search/Query.php';
27 /** Zend_Search_Lucene_Search_Weight_Empty */
28 require_once 'Zend/Search/Lucene/Search/Weight/Empty.php';
33 * @package Zend_Search_Lucene
35 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
36 * @license http://framework.zend.com/license/new-bsd New BSD License
38 class Zend_Search_Lucene_Search_Query_Empty extends Zend_Search_Lucene_Search_Query
41 * Re-write query into primitive queries in the context of specified index
43 * @param Zend_Search_Lucene_Interface $index
44 * @return Zend_Search_Lucene_Search_Query
46 public function rewrite(Zend_Search_Lucene_Interface $index)
52 * Optimize query in the context of specified index
54 * @param Zend_Search_Lucene_Interface $index
55 * @return Zend_Search_Lucene_Search_Query
57 public function optimize(Zend_Search_Lucene_Interface $index)
59 // "Empty" query is a primitive query and don't need to be optimized
64 * Constructs an appropriate Weight implementation for this query.
66 * @param Zend_Search_Lucene_Interface $reader
67 * @return Zend_Search_Lucene_Search_Weight
69 public function createWeight(Zend_Search_Lucene_Interface $reader)
71 return new Zend_Search_Lucene_Search_Weight_Empty();
75 * Execute query in context of index reader
76 * It also initializes necessary internal structures
78 * @param Zend_Search_Lucene_Interface $reader
79 * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter
81 public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null)
87 * Get document ids likely matching the query
89 * It's an array with document ids as keys (performance considerations)
93 public function matchedDocs()
99 * Score specified document
101 * @param integer $docId
102 * @param Zend_Search_Lucene_Interface $reader
105 public function score($docId, Zend_Search_Lucene_Interface $reader)
115 public function getQueryTerms()
121 * Query specific matches highlighting
123 * @param Zend_Search_Lucene_Search_Highlighter_Interface $highlighter Highlighter object (also contains doc for highlighting)
125 protected function _highlightMatches(Zend_Search_Lucene_Search_Highlighter_Interface $highlighter)
135 public function __toString()
137 return '<EmptyQuery>';