forked from opensearch-project/sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
opensearch-project#639: allow metadata fields and score opensearch fu…
…nction (#228) * Rebase from main Signed-off-by: Andrew Carbonetto <[email protected]> * Update to define and include metadata when visiting the expr node Signed-off-by: Andrew Carbonetto <[email protected]> * Add specific metadata identifiers Signed-off-by: Andrew Carbonetto <[email protected]> * Add IT tests and add parser changes Signed-off-by: Andrew Carbonetto <[email protected]> * Rebase from main Signed-off-by: Andrew Carbonetto <[email protected]> * Update score function expression analyzer to return boosted relevance function Signed-off-by: Andrew Carbonetto <[email protected]> * Update builder to track scores Signed-off-by: Andrew Carbonetto <[email protected]> * Remove ScoreExpression.java and cleanup checkstyle Signed-off-by: Andrew Carbonetto <[email protected]> * cleanup checkstyle Signed-off-by: Andrew Carbonetto <[email protected]> * Cleanup and add alternative score function syntax Signed-off-by: Andrew Carbonetto <[email protected]> * Cleanup and add alternative score function syntax Signed-off-by: Andrew Carbonetto <[email protected]> * Fix some bugs and add Expression tests Signed-off-by: Andrew Carbonetto <[email protected]> * Add expresssion and analyzer tests Signed-off-by: Andrew Carbonetto <[email protected]> * Add score doctests Signed-off-by: Andrew Carbonetto <[email protected]> * Add score function doctests Signed-off-by: Andrew Carbonetto <[email protected]> * Add metafield tests Signed-off-by: Andrew Carbonetto <[email protected]> * Move legacy test and mark old as ignore Signed-off-by: Andrew Carbonetto <[email protected]> * fix checkstyle violations Signed-off-by: Andrew Carbonetto <[email protected]> * fix checkstyle violations Signed-off-by: Andrew Carbonetto <[email protected]> * Update tests and identifier to accept metafields Signed-off-by: Andrew Carbonetto <[email protected]> * Checkstyle fixes Signed-off-by: Andrew Carbonetto <[email protected]> * Rebase from main Signed-off-by: Andrew Carbonetto <[email protected]> * Rebase from main Signed-off-by: Andrew Carbonetto <[email protected]> * Rebase from main Signed-off-by: Andrew Carbonetto <[email protected]> * fix checkstyle violations Signed-off-by: Andrew Carbonetto <[email protected]> * Revert bad conflict resolution Signed-off-by: Andrew Carbonetto <[email protected]> * Fix for review comments Signed-off-by: Andrew Carbonetto <[email protected]> * Update IT tests and legacy tests for comments Signed-off-by: Andrew Carbonetto <[email protected]> * Minor comment Signed-off-by: Andrew Carbonetto <[email protected]> * Updates for whitespace Signed-off-by: Andrew Carbonetto <[email protected]> * Update basics.rst to show OS result Signed-off-by: Andrew Carbonetto <[email protected]> * Update basics.rst to show OS result Signed-off-by: Andrew Carbonetto <[email protected]> * Update basics.rst description Signed-off-by: Andrew Carbonetto <[email protected]> * Change Score function to accept a double/integer not an unresolved Signed-off-by: Andrew Carbonetto <[email protected]> * Update functions.rst Signed-off-by: Andrew Carbonetto <[email protected]> * Checkstyle update Signed-off-by: Andrew Carbonetto <[email protected]> * Move reserved world symbol table to OpenSearchTable Signed-off-by: Andrew Carbonetto <[email protected]> * Update functions.rst for review comments Signed-off-by: Andrew Carbonetto <[email protected]> * Removed parser meta tokens; Changes ImmutableMap to Map Signed-off-by: Andrew Carbonetto <[email protected]> * Removed parser meta tokens; Changes ImmutableMap to Map Signed-off-by: Andrew Carbonetto <[email protected]> --------- Signed-off-by: Andrew Carbonetto <[email protected]>
- Loading branch information
1 parent
d44cd39
commit 3e4e9d7
Showing
38 changed files
with
1,212 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
core/src/main/java/org/opensearch/sql/ast/expression/ScoreFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.ast.expression; | ||
|
||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
import org.opensearch.sql.ast.AbstractNodeVisitor; | ||
|
||
/** | ||
* Expression node of Score function. | ||
* Score takes a relevance-search expression as an argument and returns it | ||
*/ | ||
@AllArgsConstructor | ||
@EqualsAndHashCode(callSuper = false) | ||
@Getter | ||
@ToString | ||
public class ScoreFunction extends UnresolvedExpression { | ||
private final UnresolvedExpression relevanceQuery; | ||
private final Literal relevanceFieldWeight; | ||
|
||
@Override | ||
public <T, C> T accept(AbstractNodeVisitor<T, C> nodeVisitor, C context) { | ||
return nodeVisitor.visitScoreFunction(this, context); | ||
} | ||
|
||
@Override | ||
public List<UnresolvedExpression> getChild() { | ||
return List.of(relevanceQuery); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.