solr 查询参数:各条件间以'&'分隔
q:查询
fl:返回已储存的内容,control what stored fields are returned。例如:q=video&fl=*,score
sort:排序,eg: q=video&sort=score asc,price desc&fl=name,id,price
wt:返回的数据类型,eg:q=video&wt=json
例子:http://localhost:8983/solr/select/?wt=json&indent=on&q=video+card&fl=name,id&hl=true&hl.fl=name,features
searches for video card
and requests
highlighting on the fields name,features
.
http://localhost:8983/solr/select/?wt=json&indent=on&q=*:*&fl=name&facet=true&facet.field=cat&facet.field=inStock
facet:refine their search results based on the returned categories.
the facet counts generated are for the complete set of documents that match the query.
返回的结果类似于:
"facet_counts":{
"facet_queries":{},
"facet_fields":{
"cat":[
"electronics",16,
"memory",6,
"card",2,
"connector",2,
"software",2,
"camera",1,
"printer",1,
"scanner",1],
"inStock":[
"true",14,
"false",4]},
"facet_dates":{}}}
Solr can also generate counts for arbitrary queries. The following example
queries for ipod
and shows prices below and above 100 by using
range queries on the price field.
"facet_counts":{
"facet_queries":{
"price:[0 TO 100]":2,
"price:[100 TO *]":1},
"facet_fields":{},
"facet_dates":{}}}
One can even facet by date ranges. This example requests counts for the manufacture date (manufacturedate_dt
field) for each year between 2004 and 2010.
"facet_counts":{
"facet_queries":{},
"facet_fields":{},
"facet_dates":{
"manufacturedate_dt":{
"2004-01-01T00:00:00Z":0,
"2005-01-01T00:00:00Z":2,
"2006-01-01T00:00:00Z":8,
"2007-01-01T00:00:00Z":0,
"2008-01-01T00:00:00Z":0,
"2009-01-01T00:00:00Z":0,
"gap":"+1YEAR",
"end":"2010-01-01T00:00:00Z"}}}}
Text fields are typically indexed by breaking the field into words and applying various transformations such as
lowercasing, removing plurals, or stemming to increase relevancy. The same text transformations are normally
applied to any queries in order to match what is indexed.