1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
//大致流程 //用户->构建查询语句(q)->handle->查询组件(querycommon)->queryparse->底层搜索->返回 //slor查询相关参数可参考如下网站: //http://wiki.apache.org/solr/CommonQueryParameters //或者在solr后台的Query中模拟出来,然后点击右上方的链接 q sort start rows //不解释 fq //返回查询 fl //指定需要的返回信息 deftType //指定解析器 Debugging //debug调试 //*:*查询所有 wt:返回格式 indent:是否缩进 http://192.168.22.190:8080/demo/product/select?q=*:*&wt=json&indent=true &debugQuery=true //查看调试信息 &sort=price+asc,id+desc //根据价格升序再根据id降序,排序字段需要索引且multiValued=false &start=2 //从第2条开始,默认0 &rows=2 //查询2条,默认10 &fq=id:[1 TO *] //id从1开始范围查询,fq可以多次指定 &fl=id,bid:brandId //返回id和品牌id,品牌id取别名为bid &q.op=AND //覆盖schema.xml的defaultOperator(空格时使用AND|OR,必须大写) &timeAllowed=2000 //设置查询超时时间为2秒 //高亮显示,hl.simple.pre hl.simple.post 的默认值一般在solrconfig.xml中配置即可 &hl=true&hl.fl=productName&hl.simple.pre=<em>&hl.simple.post=</em> //是否显示查询参数 none:不显示 explicit:只显示查询参数 all:所有包括在solrconfig.xml定义的Query Handler参数 &echoParams=none //其他相关组件 如:spellcheck:拼写检查 Suggest:检索建议(依赖spellcheck) Facet:分组统计 //carrot.title,carrot.snippet:聚类比较 MoreLikeThisComponent(MLT),MoreLikeThisHandler:相似查找 //pinyin4j,EdgeNGramTokenFilter:拼音 等 参考如下网站: //http://www.cnblogs.com/guozk/p/3498831.html //函数查询参考如下网站: //http://wiki.apache.org/solr/FunctionQuery |