我爱小虾 发表于 2016-12-14 09:14:45

solr检索

搜索是通过select URL上的HTTP GET加一系列带q参数的查询字符串来完成的,即http://localhost:8983/solr/select?加q参数,例子如下:
1.查询数据   
   查询包含video字符串的记录,只显示name和id字段
   q=video&fl=name,id(即在web浏览器地址栏上输入http://localhost:8983/solr/select?q=video&fl=name,id)
   同上,
   q=video&fl=*,score
   q=video&wt=json(返回JSON格式的结果)
2.排序
    q=video&sort=price desc
   q=*:*&sort=inStock asc,price desc
3.高亮显示
   查询video card并且高亮显示name,features字段中的video字符串
    q=video card&fl=name,id&hl=true&hl.fl=name,features
4.层面查询
   q=*:*&facet=true&facet.field=cat
   q=*:*&facet=true&facet.field=cat&facet.field=inStock
   查询ipod价格在0-100区间的 和 100- 区间的:
   q=ipod&facet=true&facet.query=price:&facet.query=price:
   也可以按日期查询,查询manufacturedate_dt字段2004至2010年间每一年的数量:
q=*:*&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=+1YEAR
页: [1]
查看完整版本: solr检索