本文整理汇总了PHP中Zend_Search_Lucene_Search_Query_Term::__toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Search_Lucene_Search_Query_Term::__toString方法的具体用法?PHP Zend_Search_Lucene_Search_Query_Term::__toString怎么用?PHP Zend_Search_Lucene_Search_Query_Term::__toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Search_Lucene_Search_Query_Term
的用法示例。
在下文中一共展示了Zend_Search_Lucene_Search_Query_Term::__toString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _queryToString
private function _queryToString($po_parsed_query)
{
switch (get_class($po_parsed_query)) {
case 'Zend_Search_Lucene_Search_Query_Boolean':
$va_items = $po_parsed_query->getSubqueries();
$va_signs = $po_parsed_query->getSigns();
break;
case 'Zend_Search_Lucene_Search_Query_MultiTerm':
$va_items = $po_parsed_query->getTerms();
$va_signs = $po_parsed_query->getSigns();
break;
case 'Zend_Search_Lucene_Search_Query_Phrase':
//$va_items = $po_parsed_query->getTerms();
$va_items = $po_parsed_query;
$va_signs = null;
break;
case 'Zend_Search_Lucene_Search_Query_Range':
$va_items = $po_parsed_query;
$va_signs = null;
break;
default:
$va_items = array();
$va_signs = null;
break;
}
$vs_query = '';
foreach ($va_items as $id => $subquery) {
if ($id != 0) {
$vs_query .= ' ';
}
if (($va_signs === null || $va_signs[$id] === true) && $id) {
$vs_query .= ' AND ';
} else {
if ($va_signs[$id] === false && $id) {
$vs_query .= ' NOT ';
} else {
if ($id) {
$vs_query .= ' OR ';
}
}
}
switch (get_class($subquery)) {
case 'Zend_Search_Lucene_Search_Query_Phrase':
$vs_query .= '(' . $subquery->__toString() . ')';
break;
case 'Zend_Search_Lucene_Index_Term':
$subquery = new Zend_Search_Lucene_Search_Query_Term($subquery);
// intentional fallthrough to next case here
// intentional fallthrough to next case here
case 'Zend_Search_Lucene_Search_Query_Term':
$vs_query .= '(' . $subquery->__toString() . ')';
break;
case 'Zend_Search_Lucene_Search_Query_Range':
$vs_query .= '(' . $subquery->__toString() . ')';
break;
default:
$vs_query .= '(' . $this->_queryToString($subquery) . ')';
break;
}
if (method_exists($subquery, "getBoost") && $subquery->getBoost() != 1) {
$vs_query .= '^' . round($subquery->getBoost(), 4);
}
}
return $vs_query;
}