Zend_Search_Lucene 查找带有特殊符号的短语
抱歉我的英语不好,但我有一个问题:
我使用 Zend_Search_Lucene 制作搜索应用程序。 我尝试查找短语“T-Mobile”但没有任何答案。 我知道符号“-”是一个特殊的符号。我必须做什么来覆盖这个符号“-”?
我编写的代码:
if ($this->getRequest()->getParam('as_epq', false)){
$search = new App_Search();
$phraze = explode(' ', $this->getRequest()->getParam('as_epq'));
if ($this->getRequest()->getParam('as_epq_place', false)){
$place = $this->getRequest()->getParam('as_epq_place');
$this->view->as_epq_place = $place;
$query = new Zend_Search_Lucene_Search_Query_Phrase($phraze, null, $place);
}else{
$query = new Zend_Search_Lucene_Search_Query_Phrase($phraze);
}
$this->view->as_epq = $this->getRequest()->getParam('as_epq');
$results = $search->getIndex()->find($query);
}
我不知道我的错误在哪里?
Sorry about my English but I have a problem:
I making application for search with using Zend_Search_Lucene.
I try find phrase "T-Mobile" but without anything answers.
I know symbol "-" is a special. What I have to do cover this symbol "-" ?
My code which I made :
if ($this->getRequest()->getParam('as_epq', false)){
$search = new App_Search();
$phraze = explode(' ', $this->getRequest()->getParam('as_epq'));
if ($this->getRequest()->getParam('as_epq_place', false)){
$place = $this->getRequest()->getParam('as_epq_place');
$this->view->as_epq_place = $place;
$query = new Zend_Search_Lucene_Search_Query_Phrase($phraze, null, $place);
}else{
$query = new Zend_Search_Lucene_Search_Query_Phrase($phraze);
}
$this->view->as_epq = $this->getRequest()->getParam('as_epq');
$results = $search->getIndex()->find($query);
}
I don't know where is my error ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用“/”转义特殊字符。
You can escape special characters using '/'.