dtg25862 2014-10-13 11:03
浏览 58

如何调整sphinx索引短语而不是单词?

I am using sphinx search engine and php. In my sql table i have something like this. mother keyboard, india pakistan, stakoverflow god. Now when i run indexer over it. It is indexing "mother and keyboard " as different words. I want them as a single phrase to be searched. I want this : it will not search if only mother comes or only father comes. I will search only if mother keyboard comes or keyboard mother comes.

thanks in advance

  • 写回答

1条回答 默认 最新

  • dongqian1893 2014-10-31 18:57
    关注

    You could try to search the exact phrase (which will require that you enable index_exact_words).

    So, with SphinxQL:

    SELECT * FROM index WHERE MATCH('="mother keyboard" | ="keyboard mother"');
    

    Or, the NEAR operator might help:

    SELECT * FROM index WHERE MATCH('mother NEAR/1 keyboard');
    

    The Sphinx documentation says that NEAR will "match the document when both subexpressions are found within N words of each other, no matter in which order."

    You can read more about the extended query syntax here

    评论

报告相同问题?

悬赏问题

  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题