PageRenderTime 69ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/vendor/Zend/Search/Lucene/Search/Query/Insignificant.php

https://bitbucket.org/anycode/sfluceneplugin
PHP | 139 lines | 40 code | 13 blank | 86 comment | 0 complexity | c81b808e06867d562ca3b5f136ef7499 MD5 | raw file
Possible License(s): BSD-3-Clause
  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-2010 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 20096 2010-01-06 02:05:09Z bkarwin $
  21. */
  22. /** Zend_Search_Lucene_Search_Query */
  23. require_once 'Zend/Search/Lucene/Search/Query.php';
  24. /**
  25. * The insignificant query returns empty result, but doesn't limit result set as a part of other queries
  26. *
  27. * @category Zend
  28. * @package Zend_Search_Lucene
  29. * @subpackage Search
  30. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  31. * @license http://framework.zend.com/license/new-bsd New BSD License
  32. */
  33. class Zend_Search_Lucene_Search_Query_Insignificant extends Zend_Search_Lucene_Search_Query
  34. {
  35. /**
  36. * Re-write query into primitive queries in the context of specified index
  37. *
  38. * @param Zend_Search_Lucene_Interface $index
  39. * @return Zend_Search_Lucene_Search_Query
  40. */
  41. public function rewrite(Zend_Search_Lucene_Interface $index)
  42. {
  43. return $this;
  44. }
  45. /**
  46. * Optimize query in the context of specified index
  47. *
  48. * @param Zend_Search_Lucene_Interface $index
  49. * @return Zend_Search_Lucene_Search_Query
  50. */
  51. public function optimize(Zend_Search_Lucene_Interface $index)
  52. {
  53. return $this;
  54. }
  55. /**
  56. * Constructs an appropriate Weight implementation for this query.
  57. *
  58. * @param Zend_Search_Lucene_Interface $reader
  59. * @return Zend_Search_Lucene_Search_Weight
  60. */
  61. public function createWeight(Zend_Search_Lucene_Interface $reader)
  62. {
  63. require_once 'Zend/Search/Lucene/Search/Weight/Empty.php';
  64. return new Zend_Search_Lucene_Search_Weight_Empty();
  65. }
  66. /**
  67. * Execute query in context of index reader
  68. * It also initializes necessary internal structures
  69. *
  70. * @param Zend_Search_Lucene_Interface $reader
  71. * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter
  72. */
  73. public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null)
  74. {
  75. // Do nothing
  76. }
  77. /**
  78. * Get document ids likely matching the query
  79. *
  80. * It's an array with document ids as keys (performance considerations)
  81. *
  82. * @return array
  83. */
  84. public function matchedDocs()
  85. {
  86. return array();
  87. }
  88. /**
  89. * Score specified document
  90. *
  91. * @param integer $docId
  92. * @param Zend_Search_Lucene_Interface $reader
  93. * @return float
  94. */
  95. public function score($docId, Zend_Search_Lucene_Interface $reader)
  96. {
  97. return 0;
  98. }
  99. /**
  100. * Return query terms
  101. *
  102. * @return array
  103. */
  104. public function getQueryTerms()
  105. {
  106. return array();
  107. }
  108. /**
  109. * Query specific matches highlighting
  110. *
  111. * @param Zend_Search_Lucene_Search_Highlighter_Interface $highlighter Highlighter object (also contains doc for highlighting)
  112. */
  113. protected function _highlightMatches(Zend_Search_Lucene_Search_Highlighter_Interface $highlighter)
  114. {
  115. // Do nothing
  116. }
  117. /**
  118. * Print a query
  119. *
  120. * @return string
  121. */
  122. public function __toString()
  123. {
  124. return '<InsignificantQuery>';
  125. }
  126. }