import
[web.mtrack] / inc / lib / Zend / Search / Lucene / Search / Query / Insignificant.php
1 <?php
2 /**
3  * Zend Framework
4  *
5  * LICENSE
6  *
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.
14  *
15  * @category   Zend
16  * @package    Zend_Search_Lucene
17  * @subpackage Search
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 $
21  */
22
23
24 /** Zend_Search_Lucene_Search_Query */
25 require_once 'Zend/Search/Lucene/Search/Query.php';
26
27 /** Zend_Search_Lucene_Search_Weight_Empty */
28 require_once 'Zend/Search/Lucene/Search/Weight/Empty.php';
29
30
31 /**
32  * The insignificant query returns empty result, but doesn't limit result set as a part of other queries
33  *
34  * @category   Zend
35  * @package    Zend_Search_Lucene
36  * @subpackage Search
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
39  */
40 class Zend_Search_Lucene_Search_Query_Insignificant extends Zend_Search_Lucene_Search_Query
41 {
42     /**
43      * Re-write query into primitive queries in the context of specified index
44      *
45      * @param Zend_Search_Lucene_Interface $index
46      * @return Zend_Search_Lucene_Search_Query
47      */
48     public function rewrite(Zend_Search_Lucene_Interface $index)
49     {
50         return $this;
51     }
52
53     /**
54      * Optimize query in the context of specified index
55      *
56      * @param Zend_Search_Lucene_Interface $index
57      * @return Zend_Search_Lucene_Search_Query
58      */
59     public function optimize(Zend_Search_Lucene_Interface $index)
60     {
61         return $this;
62     }
63
64     /**
65      * Constructs an appropriate Weight implementation for this query.
66      *
67      * @param Zend_Search_Lucene_Interface $reader
68      * @return Zend_Search_Lucene_Search_Weight
69      */
70     public function createWeight(Zend_Search_Lucene_Interface $reader)
71     {
72         return new Zend_Search_Lucene_Search_Weight_Empty();
73     }
74
75     /**
76      * Execute query in context of index reader
77      * It also initializes necessary internal structures
78      *
79      * @param Zend_Search_Lucene_Interface $reader
80      * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter
81      */
82     public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null)
83     {
84         // Do nothing
85     }
86
87     /**
88      * Get document ids likely matching the query
89      *
90      * It's an array with document ids as keys (performance considerations)
91      *
92      * @return array
93      */
94     public function matchedDocs()
95     {
96         return array();
97     }
98
99     /**
100      * Score specified document
101      *
102      * @param integer $docId
103      * @param Zend_Search_Lucene_Interface $reader
104      * @return float
105      */
106     public function score($docId, Zend_Search_Lucene_Interface $reader)
107     {
108         return 0;
109     }
110
111     /**
112      * Return query terms
113      *
114      * @return array
115      */
116     public function getQueryTerms()
117     {
118         return array();
119     }
120
121     /**
122      * Query specific matches highlighting
123      *
124      * @param Zend_Search_Lucene_Search_Highlighter_Interface $highlighter  Highlighter object (also contains doc for highlighting)
125      */
126     protected function _highlightMatches(Zend_Search_Lucene_Search_Highlighter_Interface $highlighter)
127     {
128         // Do nothing
129     }
130
131     /**
132      * Print a query
133      *
134      * @return string
135      */
136     public function __toString()
137     {
138         return '<InsignificantQuery>';
139     }
140 }
141