solr的一些查詢參數

fl: 是逗號分隔的列表,用來指定文檔結果中應返回的 Field 集。默認爲 “*”,指所有的字段。

defType: 指定query parser,常用defType=lucene, defType=dismax, defType=edismax

q: query。

q.alt: 當q字段爲空時,用於設置缺省的query,通常設置q.alt爲*:*。

qf: query fields,指定solr從哪些field中搜索。

pf: 用於指定一組field,當query完全匹配pf指定的某一個field時,來進行boost。

簡言之pf的作用是boosting phrases over words。

fq: filter query,過慮查詢。

mm: minimal should match。Solr支持三種查詢clause,即“必須出現”, “不能出現”和“可以出現”,分別對應於AND, -, OR。

在默認情況下,使用OR這個clause。mm用於設置在使用OR這個clause時,需要出現最少的滿足條件的clause數量,詳見這裏

ps: Phrase Slop. Amount of slop on phrase queries built for "pf" fields (affects boosting). ps is about pf parameter. ps affects boosting, if you play with ps value, numFound and result set do not change. But the order of result set change. This is about the phrase query that is constructed out of the entire "q" param. ps is slop applied to the phrases created from the entire query for evaluating pf boosts. ps will only (potentially) change the ranked ordering of your result set, by loosening what a "phrase match" means to the pf boost.

ps的例子:

Lets say your query is apache solr. (without quotation marks) 

Lets say these three documents contains all of these words and returned. 

1-) solr is built on the top of apache lucene. 
2-) apache solr is fast, mature and popular. 
3-) solr is hosted under apache umbrella. 

Even if you don't use pf and ps parameters, those documents will be in result set anyway. Lets say that they appear in this order 1,2,3. 

Then we include pf and ps parameter, q=apache solr&pf=title^1.2&ps=1 
Second document is boosted, lets say it comes first now. The order is changed. The documents - that have the all query words close each other - are boosted. Again the same three documents are returned.

qs: Query Phrase Slop. Amount of slop on phrase queries explicitly included in the user's query string (in qf fields; affects matching). qs affects matching. If you play with qs, numFound changes. This parameter is about when you have explicitphrase query in your raw query. i.e. &q="apache lucene" . qs is slop applied to phrases explicitly in the &q with double quotes. qs will (potentially) change your result set.

tie: tie breaker。

bq: 對某個field的value進行boost,例如brand:IBM^5.0。

bf: Function (with optional boosts) that will be included in the user's query to influence the score. Any function supported natively by Solr can be used, along with a boost value, e.g.: recip(rord(myfield),1,2,3)^1.5

wt: writer type,指定輸出格式,可以有 xml, json, php, phps。

q.op覆蓋schema.xmldefaultOperator(有空格時用"AND"還是用"OR"操作邏輯)。 
df
默認的查詢字段。 
qt
query type,指定那個類型來處理查詢請求,一般不用指定,默認是standard

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章