0

トピック、著者、リソースの種類などによるファセットを含む論文の索引があります。

ユーザーは、ファセット値の 1 つで結果をフィルタリングできます。これが起こると、いくつかの一致があるはずだと確信しているにもかかわらず、何らかの理由で他のファセットの一部が消えてしまいます。

たとえば、ジョン・スミスがエコロジーをテーマに 5 つの論文を書いたことを私は知っています。したがって、用語 Ecology でフィルタリングすると、著者ファセットの下に John Smith が表示されるはずです。代わりに、作成者ファセットは完全に空になり、missing以前は小さな数値だった値が大きな数値になりました。一方、他の多くのファセットにはまだ値があります。

マッピングは次のようになります。

{
  "myindex" : {
    "mappings" : {
      "paper" : {
        "properties" : {
          "author_name" : {
            "type" : "string",
            "index" : "not_analyzed"
          },
          "description" : {
            "type" : "string"
          },
          "pub_date" : {
            "type" : "date",
            "format" : "YYYY-MM-dd"
          },
          "pub_type" : {
            "type" : "string",
            "index" : "not_analyzed"
          },
          "source_data" : {
            "type" : "nested",
            "properties" : {
              "code" : {
                "type" : "string",
                "index" : "not_analyzed"
              },
              "title" : {
                "type" : "string",
                "index" : "not_analyzed"
              }
            }
          },
          "title" : {
            "type" : "string"
          },
          "topics" : {
            "type" : "string",
            "fields" : {
              "raw" : {
                "type" : "string",
                "index" : "not_analyzed"
              }
            }
          }
        }
      }
    }
  }
}

サンプルクエリは次のとおりです。

{
    "facets": {
        "history": {
            "date_histogram": {
                "field": "pub_date",
                "interval": "year"
            }
        },
        "authors": {
            "terms": {
                "field": "author_name",
                "size": 10
            }
        },
        "topics": {
            "terms": {
                "field": "topics.raw"
            }
        },
        "record_types": {
            "terms": {
                "field": "pub_type"
            }
        },
        "sources": {
            "nested": "source_data",
            "terms": {
                "field": "source_data.code"
            }
        }
    },
    "suggest": {
        "didyoumean": {
            "term": {
                "field": "title",
                "size": 100
            },
            "text": "*"
        }
    },
    "query": {
        "filtered": {
            "filter": {
                "and": [
                    {
                        "term": {
                            "topics.raw": "Educational Technology"
                        }
                    }
                ]
            }
        }
    },
    "from": 0,
    "size": 50
}

フィルターなしで同じクエリを実行すると、ファセットごとに 10 個のアイテムが取得されます。フィルターを使用して実行すると、ファセットhistoryauthorsおよびの結果はゼロになりrecord_typesます。

各ファセットに を適用しようとしましたfacet_filterが、これは効果がないように見えました。少なくとも、これらのファセットによって返されるレコードの数は増加しませんでした。

4

0 に答える 0