使用LIKE子句进行Solr查询 [英] Solr Query with LIKE Clause

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

问题描述

我正在与Solr合作,我想知道查询中是否可以有LIKE子句.例如,我想知道标题中带有纽约"的所有组织.在SQL中,它的写法类似于Name LIKE'New York%'.

I'm working with Solr and I'd like to know if it is possible to have a LIKE clause in the query. For example, I want to know all organizations with "New York" in the title. In SQL, this would be written like Name LIKE 'New York%'.

我的问题-如何在Solr中编写LIKE查询?

My question - how do you write a LIKE query in Solr?

如果使用的话,我正在使用SolrNet库.

I'm using the SolrNet library, if that makes a difference.

推荐答案

您仅搜索"New York",但首先需要正确配置字段的分析器.例如,您可能想以

You just search for "New York", but first you need to properly configure your field's analyzer. For example you might want to start with a field type like text_general as defined in the default Solr schema. This field type will tokenize on whitespace and other common word separators, then apply a filter of stopwords, then lowercase the terms in order to make searches case-insensitive.

有关 Solr Wiki中的分析器的更多信息.

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

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