小编Wiz*_*rdZ的帖子

选择使用doctrine 2从一个超类扩展的多个子类的实体

鉴于我的Doctrine 2实体的这种设置:

App\Bundle\LorumBundle\Entity\Node:
  type: entity
  table: node
  fields:
    id:
      id: true
      type: integer
      unsigned: false
      nullable: false
      generator:
        strategy: IDENTITY

    created:
      type: datetime

  inheritanceType: SINGLE_TABLE

  discriminatorColumn:
    name: type
    type:  string
    length: 255
  discriminatorMap:
    a: a
    b: b
    c: c

App\Bundle\LorumBundle\Entity\A:
  type: entity

  fields:
    status:
      type: boolean

App\Bundle\LorumBundle\Entity\B:
  type: entity

  fields:
    status:
      type: boolean

App\Bundle\LorumBundle\Entity\C:
  type: entity

  fields:
    title:
      type: string
Run Code Online (Sandbox Code Playgroud)

现在我想得到的基本上是A&B(不是C)类型的实体的混合列表status == true.

我可以像这样编写一个查询 - 使用instance of运算符将结果限制为我想要的子类但是我会得到一个错误因为我要匹配的属性(状态)没有映射到超类甚至强大的所有实体我想匹配反对它:

$queryBuilder->select('Node');
$queryBuilder->from('App\Bundle\LorumBundle\Entity\Node','Node');
$queryBuilder->add('where',$queryBuilder->expr()->orx(
        'Offer INSTANCE OF AppLorumBundle:A',
        'Offer INSTANCE …
Run Code Online (Sandbox Code Playgroud)

php doctrine-orm

5
推荐指数
1
解决办法
992
查看次数

如何为ElasticSearch过滤查询应用大小?

对于常规查询大小工作正常:

{
  "query": {
    "match_all": {}
  },
  "size": 2
}
Run Code Online (Sandbox Code Playgroud)

返回2个结果.但是当我尝试通过geo_polygon添加过滤器时:

{
  "query": {
    "filtered": {
      "query": {
        "match_all": {}
      },
      "filter": {
        "geo_polygon": {
          "coordinate": {
            "points": {
              "points": [
                [
                  -84.293222919922,
                  33.865223592668
                ],
                [
                  -84.293222919922,
                  33.632776407332
                ],
                [
                  -84.482737080078,
                  33.632776407332
                ],
                [
                  -84.482737080078,
                  33.865223592668
                ],
                [
                  -84.293222919922,
                  33.865223592668
                ]
              ]
            }
          }
        }
      }
    }
  },
  "size": 2
}
Run Code Online (Sandbox Code Playgroud)

它总是返回10个结果,看起来完全忽略"大小"参数.是否有任何特定方法使"大小"适用于筛选查询?

苹果系统,

elasticsearch

version: {
    number: 1.0.1
    lucene_version: 4.6
}
Run Code Online (Sandbox Code Playgroud)

elasticsearch

3
推荐指数
1
解决办法
2087
查看次数

标签 统计

doctrine-orm ×1

elasticsearch ×1

php ×1