- 
                Notifications
    
You must be signed in to change notification settings  - Fork 25.6k
 
ES\QL: Fix scoring for non full text functions #124540
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
Changes from 13 commits
338e82b
              af11e3b
              0a2bb77
              3fdce04
              ddd2efb
              82b5432
              1a2f653
              4f7a308
              86e7563
              da0701a
              30a052e
              bd7f4f6
              65c863c
              48b4495
              7fb6d10
              bf330f0
              0c9f80a
              0913f82
              92436af
              bf8474c
              c0b622b
              5f25b97
              f932406
              347c651
              967d0fe
              afab198
              c7cd78c
              2a618e1
              66935a0
              e641e38
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| pr: 124540 | ||
| summary: "ES\\QL: Fix scoring for full text functions" | ||
| area: "ES|QL, Search" | ||
| type: bug | ||
| issues: [] | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -46,9 +46,20 @@ public Source source() { | |
| 
     | 
||
| /** | ||
| * Convert to an Elasticsearch {@link QueryBuilder} all set up to execute | ||
| * the query. | ||
| * the query. This ensures that queries have appropriate boosting for scoring. | ||
| */ | ||
| public abstract QueryBuilder asBuilder(); | ||
| public final QueryBuilder toQueryBuilder() { | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the method changed to include boosting information according to the query being scorable.   | 
||
| QueryBuilder builder = asBuilder(); | ||
| if (scorable() == false) { | ||
| builder.boost(0.0f); | ||
                
       | 
||
| } | ||
| return builder; | ||
| } | ||
| 
     | 
||
| /** | ||
| * Used internally to convert to retrieve a {@link QueryBuilder} by queries. | ||
| */ | ||
| protected abstract QueryBuilder asBuilder(); | ||
| 
     | 
||
| /** | ||
| * Used by {@link Query#toString()} to produce a pretty string. | ||
| 
          
            
          
           | 
    @@ -85,4 +96,11 @@ public String toString() { | |
| public Query negate(Source source) { | ||
| return new NotQuery(source, this); | ||
| } | ||
| 
     | 
||
| /** | ||
| * Defines whether a query should contribute to the overall score | ||
| */ | ||
| public boolean scorable() { | ||
| return false; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asBuilder()is replaced bytoQueryBuilder()- see below