开发者

zend search lucene query api: boosting a term

I am using zend search lucene, and would like to add boosts to some of my search terms. The code is already written using the query construction API as follows.

$query->addTerm(new Zend_Search_Lucene_Index_Term($name,'name'), null);

I tried开发者_C百科 writing

$query->addTerm(new Zend_Search_Lucene_Index_Term($name . "^10", 'name'), null);

But that appears not to work correctly. (I suddenly get no results at all).

This carat syntax is listed in the documentation for query language, but not in the docs for query construction API. I know that in some instances the API doesn't behave quite like plain query language. Is this one of those instances?

Is there a function or parameter that adds boost values to terms?


Try outputting your query by doing something like this:

$term = new Zend_Search_Lucene_Index_Term($name,'name');
$query = new Zend_Search_Lucene_Search_Query_Term($term);

echo $query;

This will allow you to see the query that is being created before you use it to execute a search.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜