Solr查询语法 [英] Solr Query Syntax

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

问题描述

我刚刚开始考虑将Solr用作搜索Web服务.我不知道Solr是否支持以下查询类型:

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

有人可以指导我如何在Solr中实现这些功能吗?

干杯, 三南市

解决方案

Solr能够进行所有这些操作,但能够充分说明每次答案将成为Solr的一份简短手册的方式.

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

简而言之:

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

仅在不命名字段的情况下才能找到完全匹配. 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天全站免登陆