Skip to content

Wildcard Query with Stop Words in Romanian Analyzer Generates MatchNoDocsQuery #114185

@halilbulentorhon

Description

@halilbulentorhon

Description

Hi,
On the Romanian analyzer, using a wildcard for a stop word in a simple_query_string generates a MatchNoDocsQuery, which prevents matching any documents. The expected behavior is to remove the stop word from the query instead of generating a MatchNoDocsQuery. This behavior seems similar to issue #1272.

Environment

{
  "name" : "7f11a5b18353",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "_XRGD9iLQP6BSlAcqjVV0A",
  "version" : {
    "number" : "8.1.3",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "39afaa3c0fe7db4869a161985e240bd7182d7a07",
    "build_date" : "2022-04-19T08:13:25.444693396Z",
    "build_snapshot" : false,
    "lucene_version" : "9.0.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

Steps to Reproduce:

  1. Create an index with the Romanian analyzer:

    PUT test_index
    {
      "settings": {
        "index": {
          "refresh_interval": "1s",
          "number_of_shards": "1",
          "analysis": {
            "analyzer": {
              "default": {
                "type": "romanian"
              }
            }
          },
          "number_of_replicas": "0"
        }
      },
      "mappings": {
        "properties": {
          "text": {
            "type": "text"
          }
        }
      }
    }
    
  2. Index a document containing the stopword "Pentru":

    PUT test_index/_doc/1
    {
      "text": "Textile Pentru Casă"
    }
    
  3. Search using simple_query_string with a wildcard:

    GET test_index/_search
    {
      "profile": true, 
      "query": {
        "simple_query_string": {
          "query": "(Textile*+Pentru*+Casă*)",
          "fields": ["text"],
          "analyze_wildcard": true
        }
      }
    }
    

Observed Behavior

The search result returns no matches, and the query generates a MatchNoDocsQuery. The profile output shows:

{
  "type": "MatchNoDocsQuery",
  "description": "MatchNoDocsQuery('empty BooleanQuery')"
}

Expected Behavior

The stop word should be removed from the query, and the document should match as expected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions