RelevanceEngineeringCase "Make CamelCase HasEntityTitle flexibly findable"

From FindAndLearn::Cookbook
C1981431321
Jump to: navigation, search


Indexing[edit | edit source]

{
  "mappings": {
    "properties": {
       "HasEntityTitle": {
          "type": "text",
          "analyzer": "standard",
          "search_analyzer": "standard",
          "fields": {
            "TOKCamelCaseFILLowerCase": {
              "type": "",
              "analyzer": "TOKCamelCaseFILLowerCase",
              "search_analyzer": "TOKCamelCaseFILLowerCase",
            }
          }
        }
      }
    }
  },
  "settings": {
    "index": {
      "analysis": {
        "analyzer": {
          "TOKCamelCaseFILLowerCase": {
            "type": "custom",
            "filter": [
              "lowercase"
            ],
            "tokenizer": "TOKCamelCase"
          }
        },
        "tokenizer": {
          "TOKCamelCase": {
            "pattern": """([^\p{L}\d]+)|(?<=\D)(?=\d)|(?<=\d)(?=\D)|(?<=[\p{L}&&[^\p{Lu}]])(?=\p{Lu})|(?<=\p{Lu})(?=\p{Lu}[\p{L}&&[^\p{Lu}]])""",
            "type": "pattern"
          }
        },
        "filter": {
        }
      }
    }
  }
}

Querying[edit | edit source]

"query": {
  "query_string": {
    "query": "<queryString>",
      "fields": [
        "HasEntityTitle",
        "TOKCamelCaseFILLowerCase"
      }
    }
  }
}