Solr 查询语法 [英] Solr Query Syntax

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

问题描述

我刚刚开始考虑使用 Solr 作为我的搜索网络服务.不知道 Solr 是否支持这些查询类型:

  • 开始于
  • 完全匹配
  • 包含
  • 不含
  • 在范围内

谁能指导我如何在 Solr 中实现这些功能?

干杯,三浪

解决方案

Solr 能够完成所有这些事情,但每次回答都会成为 Solr 的迷你手册时,要充分解释如何做.

我建议您阅读从 Solr 主页链接的实际手册和教程.>

简而言之:

可以使用 Lucene 通配符实现 Startswith.

只有在字段未被标记时才能找到完全匹配.IE.整个字段被视为一个标记.

包含是默认的搜索格式.IE.搜索John"将找到其搜索字段包含值John"的任何文档.以 - 为前缀(例如-John"只会找到不包含 John 的文档).

范围(日期或整数)是可能的并且非常强大,例如 date:[* TO NOW] 将查找日期不在未来的任何文档.

I just got started looking at using Solr as my search web service. I don't know whether Solr supports these query types:

  • Startswith
  • Exact Match
  • Contain
  • Doesn't Contain
  • In the range

Could anyone guide me how to implement those features in Solr?

Cheers, Samnang

解决方案

Solr is capable of all those things but to adequately explain how to do each of time an answer would become a mini-manual for Solr.

I'd suggest you read the actual manual and tutorials linked from the Solr homepage.

In short though:

Startswith can be implemented using Lucene wildcards.

Exact matches will only be found if a field is not tokanized. I.e. the entire field is viewed as a single token.

Contain is the default search format. I.e. a search for "John" will find any document's whose search field contains the value "John". Prefixing with - (e.g. "-John" will only find documents that do not contain John).

Ranges (be they date or integer) are possible and quite powerful, example date:[* TO NOW] would find any document whose date is not in the future.

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

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