-
Notifications
You must be signed in to change notification settings - Fork 0
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
simple_query_string
implementation.
#66
Changes from 2 commits
d837b60
5564fd0
521beca
0817d9e
015aa06
9814fa4
2ac159f
c1a91fc
b3bca7c
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,43 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
|
||
package org.opensearch.sql.ast.expression; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import lombok.AllArgsConstructor; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import org.opensearch.sql.ast.AbstractNodeVisitor; | ||
|
||
/** | ||
* Expression node that includes a list of RelevanceField nodes. | ||
*/ | ||
@EqualsAndHashCode(callSuper = false) | ||
@AllArgsConstructor | ||
public class RelevanceFieldList extends UnresolvedExpression { | ||
@Getter | ||
private java.util.Map<UnresolvedExpression, UnresolvedExpression> fieldList; | ||
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. I believe we can make this into a string-float map. 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. We talked about using the Field class to store the string/float parameters. If that doesn't work, we should consider creating an Object to store this information. 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. Fixed in 015aa06. |
||
|
||
@Override | ||
public List<UnresolvedExpression> getChild() { | ||
return List.of(); | ||
} | ||
|
||
@Override | ||
public <R, C> R accept(AbstractNodeVisitor<R, C> nodeVisitor, C context) { | ||
return nodeVisitor.visitRelevanceFieldList(this, context); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return fieldList | ||
.entrySet() | ||
.stream() | ||
.map(e -> String.format("\"%s\" ^ %s", e.getKey(), e.getValue())) | ||
.collect(Collectors.joining(", ")); | ||
} | ||
} |
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.
Without simplified RelevanceFieldList, this will fail if RelevanceFieldList is anything other than string-float map.
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.
Fixed in 015aa06.