-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[feature](index change)Support light index change for inverted index without parser #52251
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
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6f1cc72
[feature](index change)Support light index change for inverted index …
airborne12 b9ec453
fix style
airborne12 567f6d0
fix style
airborne12 cbe486b
fix rebase
airborne12 300d2b5
fix ut
airborne12 1ab4256
fix ut
airborne12 89bd9b4
fix regression
airborne12 961a03b
update case
airborne12 2fcbf0d
update case
airborne12 3c6471b
update case
airborne12 1faccf1
update
airborne12 acc294f
update
airborne12 8d54e2c
update
airborne12 d911c97
update
airborne12 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
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -153,6 +153,10 @@ public String getInvertedIndexParser() { | |||||||||||||||||||||||||||||||||||||||||||||||
| return InvertedIndexUtil.getInvertedIndexParser(properties); | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| public boolean isInvertedIndexParserNone() { | ||||||||||||||||||||||||||||||||||||||||||||||||
| return InvertedIndexUtil.INVERTED_INDEX_PARSER_NONE.equals(getInvertedIndexParser()); | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| public String getInvertedIndexParserMode() { | ||||||||||||||||||||||||||||||||||||||||||||||||
| return InvertedIndexUtil.getInvertedIndexParserMode(properties); | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -170,16 +174,25 @@ public String getInvertedIndexParserStopwords() { | |||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| // Whether the index can be changed in light mode | ||||||||||||||||||||||||||||||||||||||||||||||||
| // cloud mode only supports light change for ngram_bf index | ||||||||||||||||||||||||||||||||||||||||||||||||
| // local mode supports light change for both inverted index and ngram_bf index | ||||||||||||||||||||||||||||||||||||||||||||||||
| // the rest of the index types do not support light change | ||||||||||||||||||||||||||||||||||||||||||||||||
| public boolean isLightIndexChangeSupported() { | ||||||||||||||||||||||||||||||||||||||||||||||||
| return indexType == IndexDef.IndexType.INVERTED; | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| // Whether the index can be added in light mode | ||||||||||||||||||||||||||||||||||||||||||||||||
| // cloud mode supports light add for ngram_bf index and non-tokenized inverted index (parser="none") | ||||||||||||||||||||||||||||||||||||||||||||||||
| // local mode supports light add for both inverted index and ngram_bf index | ||||||||||||||||||||||||||||||||||||||||||||||||
| // the rest of the index types do not support light add | ||||||||||||||||||||||||||||||||||||||||||||||||
| public boolean isLightAddIndexSupported(boolean enableAddIndexForNewData) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| if (Config.isCloudMode()) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| return indexType == IndexDef.IndexType.NGRAM_BF; | ||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| return indexType == IndexDef.IndexType.INVERTED | ||||||||||||||||||||||||||||||||||||||||||||||||
| || indexType == IndexDef.IndexType.NGRAM_BF; | ||||||||||||||||||||||||||||||||||||||||||||||||
| if (indexType == IndexDef.IndexType.INVERTED) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| return isInvertedIndexParserNone() && enableAddIndexForNewData; | ||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (indexType == IndexDef.IndexType.NGRAM_BF) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| return enableAddIndexForNewData; | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+187
to
193
|
||||||||||||||||||||||||||||||||||||||||||||||||
| if (indexType == IndexDef.IndexType.INVERTED) { | |
| return isInvertedIndexParserNone() && enableAddIndexForNewData; | |
| } else if (indexType == IndexDef.IndexType.NGRAM_BF) { | |
| return enableAddIndexForNewData; | |
| } | |
| return false; | |
| } | |
| return isCloudModeLightAddSupported(enableAddIndexForNewData); | |
| } | |
| return isLocalModeLightAddSupported(enableAddIndexForNewData); | |
| } | |
| private boolean isCloudModeLightAddSupported(boolean enableAddIndexForNewData) { | |
| if (indexType == IndexDef.IndexType.INVERTED) { | |
| return isInvertedIndexParserNone() && enableAddIndexForNewData; | |
| } | |
| if (indexType == IndexDef.IndexType.NGRAM_BF) { | |
| return enableAddIndexForNewData; | |
| } | |
| return false; | |
| } | |
| private boolean isLocalModeLightAddSupported(boolean enableAddIndexForNewData) { |
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
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.
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.
Review the default value for enableAddIndexForNewData in case the session variable retrieval fails, ensuring that the default behavior is as intended in production.