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: Insignificant.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';
32 * The insignificant query returns empty result, but doesn't limit result set as a part of other queries
35 * @package Zend_Search_Lucene
37 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
38 * @license http://framework.zend.com/license/new-bsd New BSD License
40 class Zend_Search_Lucene_Search_Query_Insignificant extends Zend_Search_Lucene_Search_Query
43 * Re-write query into primitive queries in the context of specified index
45 * @param Zend_Search_Lucene_Interface $index
46 * @return Zend_Search_Lucene_Search_Query
48 public function rewrite(Zend_Search_Lucene_Interface $index)
54 * Optimize query in the context of specified index
56 * @param Zend_Search_Lucene_Interface $index
57 * @return Zend_Search_Lucene_Search_Query
59 public function optimize(Zend_Search_Lucene_Interface $index)
65 * Constructs an appropriate Weight implementation for this query.
67 * @param Zend_Search_Lucene_Interface $reader
68 * @return Zend_Search_Lucene_Search_Weight
70 public function createWeight(Zend_Search_Lucene_Interface $reader)
72 return new Zend_Search_Lucene_Search_Weight_Empty();
76 * Execute query in context of index reader
77 * It also initializes necessary internal structures
79 * @param Zend_Search_Lucene_Interface $reader
80 * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter
82 public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null)
88 * Get document ids likely matching the query
90 * It's an array with document ids as keys (performance considerations)
94 public function matchedDocs()
100 * Score specified document
102 * @param integer $docId
103 * @param Zend_Search_Lucene_Interface $reader
106 public function score($docId, Zend_Search_Lucene_Interface $reader)
116 public function getQueryTerms()
122 * Query specific matches highlighting
124 * @param Zend_Search_Lucene_Search_Highlighter_Interface $highlighter Highlighter object (also contains doc for highlighting)
126 protected function _highlightMatches(Zend_Search_Lucene_Search_Highlighter_Interface $highlighter)
136 public function __toString()
138 return '<InsignificantQuery>';