solr 清理查询 [英] solr sanitizing query

查看:39
本文介绍了solr 清理查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在轨道上使用带有 ruby​​ 的 solr.一切正常,我只需要知道是否有任何现有代码来清理用户输入,例如以 ?或 *

I am using solr with ruby on rails. It's all working well, I just need to know if there's any existing code to sanitize user input, like a query starting with ? or *

推荐答案

我不知道有任何代码可以做到这一点,但理论上可以通过查看 在Lucene中解析代码并搜索对于 throw new ParseException(只有 16 个匹配项!).

I don't know any code that does this, but theoretically it could be done by looking at the parsing code in Lucene and searching for throw new ParseException (only 16 matches!).

在实践中,我认为您最好在代码中捕获任何 solr 异常并显示无效查询".消息或类似的东西.

In practice, I think you're better off just catching any solr exceptions in your code and showing an "invalid query" message or something like that.

这里有几个消毒剂":

这篇关于solr 清理查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆