Querying Data
查询没什么可说的。大致看看就明白。
q是查询关键字。fl是返回哪些结果集的字段。结果集是一个xml文档。
引用
Searches are done via HTTP GET on the select URL with the query string in the q parameter. You can pass a number of optional request parameters to the request handler to control what information is returned. For example, you can use the "fl" parameter to control what stored fields are returned, and if the relevancy score is returned...
* q=video&fl=name,id (return only name and id fields)
* q=video&fl=name,id,score (return relevancy score as well)
* q=video&fl=*,score (return all stored fields, as well as relevancy score)
* q=video&sort=price desc&fl=name,id (add sort specification: sort by price descending)
Solr provides a query form within the web admin interface that allows setting the various request parameters and is useful when trying out or debugging queries.
Sorting
排序也很简单。sort关键字。
引用
Solr provides a simple method to sort on one or more indexed fields. Use the 'sort' parameter to specify "field direction" pairs...
引用
* q=video&sort=price desc
* q=video&sort=price asc
* q=video&sort=inStock asc, price desc
"score" can also be used as a field name when specifying a sort...
* q=video&sort=score desc
* q=video&sort=inStock asc, score desc
If no sort is specified, the default is score desc, the same as in the Lucene search APIs.