Solr Query Syntax

2020-02-29 03:05发布

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

3条回答
Juvenile、少年°
2楼-- · 2020-02-29 03:31

Samnang, please try the SolrQuerySyntax page in the Solr Wiki.

查看更多
Luminary・发光体
3楼-- · 2020-02-29 03:33

You can also find interesting infos on Solr query syntax here: http://www.solrtutorial.com/solr-query-syntax.html

查看更多
劳资没心,怎么记你
4楼-- · 2020-02-29 03:40

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.

查看更多
登录 后发表回答