dquoj04882 2013-12-05 11:24
浏览 32
已采纳

mongodb全文搜索否定词

I'm currently working on a search engine. I do it with php / mongodb.

The new feature Full Text Search does quite well a big part of the job, but I have a situation.

Here is an example: I search "Pizza -restaurant" (I'm french, but the words are transparents)

With the negative terms, there is a lot of documents with "restaurant" that are removed.

But there is still 3 or 4 documents with "restaurant" inside.

In these documents, "restaurant" is like any other words. It's separated with space, with no special character. It written in upper-case. (But the upper-case seems not to be the reason)

If it helps, the debug string is "[queryDebugString] => pizza||restaur||||" And here is an example of a document that is not removed :

BAR - RESTAURANT LE ST MICHAL CAMPAGNARD, BAR - RESTAURANT LE ST MICHAL

or

HOTEL - RESTAURANT rd 1120 19460 auberge de la route Spécialités gastronomiques du terroir

Edit : Here is the command to do the search:

$result = $this->_dbLocal->command(
            array(
            'text' => 'boutique', //this is the name of the collection where we are searching
                'search' => $q, //the string to search
                // 'language' => 'french',
                'limit' => 500,
        )
    );

EDIT : With some test, the negative terms works well with language: none in the search and the index. But with language: none, my search does not use stop words anymore, which were really useful ...

Is there any way to use stop words for everything but negative terms ? :/

Thank you for your time !

Gilles.

  • 写回答

1条回答 默认 最新

  • dongsuo9982 2014-01-02 19:41
    关注

    Cross-referencing this with the mongodb-user thread on the same issue. This was confirmed as a bug in SERVER-11994 and has since been fixed in 2.5.5 and the forthcoming 2.6 release.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?