最近我经常看到如下代码(这个例子来自Symfony):
protected function execute(InputInterface $input, OutputInterface $output)
{
throw new LogicException('You must override the execute() method in the concrete command class.');
}
Run Code Online (Sandbox Code Playgroud)
将标记方法标记为什么有什么好处abstract?
对...有什么好处?
我已经在Java中找到了一个类似的问题(伪造抽象方法在Java中使用异常),但由于它的答案是明确的猜测和观点,所以它不是很有帮助.
我目前正在尝试了解字段(https://www.elastic.co/guide/zh/elasticsearch/reference/current/multi-fields.html)和属性(https://www.elastic.co /guide/zh-CN/elasticsearch/reference/current/properties.html)。
它们都以某种方式定义为类型/映射属性的“子字段/子属性”,都可以具有单独的类型和分析器(据我所知),都可以通过点符号(mappingProperty.subField或mappingProperty.property)访问。
这些文档随机使用术语“字段”和“属性”,我有这样的感觉,例如:
类型映射,对象字段和嵌套字段包含称为属性的子字段。
属性和(子)字段之间有什么区别?如何确定我是否有财产或田地?
换句话说,如何决定我是否使用
{
"mappings": {
"_doc": {
"properties": {
"myProperty": {
"properties": {
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
要么
{
"mappings": {
"_doc": {
"properties": {
"myProperty": {
"fields": {
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)