Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed the default value of expand for synonym and synonym_graph to true. #8898

Merged

Conversation

mbo57
Copy link
Contributor

@mbo57 mbo57 commented Dec 7, 2024

Description

Changed the default value of expand for synonym and synonym_graph to true.

evidence

  1. Default configuration location in the OpenSearch source code here.
  2. Actual execution and confirmation (Version 2.18.0).
    expand: default
GET /_analyze
{
  "tokenizer": {
    "type": "standard",
    "mode": "search"
  },
  "filter": [
    {
      "type": "synonym",
      "synonyms": [
        "quick, fast, speedy"
      ]
    }
  ],
  "text": "fast"
}
# result
{
  "tokens": [
    {
      "token": "fast",
      "start_offset": 0,
      "end_offset": 4,
      "type": "<ALPHANUM>",
      "position": 0
    },
    {
      "token": "quick",
      "start_offset": 0,
      "end_offset": 4,
      "type": "SYNONYM",
      "position": 0
    },
    {
      "token": "speedy",
      "start_offset": 0,
      "end_offset": 4,
      "type": "SYNONYM",
      "position": 0
    }
  ]
}

expand: true

GET /_analyze
{
  "tokenizer": {
    "type": "standard",
    "mode": "search"
  },
  "filter": [
    {
      "type": "synonym",
      "expand": "true",
      "synonyms": [
        "quick, fast, speedy"
      ]
    }
  ],
  "text": "fast"
}
# result
{
  "tokens": [
    {
      "token": "fast",
      "start_offset": 0,
      "end_offset": 4,
      "type": "<ALPHANUM>",
      "position": 0
    },
    {
      "token": "quick",
      "start_offset": 0,
      "end_offset": 4,
      "type": "SYNONYM",
      "position": 0
    },
    {
      "token": "speedy",
      "start_offset": 0,
      "end_offset": 4,
      "type": "SYNONYM",
      "position": 0
    }
  ]
}

expand: false

GET /_analyze
{
  "tokenizer": {
    "type": "standard",
    "mode": "search"
  },
  "filter": [
    {
      "type": "synonym",
      "expand": "false",
      "synonyms": [
        "quick, fast, speedy"
      ]
    }
  ],
  "text": "fast"
}
# result
{
  "tokens": [
    {
      "token": "quick",
      "start_offset": 0,
      "end_offset": 4,
      "type": "SYNONYM",
      "position": 0
    }
  ]
}

Version

all

Checklist

  • By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and subject to the Developers Certificate of Origin.
    For more information on following Developer Certificate of Origin and signing off your commits, please check here.

mbo57 added 2 commits December 7, 2024 18:25
Signed-off-by: mbo57 <96461698+mbo57@users.noreply.github.com>
Signed-off-by: mbo57 <96461698+mbo57@users.noreply.github.com>
Copy link

github-actions bot commented Dec 7, 2024

Thank you for submitting your PR. The PR states are In progress (or Draft) -> Tech review -> Doc review -> Editorial review -> Merged.

Before you submit your PR for doc review, make sure the content is technically accurate. If you need help finding a tech reviewer, tag a maintainer.

When you're ready for doc review, tag the assignee of this PR. The doc reviewer may push edits to the PR directly or leave comments and editorial suggestions for you to address (let us know in a comment if you have a preference). The doc reviewer will arrange for an editorial review.

@mbo57 mbo57 changed the title Changed default value of synonym and synonym_graph to true Changed the default value of expand for synonym and synonym_graph to true. Dec 7, 2024
Copy link
Collaborator

@kolchfa-aws kolchfa-aws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks so much, @mbo57!

@kolchfa-aws kolchfa-aws added the backport 2.18 PR: Backport label for 2.18 label Dec 9, 2024
@kolchfa-aws kolchfa-aws merged commit acb1e9f into opensearch-project:main Dec 9, 2024
6 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Dec 9, 2024
…true. (#8898)

* Update synonym.md

Signed-off-by: mbo57 <96461698+mbo57@users.noreply.github.com>

* Update synonym-graph.md

Signed-off-by: mbo57 <96461698+mbo57@users.noreply.github.com>

---------

Signed-off-by: mbo57 <96461698+mbo57@users.noreply.github.com>
Co-authored-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>
(cherry picked from commit acb1e9f)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.18 PR: Backport label for 2.18
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants