Solr 建议器教程/Java 简单示例
我看到一些关于如何在 Solr 中使用 Suggester 执行特定操作的问题,但如何实际使用它呢?我被困在如何简单地查询建议 api 以获取 Java 中的结果,也许使用 Solrj?我只是找不到任何简单的教程来解释它。
我所拥有的只是 SuggesterTest 类,即使在尝试解码 3 小时后我仍然无法理解事情是如何工作的,尤其是看起来像这样的疯狂请求:
req("qt", requestUri, "q", "ac", SpellingParams.SPELLCHECK_COUNT, "2", SpellingParams.SPELLCHECK_ONLY_MORE_POPULAR, "true"),
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ac']/int[@name='numFound'][.='2']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ac']/arr[@name='suggestion']/str[1][.='acquire']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ac']/arr[@name='suggestion']/str[2][.='accommodate']"
难道没有比这更简单的东西了吗?
另外,还有一个问题,我需要重建建议索引吗?如果假设我之前添加了一些数据,现在想将它们与建议器一起使用。我是否还需要在建议中指定要查询的字段?
谢谢!
I see some question about how to do specific things with Suggester in Solr, but how about how to actually use it? I'm stuck in how to simply query the suggest api to get the results in Java, maybe using Solrj? I just cannot find any simple tutorial that would explain it.
All I have is the SuggesterTest class that even after 3hours of trying to decode I still cannot understand how things work, especially the crazy requests that look like:
req("qt", requestUri, "q", "ac", SpellingParams.SPELLCHECK_COUNT, "2", SpellingParams.SPELLCHECK_ONLY_MORE_POPULAR, "true"),
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ac']/int[@name='numFound'][.='2']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ac']/arr[@name='suggestion']/str[1][.='acquire']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ac']/arr[@name='suggestion']/str[2][.='accommodate']"
Isn't there anything simpler than this?
Also, another question, do I need to rebuild the index for the suggestions? if let's say I added some data before, and now want to use them with suggester. Do I also need to specify somewhere which field I want to query in suggestions?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论