solr学習のまとめ

3542 ワード

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.
http://localhost:8983/solr/select/?wt=json&indent=on&q=ipod&fl=name&facet=true&facet.query=price:[0+TO+100]&facet.query=price:[100+TO+*]
次の結果が表示されます.
 "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.
http://localhost:8983/solr/select/?wt=json&indent=on&q=*:*&fl=name,manufacturedate_dt&facet=true&facet.date=manufacturedate_dt&facet.date.start=2004-01-01T00:00:00Z&facet.date.end=2010-01-01T00:00:00Z&facet.date.gap=%2b1YEAR
次の結果が表示されます.
"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.
テキストフィールドのインデックスは通常,分詞により各語を小文字に変換し,複数の形式を除去し,語の状態(現在時,過去時)を除去する.