elasticsearch结构化查询

news2024/11/27 2:44:02

在上一篇中我们介绍了DSL相关的知识,接下来我们将会学习elasticsearch的结构化查询,同时也实践一下上一篇的DSL的查询用法

什么是结构化搜索?

从《Elasticsearch权威指南》上摘取部分解释如下:

		结构化搜索是指查询包含内部结构的数据。日期,时间,和数字都是结构化的:它们有明确的格式给你执行逻辑
	操作。一般包括比较数字或日期的范围,或确定两个值哪个大。文本也可以被结构化。一包蜡笔有不同的颜色:
	红色 , 绿色 , 蓝色 。一篇博客可能被打上 分布式 和 搜索 的标签。电子商务产品有商品统一代码(UPCs)
	或其他有着严格格式的标识。
		通过结构化搜索,你的查询结果始终是是或非;是否应该属于集合。结构化搜索不关心文档的相关性或分数,
	它只是简单的包含或排除文档。这必须是有意义的逻辑,一个数字不能比同一个范围中的其他数字 更多。它只能
	包含在一个范围中或不在其中。类似的,对于结构化文本,一个值必须相等或不等。这里没有更匹配的概念。

从上面的定义我们可以看出来结构化查询最重要的就是是否匹配么人并不是很关心相关性和分值计算。所以接下来我们将会一一介绍不同的结构化查询。

Term查询

term 主要用于查找精确值,由于不需要计算分值,而且可以被缓存,所以速度很快,而且term查询主要针对的是数字,日期,布尔值或 not_analyzed 的字符串(未经分析的文本数据类型)。
首先我们使用term查询一下:

GET bank/_search
{
  "query": {
    "term": {
      "firstname": {
        "value": "Burton"
      }
    }
  },
      "profile": "true"
}

返回结果:

{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  },
  "profile" : {
    "shards" : [
      {
        "id" : "[jW8PbSdhTOOpESX13DRBJQ][bank][0]",
        "searches" : [
          {
            "query" : [
              {
                "type" : "TermQuery",
                "description" : "firstname:Burton",
                "time_in_nanos" : 8729,
                "breakdown" : {
                  "set_min_competitive_score_count" : 0,
                  "match_count" : 0,
                  "shallow_advance_count" : 0,
                  "set_min_competitive_score" : 0,
                  "next_doc" : 0,
                  "match" : 0,
                  "next_doc_count" : 0,
                  "score_count" : 0,
                  "compute_max_score_count" : 0,
                  "compute_max_score" : 0,
                  "advance" : 0,
                  "advance_count" : 0,
                  "score" : 0,
                  "build_scorer_count" : 2,
                  "create_weight" : 7274,
                  "shallow_advance" : 0,
                  "create_weight_count" : 1,
                  "build_scorer" : 1455
                }
              }
            ],
            "rewrite_time" : 1222,
            "collector" : [
              {
                "name" : "SimpleTopScoreDocCollector",
                "reason" : "search_top_hits",
                "time_in_nanos" : 3132
              }
            ]
          }
        ],
        "aggregations" : [ ]
      }
    ]
  }
}

我们发现结果好像并不尽如人意,那么我们再试一个,这次我们把他修改成年龄字段搜索:

GET bank/_search
{
  "query": {
    "term": {
      "age": {
        "value": 36
      }
    }
  },
      "profile": "true"
}

返回结果:

{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 52,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "6",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 6,
          "balance" : 5686,
          "firstname" : "Hattie",
          "lastname" : "Bond",
          "age" : 36,
          "gender" : "M",
          "address" : "671 Bristol Street",
          "employer" : "Netagy",
          "email" : "hattiebond@netagy.com",
          "city" : "Dante",
          "state" : "TN"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "361",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 361,
          "balance" : 23659,
          "firstname" : "Noreen",
          "lastname" : "Shelton",
          "age" : 36,
          "gender" : "M",
          "address" : "702 Tillary Street",
          "employer" : "Medmex",
          "email" : "noreenshelton@medmex.com",
          "city" : "Derwood",
          "state" : "NH"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "378",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 378,
          "balance" : 27100,
          "firstname" : "Watson",
          "lastname" : "Simpson",
          "age" : 36,
          "gender" : "F",
          "address" : "644 Thomas Street",
          "employer" : "Wrapture",
          "email" : "watsonsimpson@wrapture.com",
          "city" : "Keller",
          "state" : "TX"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "397",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 397,
          "balance" : 37418,
          "firstname" : "Leonard",
          "lastname" : "Gray",
          "age" : 36,
          "gender" : "F",
          "address" : "840 Morgan Avenue",
          "employer" : "Recritube",
          "email" : "leonardgray@recritube.com",
          "city" : "Edenburg",
          "state" : "AL"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "455",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 455,
          "balance" : 39556,
          "firstname" : "Lynn",
          "lastname" : "Tran",
          "age" : 36,
          "gender" : "M",
          "address" : "741 Richmond Street",
          "employer" : "Optyk",
          "email" : "lynntran@optyk.com",
          "city" : "Clinton",
          "state" : "WV"
        }
      }
    ]
  },
  "profile" : {
    "shards" : [
      {
        "id" : "[jW8PbSdhTOOpESX13DRBJQ][bank][0]",
        "searches" : [
          {
            "query" : [
              {
                "type" : "PointRangeQuery",
                "description" : "age:[36 TO 36]",
                "time_in_nanos" : 101095,
                "breakdown" : {
                  "set_min_competitive_score_count" : 0,
                  "match_count" : 0,
                  "shallow_advance_count" : 0,
                  "set_min_competitive_score" : 0,
                  "next_doc" : 10111,
                  "match" : 0,
                  "next_doc_count" : 52,
                  "score_count" : 52,
                  "compute_max_score_count" : 0,
                  "compute_max_score" : 0,
                  "advance" : 2175,
                  "advance_count" : 2,
                  "score" : 4530,
                  "build_scorer_count" : 4,
                  "create_weight" : 2346,
                  "shallow_advance" : 0,
                  "create_weight_count" : 1,
                  "build_scorer" : 81933
                }
              }
            ],
            "rewrite_time" : 1248,
            "collector" : [
              {
                "name" : "SimpleTopScoreDocCollector",
                "reason" : "search_top_hits",
                "time_in_nanos" : 76285
              }
            ]
          }
        ],
        "aggregations" : [ ]
      }
    ]
  }
}

根据上面的结果,我们再一次验证了,term查询只针对精确值、布尔值、日期以及未经分析的字段,而如果我们用term去查询一些单词或者句子等,就会匹配不到对应的值,为什么呢?官网其实也给出了解释,在下图中就可以看到,其实是因为我们es默认的标准分词器可能将我们要查询的句子或者单词变成小写了,或者拆分了,而我们的term查询又是精确查询,所以不会分析我们的搜索字段的,从而导致term查询一些单词和短语时,很难得到满意的结果。当然这也是官方提醒我们要避免的,官方建议我们使用match来匹配查询一些单词和短语,效果要比term好。
传送门
如图所示:
在这里插入图片描述
在这里插入图片描述
这里我就不翻译了,如果想学习更多,可以自行阅读官方文档。

Terms查询

terms查询其实就是类似整合多个term查询。如例子所示:

GET bank/_search
{
  "query": {
    "terms": {
      "age": [36,27]
    }
  },
      "profile": "true"
}

返回结果:

{
  "took" : 3,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 91,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "6",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 6,
          "balance" : 5686,
          "firstname" : "Hattie",
          "lastname" : "Bond",
          "age" : 36,
          "gender" : "M",
          "address" : "671 Bristol Street",
          "employer" : "Netagy",
          "email" : "hattiebond@netagy.com",
          "city" : "Dante",
          "state" : "TN"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "20",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 20,
          "balance" : 16418,
          "firstname" : "Elinor",
          "lastname" : "Ratliff",
          "age" : 36,
          "gender" : "M",
          "address" : "282 Kings Place",
          "employer" : "Scentric",
          "email" : "elinorratliff@scentric.com",
          "city" : "Ribera",
          "state" : "WA"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "102",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 102,
          "balance" : 29712,
          "firstname" : "Dena",
          "lastname" : "Olson",
          "age" : 27,
          "gender" : "F",
          "address" : "759 Newkirk Avenue",
          "employer" : "Hinway",
          "email" : "denaolson@hinway.com",
          "city" : "Choctaw",
          "state" : "NJ"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "133",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 133,
          "balance" : 26135,
          "firstname" : "Deena",
          "lastname" : "Richmond",
          "age" : 36,
          "gender" : "F",
          "address" : "646 Underhill Avenue",
          "employer" : "Sunclipse",
          "email" : "deenarichmond@sunclipse.com",
          "city" : "Austinburg",
          "state" : "SC"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "222",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 222,
          "balance" : 14764,
          "firstname" : "Rachelle",
          "lastname" : "Rice",
          "age" : 36,
          "gender" : "M",
          "address" : "333 Narrows Avenue",
          "employer" : "Enaut",
          "email" : "rachellerice@enaut.com",
          "city" : "Wright",
          "state" : "AZ"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "239",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 239,
          "balance" : 25719,
          "firstname" : "Chang",
          "lastname" : "Boyer",
          "age" : 36,
          "gender" : "M",
          "address" : "895 Brigham Street",
          "employer" : "Qaboos",
          "email" : "changboyer@qaboos.com",
          "city" : "Belgreen",
          "state" : "NH"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "328",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 328,
          "balance" : 12523,
          "firstname" : "Good",
          "lastname" : "Campbell",
          "age" : 27,
          "gender" : "F",
          "address" : "438 Hicks Street",
          "employer" : "Gracker",
          "email" : "goodcampbell@gracker.com",
          "city" : "Marion",
          "state" : "CA"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "342",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 342,
          "balance" : 33670,
          "firstname" : "Vivian",
          "lastname" : "Wells",
          "age" : 36,
          "gender" : "M",
          "address" : "570 Cobek Court",
          "employer" : "Nutralab",
          "email" : "vivianwells@nutralab.com",
          "city" : "Fontanelle",
          "state" : "OK"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "361",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 361,
          "balance" : 23659,
          "firstname" : "Noreen",
          "lastname" : "Shelton",
          "age" : 36,
          "gender" : "M",
          "address" : "702 Tillary Street",
          "employer" : "Medmex",
          "email" : "noreenshelton@medmex.com",
          "city" : "Derwood",
          "state" : "NH"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "378",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 378,
          "balance" : 27100,
          "firstname" : "Watson",
          "lastname" : "Simpson",
          "age" : 36,
          "gender" : "F",
          "address" : "644 Thomas Street",
          "employer" : "Wrapture",
          "email" : "watsonsimpson@wrapture.com",
          "city" : "Keller",
          "state" : "TX"
        }
      }
    ]
  },
  "profile" : {
    "shards" : [
      {
        "id" : "[jW8PbSdhTOOpESX13DRBJQ][bank][0]",
        "searches" : [
          {
            "query" : [
              {
                "type" : "PointInSetQuery",
                "description" : "age:{27 36}",
                "time_in_nanos" : 864841,
                "breakdown" : {
                  "set_min_competitive_score_count" : 0,
                  "match_count" : 0,
                  "shallow_advance_count" : 0,
                  "set_min_competitive_score" : 0,
                  "next_doc" : 3060,
                  "match" : 0,
                  "next_doc_count" : 91,
                  "score_count" : 91,
                  "compute_max_score_count" : 0,
                  "compute_max_score" : 0,
                  "advance" : 2277,
                  "advance_count" : 2,
                  "score" : 2482,
                  "build_scorer_count" : 4,
                  "create_weight" : 52628,
                  "shallow_advance" : 0,
                  "create_weight_count" : 1,
                  "build_scorer" : 804394
                }
              }
            ],
            "rewrite_time" : 1505,
            "collector" : [
              {
                "name" : "SimpleTopScoreDocCollector",
                "reason" : "search_top_hits",
                "time_in_nanos" : 17392
              }
            ]
          }
        ],
        "aggregations" : [ ]
      }
    ]
  }
}

当然在term中需要注意的在这里同样需要。terms也是同样是精确查询。这里提一嘴terms lookup的用法,先看lookup的例子:

GET bank/_search
{
  "query": {
    "terms": {
      "age": {
        "index" : "bank",
            "id" : "342",
            "path" : "age"
      }
    }
  },
      "profile": "true"
}

返回结果:

{
  "took" : 4,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 52,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "6",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 6,
          "balance" : 5686,
          "firstname" : "Hattie",
          "lastname" : "Bond",
          "age" : 36,
          "gender" : "M",
          "address" : "671 Bristol Street",
          "employer" : "Netagy",
          "email" : "hattiebond@netagy.com",
          "city" : "Dante",
          "state" : "TN"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "20",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 20,
          "balance" : 16418,
          "firstname" : "Elinor",
          "lastname" : "Ratliff",
          "age" : 36,
          "gender" : "M",
          "address" : "282 Kings Place",
          "employer" : "Scentric",
          "email" : "elinorratliff@scentric.com",
          "city" : "Ribera",
          "state" : "WA"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "133",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 133,
          "balance" : 26135,
          "firstname" : "Deena",
          "lastname" : "Richmond",
          "age" : 36,
          "gender" : "F",
          "address" : "646 Underhill Avenue",
          "employer" : "Sunclipse",
          "email" : "deenarichmond@sunclipse.com",
          "city" : "Austinburg",
          "state" : "SC"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "222",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 222,
          "balance" : 14764,
          "firstname" : "Rachelle",
          "lastname" : "Rice",
          "age" : 36,
          "gender" : "M",
          "address" : "333 Narrows Avenue",
          "employer" : "Enaut",
          "email" : "rachellerice@enaut.com",
          "city" : "Wright",
          "state" : "AZ"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "239",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 239,
          "balance" : 25719,
          "firstname" : "Chang",
          "lastname" : "Boyer",
          "age" : 36,
          "gender" : "M",
          "address" : "895 Brigham Street",
          "employer" : "Qaboos",
          "email" : "changboyer@qaboos.com",
          "city" : "Belgreen",
          "state" : "NH"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "342",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 342,
          "balance" : 33670,
          "firstname" : "Vivian",
          "lastname" : "Wells",
          "age" : 36,
          "gender" : "M",
          "address" : "570 Cobek Court",
          "employer" : "Nutralab",
          "email" : "vivianwells@nutralab.com",
          "city" : "Fontanelle",
          "state" : "OK"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "361",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 361,
          "balance" : 23659,
          "firstname" : "Noreen",
          "lastname" : "Shelton",
          "age" : 36,
          "gender" : "M",
          "address" : "702 Tillary Street",
          "employer" : "Medmex",
          "email" : "noreenshelton@medmex.com",
          "city" : "Derwood",
          "state" : "NH"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "378",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 378,
          "balance" : 27100,
          "firstname" : "Watson",
          "lastname" : "Simpson",
          "age" : 36,
          "gender" : "F",
          "address" : "644 Thomas Street",
          "employer" : "Wrapture",
          "email" : "watsonsimpson@wrapture.com",
          "city" : "Keller",
          "state" : "TX"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "397",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 397,
          "balance" : 37418,
          "firstname" : "Leonard",
          "lastname" : "Gray",
          "age" : 36,
          "gender" : "F",
          "address" : "840 Morgan Avenue",
          "employer" : "Recritube",
          "email" : "leonardgray@recritube.com",
          "city" : "Edenburg",
          "state" : "AL"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "455",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 455,
          "balance" : 39556,
          "firstname" : "Lynn",
          "lastname" : "Tran",
          "age" : 36,
          "gender" : "M",
          "address" : "741 Richmond Street",
          "employer" : "Optyk",
          "email" : "lynntran@optyk.com",
          "city" : "Clinton",
          "state" : "WV"
        }
      }
    ]
  },
  "profile" : {
    "shards" : [
      {
        "id" : "[jW8PbSdhTOOpESX13DRBJQ][bank][0]",
        "searches" : [
          {
            "query" : [
              {
                "type" : "PointInSetQuery",
                "description" : "age:{36}",
                "time_in_nanos" : 137631,
                "breakdown" : {
                  "set_min_competitive_score_count" : 0,
                  "match_count" : 0,
                  "shallow_advance_count" : 0,
                  "set_min_competitive_score" : 0,
                  "next_doc" : 1715,
                  "match" : 0,
                  "next_doc_count" : 52,
                  "score_count" : 52,
                  "compute_max_score_count" : 0,
                  "compute_max_score" : 0,
                  "advance" : 1762,
                  "advance_count" : 2,
                  "score" : 1462,
                  "build_scorer_count" : 4,
                  "create_weight" : 1747,
                  "shallow_advance" : 0,
                  "create_weight_count" : 1,
                  "build_scorer" : 130945
                }
              }
            ],
            "rewrite_time" : 1454,
            "collector" : [
              {
                "name" : "SimpleTopScoreDocCollector",
                "reason" : "search_top_hits",
                "time_in_nanos" : 11493
              }
            ]
          }
        ],
        "aggregations" : [ ]
      }
    ]
  }
}

我理解的意思就是查询与指定文档id下的指定的字段的值一样的文档有哪些。效率虽然高,但是限制也比较多,可自行查看官网描述的相关限制,传送门

暂时先学习到这,后续还会继续学习更多的查询。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/471382.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

当我们在谈论ChatGPT时,我们在谈论什么?

当我们在谈论ChatGPT时,我们在谈论什么? 文章目录 当我们在谈论ChatGPT时,我们在谈论什么?一、介绍GPT-4相比GPT-3.5有何不同呢1.交谈能力2.多语言翻译精确度3.视觉输入 二、应用领域1.小镇做题家 (学术研究)2.Cosplay&#xff0c…

优思学院|质量大师的那些名言(三)【质量是一种习惯】

格言是一种简洁明了、简练有力的表达方式,通常蕴含着深刻的哲理和智慧,能够为我们提供指导和启示。 在《质量大师的那些名言》系列中,优思学院将透过这些名言,用最简单、直接、深刻的方式教授质量和六西格玛管理。 概述 在现代商…

ChatGPT 目前到底能帮助我们程序员做什么?

🚀 个人主页 极客小俊 ✍🏻 作者简介:web开发者、设计师、技术分享博主 🐋 希望大家多多支持一下, 我们一起进步!😄 🏅 如果文章对你有帮助的话,欢迎评论 💬点赞&#x1…

异常中断处理

异常或中断是用户程序中最基本的一种执行流程或形态。这部分主要对ARM架构下的异常中断做详细说明。 ARM一共有7种类型的异常,按优先级从高到低的排列如下: 复位异常(Reset)、数据异常(Data Abort)、快速…

工业和信息化部发布《关于电信设备进网许可制度若干改革举措的通告》

按照《国务院办公厅关于深化电子电器行业管理制度改革的意见》(国办发〔2022〕31号)要求,工业和信息化部发布《关于电信设备进网许可制度若干改革举措的通告》(工信部信管函〔2023〕14号),集中公布动态调整…

2023,你了解Kafka吗?深入详解

- 消息队列的核心价值 - 解耦合。 异步处理 例如电商平台,秒杀活动。一般流程会分为:1: 风险控制、2:库存锁定、3:生成订单、4:短信通知、5:更新数据。 通过消息系统将秒杀活动业务拆分开&#x…

**MySQL关联查询七种方式详解与应用实例**,你的掌握了吗

当我们需要从多个表中查询数据时,就需要使用关联查询了。MySQL支持七种不同类型的关联查询:内连接、左连接、右连接、全外连接、交叉连接、自连接和自然连接。本文将讲解这七种关联查询的SQL语句、示例以及应用场景。 一、 前言 关联查询是数据库操作中…

Leetcode 37 解数独

Leetcode解数独 题目描述题解1(按Board行列回溯:较直接) 题目描述 编写一个程序,通过填充空格来解决数独问题。 数独的解法需 遵循如下规则: 数字 1-9 在每一行只能出现一次数字 1-9 在每一列只能出现一次数字 1-9 在每一个以粗实线分隔的…

postgresql|数据库|批量执行SQL脚本文件的shell脚本

前言: 对于数据库的维护而言,肯定是有SQL脚本的执行,例如,某个项目需要更新,那么,可能会有很多的SQL脚本需要执行,SQL脚本可能会包含有建表,插入数据,索引建立&#xff…

Vue项目的性能优化

前言 Vue 框架通过数据双向绑定和虚拟 DOM 技术,帮我们处理了前端开发中最脏最累的 DOM 操作部分, 我们不再需要去考虑如何操作 DOM 以及如何最高效地操作 DOM;但 Vue 项目中仍然存在项目首屏优化、Webpack 编译配置优化等问题,所…

Towards Principled Disentanglement for Domain Generalization

本文用大量的理论论述了基于解纠缠约束优化的域泛化问题。 这篇文章认为以往的文章在解决域泛化问题时所用的方法都是non-trivial的,也就是说没有作严格的证明,是不可解释的,而本文用到大量的定理和推论证明了方法的有效性。 动机 因为域泛…

客户管理系统的作用有哪些?

阅读本文您将了解:1.客户管理系统的作用;2.客户管理系统软件怎么用;3.客户管理的注意事项。 一、客户管理系统的作用 客户是企业的重要财富,因此客户管理是企业发展过程中至关重要的一部分,那么客户管理怎么做&#…

把字符串转换成整数

题目&#xff1a;把字符串转换成整数 思路&#xff1a; 如果对于一般规则的数字“字符串”转化为数字都很容易&#xff0c;比如&#xff1a; 对于“123456”可以利用如下代码进行转化&#xff1a; string str"123456"; int ans 0; for (int i0; i<str.size(); …

Elesticesearch

1. 概述 应用场景&#xff1a; 给你一个巨大的文档数据&#xff0c;文档中存储着许多非结构化的数据&#xff0c;如下&#xff1a; {“id” : “1”, “name” : “佛山张学友”, “age” : “15”}, {“name” : “广州周润发”, “height” : “182”}, …中间有10000万行……

ABAP 二分法查找与SORT排序

需求场景 需要对内表排序&#xff0c;按降序排列&#xff0c;获取第一行&#xff1b;二分法查找需要的数据 我按照降序排列后&#xff0c;获取到了第一行&#xff0c;但是通过二分法查找没有获取到 二分法查找 二分查找&#xff0c;对排序数组通过二分区间排除的方法进行快速…

最好用的六款虚拟机软件,赶紧收藏

在日常工作和学习中,我们常常需要在一台电脑上运行多个操作系统,以便进行软件测试、开发、学习以及实验等任务。虚拟机软件就是一种崭新的技术,它可以在一台电脑上运行多个操作系统,为用户提供了更高效、安全、稳定和智能化的工作和学习环境。今天我为大家介绍6款优秀的虚拟…

k8s安装监控工具metrics-server

我们需要监控cpu和内存的使用率.以便提供硬件资源的申请采购建议. 也方便我们知道运行负荷, 而不是糊里糊涂出了问题再去解决或者工具自动解决了而我们不知道, 话说回来集群的好处就是低成本的达到高性能, 性能不去监控就有点太不专业了. 但, k8s居然不自带监控工具 https://ku…

了解hiberfil.sys文件:计算机休眠模式的背后

简介: hiberfil.sys是Windows操作系统中的一个文件&#xff0c;它通常存储在计算机的根目录下&#xff0c;用于保存休眠模式下的内存映像。当您将计算机置于休眠模式时&#xff0c;Windows会将所有正在运行的程序和数据保存到hiberfil.sys文件中&#xff0c;然后关闭计算…

SAP MRP例外信息解释

SAP中MRP的例外信息&#xff0c;一共分为八类&#xff0c;下面是所有例外信息的解释 第一类&#xff1a; 69&#xff1a;BOM组件可能是递归的&#xff0c;即自己的子集中包括了自己。 02&#xff1a;订单创建日期在过去&#xff0c;可能是没有及时处理&#xff0c;这个建议表…

【Python爬虫实战】汽车城最好的十款车,第一名竟是这款车...Python教你一键采集二手车数据信息实现数据可视化展示哦~(附视频教程)

前言 驾考不易&#xff0c;天天早起去练车&#xff0c;无论烈日还是下雨&#xff0c;通通都在室外进行&#xff0c;但想要拿证&#xff0c;一定要坚 持不懈的去练车。 所有文章完整的素材源码都在&#x1f447;&#x1f447; 粉丝白嫖源码福利&#xff0c;请移步至CSDN社区或…