Solr基础操作11

2022-06-29 22:37:56 浏览数 (1)

- 前缀代表必须不包含指定关键字

代码语言:javascript复制
[root@h102 solr-5.3.0]# curl "http://localhost:8983/solr/gettingstarted/select?wt=json&indent=true&fl=id&rows=3&q=+two -three"
{
  "responseHeader":{
    "status":0,
    "QTime":15,
    "params":{
      "fl":"id",
      "indent":"true",
      "q":" two -three",
      "wt":"json",
      "rows":"3"}},
  "response":{"numFound":118,"start":0,"maxScore":0.33085516,"docs":[
      {
        "id":"/data/solr/solr-5.3.0/docs/solr-analytics/org/apache/solr/analytics/expression/package-use.html"},
      {
        "id":"/data/solr/solr-5.3.0/docs/solr-analytics/org/apache/solr/analytics/expression/package-summary.html"},
      {
        "id":"/data/solr/solr-5.3.0/docs/solr-core/org/apache/solr/search/function/distance/package-summary.html"}]
  }}
[root@h102 solr-5.3.0]#

Note: 所谓的不包含并不是绝对的,比如不包含 one 但可以包含 none ,结果取决于分词算法


Faceting

Field facets

信息分组统计

rows=0 不打印出检索结果

facet=true 打开 facet

facet.field=stream_size 设定 stream_size 为聚合对象

代码语言:javascript复制
[root@h102 solr-5.3.0]# curl "http://192.168.100.102:7574/solr/gettingstarted_shard1_replica1/select?q=*:*&wt=json&indent=true&rows=0&facet=true&facet.field=stream_size"
{
  "responseHeader":{
    "status":0,
    "QTime":131,
    "params":{
      "facet":"true",
      "indent":"true",
      "q":"*:*",
      "facet.field":"stream_size",
      "wt":"json",
      "rows":"0"}},
  "response":{"numFound":3772,"start":0,"maxScore":1.0,"docs":[]
  },
  "facet_counts":{
    "facet_queries":{},
    "facet_fields":{
      "stream_size":[
        "4812",22,
        "4823",20,
        "4779",19,
        "4867",18,
        "4790",17,
        "4768",16,
        "4834",16,
        "4746",15,
        "4801",15,
        "4878",15,
        "4920",14,
        "4757",13,
        "4986",13,
        "4724",12,
        "4856",12,
        "4931",12,
        "4964",12,
        "5008",12,
        "5030",12,
        "5063",12,
        "4735",11,
        "4942",11,
        "4975",11,
        "4997",11,
        "4702",10,
        "4845",10,
        "4854",10,
        "4865",10,
        "5094",10,
        "4889",9,
        "5019",9,
        "2737",8,
        "4777",8,
        "4843",8,
        "4900",8,
        "4911",8,
        "4944",8,
        "4953",8,
        "4966",8,
        "2900",7,
        "4821",7,
        "4887",7,
        "4909",7,
        "5041",7,
        "5118",7,
        "5140",7,
        "8989",7,
        "4799",6,
        "4810",6,
        "4832",6,
        "4922",6,
        "4933",6,
        "5017",6,
        "5127",6,
        "5149",6,
        "4691",5,
        "4898",5,
        "5032",5,
        "5052",5,
        "5072",5,
        "5083",5,
        "5162",5,
        "4658",4,
        "4680",4,
        "4713",4,
        "4876",4,
        "4955",4,
        "4977",4,
        "5039",4,
        "5096",4,
        "5105",4,
        "5138",4,
        "5151",4,
        "5173",4,
        "5246",4,
        "5294",4,
        "7305",4,
        "3941",3,
        "4744",3,
        "4788",3,
        "4962",3,
        "5010",3,
        "5050",3,
        "5129",3,
        "5160",3,
        "5184",3,
        "5204",3,
        "5213",3,
        "5224",3,
        "5279",3,
        "6294",3,
        "7523",3,
        "7549",3,
        "7618",3,
        "7983",3,
        "8109",3,
        "9276",3,
        "13358",3,
        "1334",2,
        "1377",2]},
    "facet_dates":{},
    "facet_ranges":{},
    "facet_intervals":{},
    "facet_heatmaps":{}}}
[root@h102 solr-5.3.0]# 

0 人点赞