简体   繁体   中英

Solr Query Syntax

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. Ie the entire field is viewed as a single token.

Contain is the default search format. Ie a search for "John" will find any document's whose search field contains the value "John". Prefixing with - (eg "-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.

Samnang,请尝试Solr Wiki中SolrQuerySyntax页面

您还可以在此处找到有关Solr查询语法的有趣信息: http//www.solrtutorial.com/solr-query-syntax.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM