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

[BUG] Sigmoid rank function - incorrect ranking explanation #14921

Closed
evgeniya00 opened this issue Jul 18, 2024 · 9 comments
Closed

[BUG] Sigmoid rank function - incorrect ranking explanation #14921

evgeniya00 opened this issue Jul 18, 2024 · 9 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers Search:Query Capabilities Search Search query, autocomplete ...etc v2.18.0 Issues and PRs related to version 2.18.0

Comments

@evgeniya00
Copy link

evgeniya00 commented Jul 18, 2024

  1. Create an index with rank_field field
  2. Navigate to Dev Tools and run a _search query (using sigmoid rank feature) with explain parameter set to true (_search?explain=true)
  3. GET /_search?explain=true
{
    "query": {
        "bool": {
            "should": [
                {
                    "match_phrase_prefix": {
                        "first_name": ""
                    }
                },
                {
                    "rank_feature": {
                        "field": "<rank_field>",
                        "sigmoid": {
                            "pivot": 3,
                            "exponent": 0.5
                        }
                    }
                }
            ]
        }
    }
}
  1. Observe the explanation of sigmoid function ranking:
    Both pivot and exponent are filled with pivot value

Expected behavior
Pivot and exponent are displayed correctly

OpenSearch Version
2.11.1

image

@evgeniya00 evgeniya00 added bug Something isn't working untriaged labels Jul 18, 2024
@ananzh
Copy link
Member

ananzh commented Jul 23, 2024

@opensearch-project/admin could we redirect this issue to opensearch team?

@gaiksaya gaiksaya transferred this issue from opensearch-project/OpenSearch-Dashboards Jul 23, 2024
@peternied peternied added Search Search query, autocomplete ...etc Search:Query Capabilities labels Jul 24, 2024
@peternied
Copy link
Member

[Triage - attendees 1 2]
@evgeniya00 Thanks for creating this issue, could you creating pull request with a test case that reproduces this bug so its easy to identify if this is fixed, and/or make a fix for the issue?

@peternied peternied added the good first issue Good for newcomers label Jul 24, 2024
@hrishikeshdkakkad
Copy link

/assign

@hrishikeshdkakkad
Copy link

Screenshot 2024-07-28 at 10 55 57 PM

I can reproduce this.
Can I get additional direction?
Some references? What should be the expected behavior?

cc. @peternied @evgeniya00

@owaiskazi19
Copy link
Member

@evgeniya00 this looks like a bug in lucene. Raised a PR there apache/lucene#13691.

@owaiskazi19
Copy link
Member

PR is merged and backported. Should be resolved in 9.12 lucene upgrade.

@sandeshkr419 sandeshkr419 added the v2.18.0 Issues and PRs related to version 2.18.0 label Aug 28, 2024
@sandeshkr419
Copy link
Contributor

sandeshkr419 commented Aug 28, 2024

Search Triage: We should be upgrading Lucene incorporating this fix as part of OS 2.18.
Closing this now.

Thanks @owaiskazi19 for the fix.

@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in Search Project Board Aug 28, 2024
@owaiskazi19
Copy link
Member

@hrishikeshdkakkad if later you want to add a REST test for it. Here is something I started and you can continue iterating on it

---
"Search with explain=true":
  - do:
      search:
        index: test
        body:
          query:
            bool:
              should:
                - match_phrase_prefix:
                    title: "Document 1"
                - rank_feature:
                    field: pagerank
                    sigmoid:
                      pivot: 3
                      exponent: 0.5
        explain: true

  - match:
      hits.hits.0._id: "1"
  - match:
      hits.hits.1._id: "2"

  # Check pivot and exponent values in the explanation
  - match:
      hits.hits.0._explanation.details.1.details.1.value: 3.0
  - match:
      hits.hits.0._explanation.details.1.details.2.value: 0.5
  - match:
      hits.hits.1._explanation.details.0.details.1.value: 3.0
  - match:
      hits.hits.1._explanation.details.0.details.2.value: 0.5

# Test teardown
---
teardown:
  - do:
      indices.delete:
        index: test
        ignore: 404

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers Search:Query Capabilities Search Search query, autocomplete ...etc v2.18.0 Issues and PRs related to version 2.18.0
Projects
Archived in project
Development

No branches or pull requests

7 participants