forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Remove redundant getSupportedFormats from AnalyticsSearchbackEndPlugin. #365
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
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
89 changes: 89 additions & 0 deletions
89
...ins/analytics-backend-lucene/src/main/java/org/opensearch/be/lucene/LuceneDataFormat.java
This file contains hidden or 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,89 @@ | ||
| /* | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| */ | ||
|
|
||
| package org.opensearch.be.lucene; | ||
|
|
||
| import org.opensearch.index.engine.dataformat.DataFormat; | ||
| import org.opensearch.index.engine.dataformat.FieldTypeCapabilities; | ||
| import org.opensearch.index.engine.dataformat.FieldTypeCapabilities.Capability; | ||
|
|
||
| import java.util.Set; | ||
|
|
||
| /** | ||
| * Lucene data format capabilities. Declares what Lucene provides for each field type: | ||
| * <ul> | ||
| * <li>keyword — doc values (columnar), inverted index (full-text), stored fields</li> | ||
| * <li>text — inverted index (full-text), stored fields</li> | ||
| * <li>integer/long/short/byte — doc values, point range, stored fields</li> | ||
| * <li>float/double/half_float/scaled_float — doc values, point range, stored fields</li> | ||
| * <li>date — doc values, point range, stored fields</li> | ||
| * <li>boolean — doc values, stored fields</li> | ||
| * <li>ip — doc values, point range, stored fields</li> | ||
| * </ul> | ||
| */ | ||
| public class LuceneDataFormat extends DataFormat { | ||
|
|
||
| public static final LuceneDataFormat INSTANCE = new LuceneDataFormat(); | ||
|
|
||
| private static final Set<Capability> DOC_VALUES_INDEX_STORED = Set.of( | ||
| Capability.COLUMNAR_STORAGE, Capability.FULL_TEXT_SEARCH, Capability.STORED_FIELDS | ||
| ); | ||
|
|
||
| private static final Set<Capability> DOC_VALUES_POINT_STORED = Set.of( | ||
| Capability.COLUMNAR_STORAGE, Capability.POINT_RANGE, Capability.STORED_FIELDS | ||
| ); | ||
|
|
||
| private static final Set<Capability> FULL_TEXT_STORED = Set.of( | ||
| Capability.FULL_TEXT_SEARCH, Capability.STORED_FIELDS | ||
| ); | ||
|
|
||
| private static final Set<Capability> DOC_VALUES_STORED = Set.of( | ||
| Capability.COLUMNAR_STORAGE, Capability.STORED_FIELDS | ||
| ); | ||
|
|
||
| private static final Set<FieldTypeCapabilities> SUPPORTED_FIELDS = Set.of( | ||
| // String types | ||
| new FieldTypeCapabilities("keyword", DOC_VALUES_INDEX_STORED), | ||
| new FieldTypeCapabilities("text", FULL_TEXT_STORED), | ||
|
|
||
| // Numeric types — all have doc values + point range | ||
| new FieldTypeCapabilities("integer", DOC_VALUES_POINT_STORED), | ||
| new FieldTypeCapabilities("long", DOC_VALUES_POINT_STORED), | ||
| new FieldTypeCapabilities("short", DOC_VALUES_POINT_STORED), | ||
| new FieldTypeCapabilities("byte", DOC_VALUES_POINT_STORED), | ||
| new FieldTypeCapabilities("float", DOC_VALUES_POINT_STORED), | ||
| new FieldTypeCapabilities("double", DOC_VALUES_POINT_STORED), | ||
| new FieldTypeCapabilities("half_float", DOC_VALUES_POINT_STORED), | ||
| new FieldTypeCapabilities("scaled_float", DOC_VALUES_POINT_STORED), | ||
|
|
||
| // Date | ||
| new FieldTypeCapabilities("date", DOC_VALUES_POINT_STORED), | ||
| new FieldTypeCapabilities("date_nanos", DOC_VALUES_POINT_STORED), | ||
|
|
||
| // Boolean | ||
| new FieldTypeCapabilities("boolean", DOC_VALUES_STORED), | ||
|
|
||
| // IP | ||
| new FieldTypeCapabilities("ip", Set.of(Capability.COLUMNAR_STORAGE, Capability.POINT_RANGE, Capability.STORED_FIELDS)) | ||
| ); | ||
|
|
||
| @Override | ||
| public String name() { | ||
| return "lucene"; | ||
| } | ||
|
|
||
| @Override | ||
| public long priority() { | ||
| return 100; | ||
| } | ||
|
|
||
| @Override | ||
| public Set<FieldTypeCapabilities> supportedFields() { | ||
| return SUPPORTED_FIELDS; | ||
| } | ||
| } |
This file contains hidden or 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
51 changes: 51 additions & 0 deletions
51
...alytics-backend-lucene/src/main/java/org/opensearch/be/lucene/LuceneSearchExecEngine.java
This file contains hidden or 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,51 @@ | ||
| /* | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| */ | ||
|
|
||
| package org.opensearch.be.lucene; | ||
|
|
||
| import org.opensearch.analytics.backend.EngineResultStream; | ||
| import org.opensearch.analytics.backend.ExecutionContext; | ||
| import org.opensearch.analytics.backend.SearchExecEngine; | ||
| import org.opensearch.common.annotation.ExperimentalApi; | ||
|
|
||
| import java.io.IOException; | ||
|
|
||
| /** | ||
| * Lucene-backed search execution engine. | ||
| * | ||
| * @opensearch.experimental | ||
| */ | ||
| @ExperimentalApi | ||
| public class LuceneSearchExecEngine implements SearchExecEngine<ExecutionContext, EngineResultStream> { | ||
|
|
||
| private final LuceneSearchContext context; | ||
|
|
||
| public LuceneSearchExecEngine(LuceneSearchContext context) { | ||
| this.context = context; | ||
| } | ||
|
|
||
| @Override | ||
| public void prepare(ExecutionContext requestContext) { | ||
| // TODO: extract query from plan and set on context | ||
| } | ||
|
|
||
| @Override | ||
| public EngineResultStream execute(ExecutionContext requestContext) throws IOException { | ||
| // TODO: execute via LuceneEngineSearcher and return result stream | ||
| return null; | ||
| } | ||
|
|
||
| public LuceneSearchContext getContext() { | ||
| return context; | ||
| } | ||
|
|
||
| @Override | ||
| public void close() throws IOException { | ||
| context.close(); | ||
| } | ||
| } |
1 change: 1 addition & 0 deletions
1
...ain/resources/META-INF/services/org.opensearch.analytics.spi.AnalyticsSearchBackendPlugin
This file contains hidden or 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 @@ | ||
| org.opensearch.be.lucene.LuceneSearchEnginePlugin |
1 change: 1 addition & 0 deletions
1
...nd-lucene/src/main/resources/META-INF/services/org.opensearch.plugins.SearchBackEndPlugin
This file contains hidden or 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 @@ | ||
| org.opensearch.be.lucene.LuceneSearchEnginePlugin |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.