├── .github
├── .codecov.yml
├── CODEOWNERS
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── config.yml
│ ├── documentation-issue.md
│ └── feature_request.md
├── PULL_REQUEST_TEMPLATE.md
├── dependabot.yml
├── draft-release-notes-config.yml
└── workflows
│ ├── CI.yml
│ ├── add-untriaged.yml
│ ├── backport.yml
│ ├── backwards_compatibility_tests_workflow.yml
│ ├── create-documentation-issue.yml
│ ├── delete_backport_branch.yml
│ ├── dependabot_pr.yml
│ ├── draft-release-notes-workflow.yml
│ ├── links.yml
│ └── pr_stats.yml
├── .gitignore
├── .whitesource
├── ADMINS.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── DEVELOPER_GUIDE.md
├── LICENSE
├── MAINTAINERS.md
├── NOTICE
├── README.md
├── RELEASING.md
├── RELEVANCE.md
├── SECURITY.md
├── amazon-kendra-intelligent-ranking
├── build.gradle
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── opensearch
│ │ │ └── search
│ │ │ └── relevance
│ │ │ ├── AmazonKendraIntelligentRankingPlugin.java
│ │ │ ├── actionfilter
│ │ │ └── SearchActionFilter.java
│ │ │ ├── client
│ │ │ └── OpenSearchClient.java
│ │ │ ├── configuration
│ │ │ ├── ConfigurationUtils.java
│ │ │ ├── Constants.java
│ │ │ ├── ResultTransformerConfiguration.java
│ │ │ ├── ResultTransformerConfigurationFactory.java
│ │ │ ├── SearchConfigurationExtBuilder.java
│ │ │ └── TransformerConfiguration.java
│ │ │ └── transformer
│ │ │ ├── ResultTransformer.java
│ │ │ ├── TransformerType.java
│ │ │ └── kendraintelligentranking
│ │ │ ├── KendraIntelligentRanker.java
│ │ │ ├── client
│ │ │ ├── KendraClientSettings.java
│ │ │ ├── KendraHttpClient.java
│ │ │ ├── SimpleAwsErrorHandler.java
│ │ │ └── SimpleResponseHandler.java
│ │ │ ├── configuration
│ │ │ ├── Constants.java
│ │ │ ├── KendraIntelligentRankerSettings.java
│ │ │ ├── KendraIntelligentRankingConfiguration.java
│ │ │ └── KendraIntelligentRankingConfigurationFactory.java
│ │ │ ├── model
│ │ │ ├── KendraIntelligentRankingException.java
│ │ │ ├── PassageScore.java
│ │ │ └── dto
│ │ │ │ ├── Document.java
│ │ │ │ ├── RescoreRequest.java
│ │ │ │ ├── RescoreResult.java
│ │ │ │ └── RescoreResultItem.java
│ │ │ ├── pipeline
│ │ │ └── KendraRankingResponseProcessor.java
│ │ │ └── preprocess
│ │ │ ├── BM25Scorer.java
│ │ │ ├── PassageGenerator.java
│ │ │ ├── QueryParser.java
│ │ │ ├── SentenceSplitter.java
│ │ │ └── TextTokenizer.java
│ └── plugin-metadata
│ │ └── plugin-security.policy
│ ├── test
│ └── java
│ │ └── org
│ │ └── opensearch
│ │ └── search
│ │ └── relevance
│ │ ├── AmazonKendraIntelligentRankingPluginIT.java
│ │ ├── SearchRelevanceTests.java
│ │ ├── actionfilter
│ │ └── SearchActionFilterTests.java
│ │ ├── configuration
│ │ └── SearchConfigurationExtBuilderTests.java
│ │ └── transformer
│ │ └── kendraintelligentranking
│ │ ├── KendraIntelligentRankerTests.java
│ │ ├── client
│ │ ├── KendraClientSettingsTests.java
│ │ ├── KendraHttpClientTests.java
│ │ ├── KendraIntelligentClientTests.java
│ │ └── SimpleAwsErrorHandlerTests.java
│ │ ├── configuration
│ │ └── KendraIntelligentRankingConfigurationTests.java
│ │ ├── model
│ │ ├── KendraIntelligentRankingExceptionTests.java
│ │ └── dto
│ │ │ └── DocumentTests.java
│ │ ├── pipeline
│ │ └── KendraRankingResponseProcessorTests.java
│ │ └── preprocess
│ │ ├── BM25ScorerTests.java
│ │ ├── PassageGeneratorTests.java
│ │ ├── QueryParserTests.java
│ │ ├── SentenceSplitterTests.java
│ │ └── TextTokenizerTests.java
│ └── yamlRestTest
│ ├── java
│ └── org
│ │ └── opensearch
│ │ └── search
│ │ └── relevance
│ │ └── AmazonKendraIntelligentRankingClientYamlTestSuiteIT.java
│ └── resources
│ └── rest-api-spec
│ └── test
│ └── 10_basic.yml
├── amazon-personalize-ranking
├── build.gradle
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── opensearch
│ │ │ └── search
│ │ │ └── relevance
│ │ │ ├── AmazonPersonalizeRankingPlugin.java
│ │ │ └── transformer
│ │ │ └── personalizeintelligentranking
│ │ │ ├── PersonalizeRankingResponseProcessor.java
│ │ │ ├── client
│ │ │ ├── PersonalizeClient.java
│ │ │ ├── PersonalizeClientSettings.java
│ │ │ └── PersonalizeCredentialsProviderFactory.java
│ │ │ ├── configuration
│ │ │ ├── Constants.java
│ │ │ └── PersonalizeIntelligentRankerConfiguration.java
│ │ │ ├── requestparameter
│ │ │ ├── PersonalizeRequestParameterUtil.java
│ │ │ ├── PersonalizeRequestParameters.java
│ │ │ └── PersonalizeRequestParametersExtBuilder.java
│ │ │ ├── reranker
│ │ │ ├── PersonalizedRanker.java
│ │ │ ├── PersonalizedRankerFactory.java
│ │ │ └── impl
│ │ │ │ └── AmazonPersonalizedRankerImpl.java
│ │ │ └── utils
│ │ │ └── ValidationUtil.java
│ └── plugin-metadata
│ │ └── plugin-security.policy
│ ├── test
│ └── java
│ │ └── org
│ │ └── opensearch
│ │ └── search
│ │ └── relevance
│ │ ├── AmazonPersonalizeRankingPluginIT.java
│ │ └── transformer
│ │ └── personalizeintelligentranking
│ │ ├── PersonalizeRankingResponseProcessorTests.java
│ │ ├── client
│ │ ├── PersonalizeClientSettingsTests.java
│ │ ├── PersonalizeClientTests.java
│ │ └── PersonalizeCredentialsProviderFactoryTests.java
│ │ ├── configuration
│ │ └── PersonalizeIntelligentRankerConfigurationTests.java
│ │ ├── ranker
│ │ ├── PersonalizeRankerFactoryTests.java
│ │ └── impl
│ │ │ └── AmazonPersonalizeRankerImplTests.java
│ │ ├── requestparameter
│ │ ├── PersonalizeRequestParameterUtilTests.java
│ │ └── PersonalizeRequestParametersExtBuilderTests.java
│ │ └── utils
│ │ ├── PersonalizeClientSettingsTestUtil.java
│ │ ├── PersonalizeRuntimeTestUtil.java
│ │ ├── SearchTestUtil.java
│ │ └── ValidationUtilTests.java
│ └── yamlRestTest
│ ├── java
│ └── org
│ │ └── opensearch
│ │ └── search
│ │ └── relevance
│ │ └── AmazonPersonalizeRankingClientYamlTestSuiteIT.java
│ └── resources
│ └── rest-api-spec
│ └── test
│ └── 10_basic.yml
├── build.gradle
├── docs
└── plan
│ └── SearchRelevancyWorkbench.md
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── helpers
├── personalized_search_ranking_quickstart.sh
└── search_processing_kendra_quickstart.sh
├── release-notes
├── search-processor.release-notes-2.4.0.md
├── search-processor.release-notes-2.5.0.md
├── search-processor.release-notes-2.6.0.md
├── search-processor.release-notes-2.7.0.md
├── search-processor.release-notes-2.8.0.md
└── search-processor.release-notes-2.9.0.md
└── settings.gradle
/.github/.codecov.yml:
--------------------------------------------------------------------------------
1 | # https://docs.codecov.com/docs/codecov-yaml
2 | coverage:
3 | status:
4 | project:
5 | default:
6 | # https://docs.codecov.com/docs/commit-status#target
7 | target: auto # coverage must be equal or above the previous commit
--------------------------------------------------------------------------------
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # This should match the MAINTAINERS.md file in the root of this repo
2 | * @msfroh @macohen @noCharger @mingshl @sejli
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: 🐛 Bug report
3 | about: Create a report to help us improve
4 | title: '[BUG]'
5 | labels: 'bug, untriaged'
6 | assignees: ''
7 | ---
8 |
9 | **What is the bug?**
10 | A clear and concise description of the bug.
11 |
12 | **How can one reproduce the bug?**
13 | Steps to reproduce the behavior:
14 | 1. Go to '...'
15 | 2. Click on '....'
16 | 3. Scroll down to '....'
17 | 4. See error
18 |
19 | **What is the expected behavior?**
20 | A clear and concise description of what you expected to happen.
21 |
22 | **What is your host/environment?**
23 | - OS: [e.g. iOS]
24 | - Version [e.g. 22]
25 | - Plugins
26 |
27 | **Do you have any screenshots?**
28 | If applicable, add screenshots to help explain your problem.
29 |
30 | **Do you have any additional context?**
31 | Add any other context about the problem.
32 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | contact_links:
2 | - name: OpenSearch Community Support
3 | url: https://discuss.opendistrocommunity.dev/
4 | about: Please ask and answer questions here.
5 | - name: AWS/Amazon Security
6 | url: https://aws.amazon.com/security/vulnerability-reporting/
7 | about: Please report security vulnerabilities here.
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/documentation-issue.md:
--------------------------------------------------------------------------------
1 | **Is your feature request related to a problem?**
2 | A new feature has been added.
3 |
4 | **What solution would you like?**
5 | Document the usage of the new feature.
6 |
7 | **What alternatives have you considered?**
8 | N/A
9 |
10 | **Do you have any additional context?**
11 | See please
12 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: 🎆 Feature request
3 | about: Request a feature in this project
4 | title: '[FEATURE]'
5 | labels: 'enhancement, untriaged'
6 | assignees: ''
7 | ---
8 | **Is your feature request related to a problem?**
9 | A clear and concise description of what the problem is, e.g. _I'm always frustrated when [...]_
10 |
11 | **What solution would you like?**
12 | A clear and concise description of what you want to happen.
13 |
14 | **What alternatives have you considered?**
15 | A clear and concise description of any alternative solutions or features you've considered.
16 |
17 | **Do you have any additional context?**
18 | Add any other context or screenshots about the feature request here.
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### Description
2 | [Describe what this change achieves]
3 |
4 | ### Issues Resolved
5 | [List any issues this PR will resolve]
6 |
7 | ### Check List
8 | - [ ] New functionality includes testing.
9 | - [ ] All tests pass
10 | - [ ] New functionality has been documented.
11 | - [ ] New functionality has javadoc added
12 | - [ ] Commits are signed as per the DCO using --signoff
13 |
14 | By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
15 | For more information on following Developer Certificate of Origin and signing off your commits, please check [here](https://github.com/opensearch-project/search-processor/blob/main/CONTRIBUTING.md).
16 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | name: Dependabot
2 | updates:
3 | - directory: /
4 | open-pull-requests-limit: 1
5 | package-ecosystem: gradle
6 | schedule:
7 | interval: daily
8 | labels:
9 | - "dependabot"
10 | - "dependencies"
11 | version: 2
--------------------------------------------------------------------------------
/.github/draft-release-notes-config.yml:
--------------------------------------------------------------------------------
1 | # The overall template of the release notes
2 | template: |
3 | Compatible with OpenSearch (**set version here**).
4 | $CHANGES
5 |
6 | # Setting the formatting and sorting for the release notes body
7 | name-template: Version (set version here)
8 | change-template: '* $TITLE (#$NUMBER)'
9 | sort-by: merged_at
10 | sort-direction: ascending
11 | replacers:
12 | - search: '##'
13 | replace: '###'
14 |
15 | # Organizing the tagged PRs into categories
16 | categories:
17 | - title: 'Breaking Changes'
18 | labels:
19 | - 'breaking'
20 | - title: 'Security'
21 | labels:
22 | - 'security fix'
23 | - title: 'Features'
24 | labels:
25 | - 'feature'
26 | - title: 'Enhancements'
27 | labels:
28 | - 'enhancement'
29 | - title: 'Bug Fixes'
30 | labels:
31 | - 'bug'
32 | - title: 'Infrastructure'
33 | labels:
34 | - 'infrastructure'
35 | - title: 'Documentation'
36 | labels:
37 | - 'documentation'
38 | - title: 'Maintenance'
39 | labels:
40 | - 'maintenance'
41 | - title: 'Refactoring'
42 | labels:
43 | - 'refactoring'
--------------------------------------------------------------------------------
/.github/workflows/CI.yml:
--------------------------------------------------------------------------------
1 | name: Build & Test Search Request Processor
2 | on:
3 | schedule:
4 | - cron: '0 0 * * *' # every night
5 | push:
6 | branches:
7 | - "*"
8 | - "feature/**"
9 | pull_request:
10 | branches:
11 | - "*"
12 | - "feature/**"
13 |
14 | jobs:
15 | Build-search-request-processor:
16 | strategy:
17 | matrix:
18 | java: [21]
19 | os: [ubuntu-latest, macos-latest, windows-latest]
20 |
21 | name: Build and Test Search Request Processor Plugin
22 | runs-on: ${{ matrix.os }}
23 |
24 | steps:
25 | - name: Checkout Search Request Processor
26 | uses: actions/checkout@v1
27 |
28 | - name: Setup Java ${{ matrix.java }}
29 | uses: actions/setup-java@v1
30 | with:
31 | java-version: ${{ matrix.java }}
32 |
33 | - name: Run build Windows
34 | if: ${{ matrix.os == 'windows-latest' }}
35 | run: |
36 | ./gradlew.bat build
37 |
38 | - name: Run non-Windows
39 | if: ${{ matrix.os != 'windows-latest' }}
40 | run: |
41 | ./gradlew build
42 |
43 | - name: Upload Coverage Report
44 | if: ${{matrix.os}} == 'ubuntu'
45 | uses: codecov/codecov-action@v1
46 | with:
47 | token: ${{ secrets.CODECOV_TOKEN }}
48 |
49 |
50 |
--------------------------------------------------------------------------------
/.github/workflows/add-untriaged.yml:
--------------------------------------------------------------------------------
1 | name: Apply 'untriaged' label during issue lifecycle
2 |
3 | on:
4 | issues:
5 | types: [opened, reopened, transferred]
6 |
7 | jobs:
8 | apply-label:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/github-script@v6
12 | with:
13 | script: |
14 | github.rest.issues.addLabels({
15 | issue_number: context.issue.number,
16 | owner: context.repo.owner,
17 | repo: context.repo.repo,
18 | labels: ['untriaged']
19 | })
20 |
--------------------------------------------------------------------------------
/.github/workflows/backport.yml:
--------------------------------------------------------------------------------
1 | name: Backport
2 | on:
3 | pull_request_target:
4 | types:
5 | - closed
6 | - labeled
7 |
8 | jobs:
9 | backport:
10 | runs-on: ubuntu-latest
11 | permissions:
12 | contents: write
13 | pull-requests: write
14 | name: Backport
15 | steps:
16 | - name: GitHub App token
17 | id: github_app_token
18 | uses: tibdex/github-app-token@v1.5.0
19 | with:
20 | app_id: ${{ secrets.APP_ID }}
21 | private_key: ${{ secrets.APP_PRIVATE_KEY }}
22 | installation_id: 22958780
23 |
24 | - name: Backport
25 | uses: VachaShah/backport@v1.1.4
26 | with:
27 | github_token: ${{ steps.github_app_token.outputs.token }}
28 | branch_name: backport/backport-${{ github.event.number }}
29 |
--------------------------------------------------------------------------------
/.github/workflows/backwards_compatibility_tests_workflow.yml:
--------------------------------------------------------------------------------
1 | name: Backwards Compatibility Tests Search Request Processor
2 | on:
3 | push:
4 | branches:
5 | - "*"
6 | - "feature/**"
7 | pull_request:
8 | branches:
9 | - "*"
10 | - "feature/**"
11 |
12 | jobs:
13 | Restart-Upgrade-BWCTests-k-NN:
14 | strategy:
15 | matrix:
16 | java: [ 21 ]
17 | bwc_version : [ "2.7.0" ]
18 | opensearch_version : [ "3.0.0-SNAPSHOT" ]
19 |
20 | name: SRP Restart-Upgrade BWC Tests
21 | runs-on: ubuntu-latest
22 | env:
23 | BWC_VERSION_RESTART_UPGRADE: ${{ matrix.bwc_version }}
24 |
25 | steps:
26 | - name: Checkout SRP
27 | uses: actions/checkout@v1
28 |
29 | - name: Setup Java ${{ matrix.java }}
30 | uses: actions/setup-java@v1
31 | with:
32 | java-version: ${{ matrix.java }}
33 |
34 | # Comments intentional; these workflow scripts are copied from k-NN and we are reverse engineering them; missing qa directory fails the workflow here
35 | # - name: Run SRP Restart-Upgrade BWC Tests from BWCVersion-${{ matrix.bwc_version }} to OpenSearch Version-${{ matrix.opensearch_version }}
36 | # run: |
37 | # echo "Running restart-upgrade backwards compatibility tests ..."
38 | # ./gradlew :qa:restart-upgrade:testRestartUpgrade -Dtests.bwc.version=$BWC_VERSION_RESTART_UPGRADE
39 |
40 |
41 | Rolling-Upgrade-BWCTests-SRP:
42 | strategy:
43 | matrix:
44 | java: [ 21 ]
45 | bwc_version: [ "2.11.1" ]
46 | opensearch_version: [ "3.0.0-SNAPSHOT" ]
47 |
48 | name: SRP Rolling-Upgrade BWC Tests
49 | runs-on: ubuntu-latest
50 | env:
51 | BWC_VERSION_ROLLING_UPGRADE: ${{ matrix.bwc_version }}
52 |
53 | steps:
54 | - name: Checkout SRP
55 | uses: actions/checkout@v1
56 |
57 | - name: Setup Java ${{ matrix.java }}
58 | uses: actions/setup-java@v1
59 | with:
60 | java-version: ${{ matrix.java }}
61 |
62 | # - name: Install dependencies
63 | # run: |
64 | # sudo apt-get install libopenblas-dev gfortran -y
65 |
66 | # - name: Run SRP Rolling-Upgrade BWC Tests from BWCVersion-${{ matrix.bwc_version }} to OpenSearch Version-${{ matrix.opensearch_version }}
67 | # run: |
68 | # echo "Running rolling-upgrade backwards compatibility tests ..."
69 | # ./gradlew :qa:rolling-upgrade:testRollingUpgrade -Dtests.bwc.version=$BWC_VERSION_ROLLING_UPGRADE
70 |
--------------------------------------------------------------------------------
/.github/workflows/create-documentation-issue.yml:
--------------------------------------------------------------------------------
1 | name: Create Documentation Issue
2 | on:
3 | pull_request:
4 | types:
5 | - labeled
6 | env:
7 | PR_NUMBER: ${{ github.event.number }}
8 |
9 | jobs:
10 | create-issue:
11 | if: ${{ github.event.label.name == 'needs-documentation' }}
12 | runs-on: ubuntu-latest
13 | name: Create Documentation Issue
14 | steps:
15 | - name: GitHub App token
16 | id: github_app_token
17 | uses: tibdex/github-app-token@v1.5.0
18 | with:
19 | app_id: ${{ secrets.APP_ID }}
20 | private_key: ${{ secrets.APP_PRIVATE_KEY }}
21 | installation_id: 22958780
22 |
23 | - name: Checkout code
24 | uses: actions/checkout@v2
25 |
26 | - name: Edit the issue template
27 | run: |
28 | echo "https://github.com/opensearch-project/search-processor/pull/${{ env.PR_NUMBER }}." >> ./.github/ISSUE_TEMPLATE/documentation-issue.md
29 |
30 | - name: Create Issue From File
31 | id: create-issue
32 | uses: peter-evans/create-issue-from-file@v4
33 | with:
34 | title: Add documentation related to new feature
35 | content-filepath: ./.github/ISSUE_TEMPLATE/documentation-issue.md
36 | labels: documentation
37 | repository: opensearch-project/documentation-website
38 | token: ${{ steps.github_app_token.outputs.token }}
39 |
40 | - name: Print Issue
41 | run: echo Created related documentation issue ${{ steps.create-issue.outputs.issue-number }}
42 |
--------------------------------------------------------------------------------
/.github/workflows/delete_backport_branch.yml:
--------------------------------------------------------------------------------
1 | name: Delete merged branch of the backport PRs
2 | on:
3 | pull_request:
4 | types:
5 | - closed
6 |
7 | jobs:
8 | delete-branch:
9 | runs-on: ubuntu-latest
10 | if: startsWith(github.event.pull_request.head.ref,'backport-')
11 | steps:
12 | - name: Delete merged branch
13 | uses: SvanBoxel/delete-merged-branch@main
14 | env:
15 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
--------------------------------------------------------------------------------
/.github/workflows/dependabot_pr.yml:
--------------------------------------------------------------------------------
1 | name: Dependabot PR actions
2 | on: pull_request
3 |
4 | jobs:
5 | dependabot:
6 | runs-on: ubuntu-latest
7 | permissions:
8 | pull-requests: write
9 | contents: write
10 | if: ${{ github.actor == 'dependabot[bot]' }}
11 | steps:
12 | - name: GitHub App token
13 | id: github_app_token
14 | uses: tibdex/github-app-token@v1.5.0
15 | with:
16 | app_id: ${{ secrets.APP_ID }}
17 | private_key: ${{ secrets.APP_PRIVATE_KEY }}
18 | installation_id: 22958780
19 |
20 | - name: Check out code
21 | uses: actions/checkout@v2
22 | with:
23 | token: ${{ steps.github_app_token.outputs.token }}
24 |
25 | - name: Update Gradle SHAs
26 | run: |
27 | ./gradlew updateSHAs
28 |
29 | - name: Commit the changes
30 | uses: stefanzweifel/git-auto-commit-action@v4.7.2
31 | with:
32 | commit_message: Updating SHAs
33 | branch: ${{ github.head_ref }}
34 | commit_user_name: dependabot[bot]
35 | commit_user_email: support@github.com
36 | commit_options: '--signoff'
37 |
38 | - name: Commit the changes
39 | uses: stefanzweifel/git-auto-commit-action@v4.7.2
40 | with:
41 | commit_message: Spotless formatting
42 | branch: ${{ github.head_ref }}
43 | commit_user_name: dependabot[bot]
44 | commit_user_email: support@github.com
45 | commit_options: '--signoff'
46 |
47 | - name: Update the changelog
48 | uses: dangoslen/dependabot-changelog-helper@v1
49 | with:
50 | version: 'Unreleased'
51 |
52 | - name: Commit the changes
53 | uses: stefanzweifel/git-auto-commit-action@v4
54 | with:
55 | commit_message: "Update changelog"
56 | branch: ${{ github.head_ref }}
57 | commit_user_name: dependabot[bot]
58 | commit_user_email: support@github.com
59 | commit_options: '--signoff'
--------------------------------------------------------------------------------
/.github/workflows/draft-release-notes-workflow.yml:
--------------------------------------------------------------------------------
1 | name: Release Drafter
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 |
8 | jobs:
9 | update_release_draft:
10 | name: Update draft release notes
11 | runs-on: ubuntu-latest
12 | steps:
13 | - name: Update draft release notes
14 | uses: release-drafter/release-drafter@v5
15 | with:
16 | config-name: draft-release-notes-config.yml
17 | name: Version (set here)
18 | tag: (None)
19 | env:
20 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
--------------------------------------------------------------------------------
/.github/workflows/links.yml:
--------------------------------------------------------------------------------
1 | name: Link Checker
2 | on:
3 | push:
4 | branches: [ main ]
5 | pull_request:
6 | branches: [ main ]
7 |
8 | jobs:
9 | linkchecker:
10 |
11 | runs-on: ubuntu-latest
12 |
13 | steps:
14 | - uses: actions/checkout@v2
15 | - name: lychee Link Checker
16 | id: lychee
17 | uses: lycheeverse/lychee-action@master
18 | with:
19 | args: --accept=200,403,429 **/*.html **/*.md **/*.txt **/*.json
20 | env:
21 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
22 | - name: Fail if there were link errors
23 | run: exit ${{ steps.lychee.outputs.exit_code }}
--------------------------------------------------------------------------------
/.github/workflows/pr_stats.yml:
--------------------------------------------------------------------------------
1 | name: Pull Request Stats
2 |
3 | on:
4 | pull_request:
5 | types: [opened]
6 |
7 | jobs:
8 | stats:
9 | runs-on: ubuntu-latest
10 | permissions:
11 | contents: read
12 | pull-requests: write
13 | steps:
14 | - name: Run pull request stats
15 | uses: flowwer-dev/pull-request-stats@master
16 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | **/build/
3 | !src/**/build/
4 |
5 | # Ignore Gradle GUI config
6 | gradle-app.setting
7 |
8 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
9 | !gradle-wrapper.jar
10 |
11 | # Avoid ignore Gradle wrappper properties
12 | !gradle-wrapper.properties
13 |
14 | # Cache of project
15 | .gradletasknamecache
16 |
17 | # Eclipse Gradle plugin generated files
18 | # Eclipse Core
19 | .project
20 | # JDT-specific (Eclipse Java Development Tools)
21 | .classpath
22 |
23 | # Intellij files
24 | .idea/
25 |
26 | # Compiled class file
27 | *.class
28 |
29 | # Log file
30 | *.log
31 |
32 | # BlueJ files
33 | *.ctxt
34 |
35 | # Mobile Tools for Java (J2ME)
36 | .mtj.tmp/
37 |
38 | # Package Files #
39 | *.jar
40 | *.war
41 | *.nar
42 | *.ear
43 | *.zip
44 | *.tar.gz
45 | *.rar
46 |
47 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
48 | hs_err_pid*
49 | replay_pid*
50 |
51 | *~
52 |
53 | # temporary files which can be created if a process still has a handle open of a deleted file
54 | .fuse_hidden*
55 |
56 | # KDE directory preferences
57 | .directory
58 |
59 | # Linux trash folder which might appear on any partition or disk
60 | .Trash-*
61 |
62 | # .nfs files are created when an open file is removed but is still being accessed
63 | .nfs*
64 |
65 | # General
66 | .DS_Store
67 | .AppleDouble
68 | .LSOverride
69 |
70 | # Icon must end with two \r
71 | Icon
72 |
73 |
74 | # Thumbnails
75 | ._*
76 |
77 | # Files that might appear in the root of a volume
78 | .DocumentRevisions-V100
79 | .fseventsd
80 | .Spotlight-V100
81 | .TemporaryItems
82 | .Trashes
83 | .VolumeIcon.icns
84 | .com.apple.timemachine.donotpresent
85 |
86 | # Directories potentially created on remote AFP share
87 | .AppleDB
88 | .AppleDesktop
89 | Network Trash Folder
90 | Temporary Items
91 | .apdisk
92 |
--------------------------------------------------------------------------------
/.whitesource:
--------------------------------------------------------------------------------
1 | {
2 | "scanSettings": {
3 | "configMode": "AUTO",
4 | "configExternalURL": "",
5 | "projectToken": "",
6 | "baseBranches": []
7 | },
8 | "checkRunSettings": {
9 | "vulnerableCheckRunConclusionLevel": "failure",
10 | "displayMode": "diff",
11 | "useMendCheckNames": true
12 | },
13 | "issueSettings": {
14 | "minSeverityLevel": "LOW",
15 | "issueType": "DEPENDENCY"
16 | },
17 | "remediateSettings": {
18 | "workflowRules": {
19 | "enabled": true
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/ADMINS.md:
--------------------------------------------------------------------------------
1 | ## Overview
2 |
3 | This document explains who the admins are (see below), what they do in this repo, and how they should be doing it. If you're interested in becoming a maintainer, see [MAINTAINERS](MAINTAINERS.md). If you're interested in contributing, see [CONTRIBUTING](CONTRIBUTING.md).
4 |
5 | ## Current Admins
6 |
7 | | Admin | GitHub ID | Affiliation |
8 | | --------------- | --------------------------------------- | ----------- |
9 | | Charlotte Henkle| [CEHENKLE](https://github.com/CEHENKLE) | Amazon |
10 | | Henri Yandell | [hyandell](https://github.com/hyandell) | Amazon |
11 | | Anirudha Jadhav | [anirudha](https://github.com/anirudha) | Amazon |
12 | | Mark Cohen | [macohen](https://github.com/macohen) | Amazon |
13 |
14 | ## Admin Responsibilities
15 |
16 | As an admin you own stewardship of the repository and its settings. Admins have [admin-level permissions on a repository](https://docs.github.com/en/organizations/managing-access-to-your-organizations-repositories/repository-permission-levels-for-an-organization). Use those privileges to serve the community and protect the repository as follows.
17 |
18 | ### Prioritize Security
19 |
20 | Security is your number one priority. Manage security keys and safeguard access to the repository.
21 |
22 | Note that this repository is monitored and supported 24/7 by Amazon Security, see [Reporting a Vulnerability](SECURITY.md) for details.
23 |
24 | ### Enforce Code of Conduct
25 |
26 | Act on [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) violations by revoking access, and blocking malicious actors.
27 |
28 | ### Adopt Organizational Best Practices
29 |
30 | Adopt organizational best practices, work in the open, and collaborate with other admins by opening issues before making process changes. Prefer consistency, and avoid diverging from practices in the opensearch-project organization.
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 |
2 | This code of conduct applies to all spaces provided by the OpenSource project including in code, documentation, issue trackers, mailing lists, chat channels, wikis, blogs, social media and any other communication channels used by the project.
3 |
4 |
5 | **Our open source communities endeavor to:**
6 |
7 | * Be Inclusive: We are committed to being a community where everyone can join and contribute. This means using inclusive and welcoming language.
8 | * Be Welcoming: We are committed to maintaining a safe space for everyone to be able to contribute.
9 | * Be Respectful: We are committed to encouraging differing viewpoints, accepting constructive criticism and work collaboratively towards decisions that help the project grow. Disrespectful and unacceptable behavior will not be tolerated.
10 | * Be Collaborative: We are committed to supporting what is best for our community and users. When we build anything for the benefit of the project, we should document the work we do and communicate to others on how this affects their work.
11 |
12 |
13 | **Our Responsibility. As contributors, members, or bystanders we each individually have the responsibility to behave professionally and respectfully at all times. Disrespectful and unacceptable behaviors include, but are not limited to:**
14 |
15 | * The use of violent threats, abusive, discriminatory, or derogatory language;
16 | * Offensive comments related to gender, gender identity and expression, sexual orientation, disability, mental illness, race, political or religious affiliation;
17 | * Posting of sexually explicit or violent content;
18 | * The use of sexualized language and unwelcome sexual attention or advances;
19 | * Public or private harassment of any kind;
20 | * Publishing private information, such as physical or electronic address, without permission;
21 | * Other conduct which could reasonably be considered inappropriate in a professional setting;
22 | * Advocating for or encouraging any of the above behaviors.
23 | * Enforcement and Reporting Code of Conduct Issues:
24 |
25 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported. [Contact us](mailto:opensource-codeofconduct@amazon.com). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances.
26 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ## Contributing to this Project
2 |
3 | OpenSearch is a community project that is built and maintained by people just like **you**.
4 | [This document](https://github.com/opensearch-project/.github/blob/main/CONTRIBUTING.md) explains how you can contribute to this and related projects.
5 |
--------------------------------------------------------------------------------
/MAINTAINERS.md:
--------------------------------------------------------------------------------
1 | ## Overview
2 |
3 | This document contains a list of maintainers in this repo. See [opensearch-project/.github/RESPONSIBILITIES.md](https://github.com/opensearch-project/.github/blob/main/RESPONSIBILITIES.md#maintainer-responsibilities) that explains what the role of maintainer means, what maintainers do in this and other repos, and how they should be doing it. If you're interested in contributing, and becoming a maintainer, see [CONTRIBUTING](CONTRIBUTING.md).
4 |
5 | ## Current Maintainers
6 |
7 | | Maintainer | GitHub ID | Affiliation |
8 | | --------------- | ----------------------------------------- | ----------- |
9 | | Michael Froh | [msfroh](https://github.com/msfroh) | Amazon |
10 | | Mark Cohen | [macohen](https://github.com/macohen) | Amazon |
11 | | Louis Chu | [noCharger](https://github.com/noCharger) | Amazon |
12 | | Mingshi Liu | [mingshl](https://github.com/mingshl) | Amazon |
13 | | Sean Li | [sejli](https://github.com/sejli) | Amazon |
14 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | OpenSearch (https://opensearch.org/)
2 | Copyright OpenSearch Contributors
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://github.com/opensearch-project/search-processor/actions/workflows/CI.yml)
2 | [](https://codecov.io/gh/opensearch-project/search-processor)
3 | 
4 |
5 | # Search Rerankers: AWS Kendra & AWS Personalize
6 | - [Welcome!](#welcome)
7 | - [Project Resources](#project-resources)
8 | - [Code of Conduct](#code-of-conduct)
9 | - [License](#license)
10 | - [Copyright](#copyright)
11 |
12 | ## Welcome!
13 | This repository hosts the code for two self-install re-rankers that integrate into [Search Pipelines](https://opensearch.org/docs/latest/search-plugins/search-pipelines/index/). User documentation for the Personalize Reranker is [here](https://opensearch.org/docs/latest/search-plugins/search-pipelines/personalize-search-ranking/). For Kendra, it is [here](https://opensearch.org/docs/latest/search-plugins/search-relevance/index/#reranking-results-with-kendra-intelligent-ranking-for-opensearch).
14 |
15 | # Search Processors: Where Do They Go?
16 | The current guideline for developing processors is that if you are developing a processor that would introduce new dependencies in [OpenSearch Core](https://github.com/opensearch-project/OpenSearch) (e.g. new libraries, makes a network connection outside of OpenSearch), it should be in a separate repository. Please consider creating it in a standalone repository since each processor should be thought of like a \*NIX command with input and output connected by pipes (i.e. a Search Pipeline). Each processor should do one thing and do it well. Otherwise, it could go into the OpenSearch repository under [org.opensearch.search.pipeline.common](https://github.com/opensearch-project/OpenSearch/tree/a08d588691c3b232e65d73b0a0c2fc5c72c870cf/modules/search-pipeline-common). If you have doubts, just create an issue in OpenSearch Core and, if you have one, a new PR. Maintainers will help guide you.
17 |
18 |
19 | # History
20 | This repository has also been used for discussion and ideas around search relevance. These discussions still exist here, however due to the relatively new standard of having one repo per plugin in OpenSearch and our implementations beginning to make it into the OpenSearch build, we have two repositories now. This repository will develop into a plugin that will allow OpenSearch users to rewrite search queries, rerank results, and log data about those actions. The other repository, [dashboards-search-relevance](https://www.github.com/opensearch-projects/dashboards-search-relevance), is where we will build front-end tooling to help relevance engineers and business users tune results.
21 |
22 | ## Project Resources
23 |
24 | * [OpenSearch Project Website](https://opensearch.org/)
25 | * [Downloads](https://opensearch.org/downloads.html)
26 | * [Project Principles](https://opensearch.org/#principles)
27 | * [Search Pipelines](https://opensearch.org/docs/latest/search-plugins/search-pipelines/index/)
28 | * [Contributing to OpenSearch Search Request Processor](CONTRIBUTING.md)
29 | * [Search Relevance](RELEVANCE.md)
30 | * [Maintainer Responsibilities](MAINTAINERS.md)
31 | * [Release Management](RELEASING.md)
32 | * [Admin Responsibilities](ADMINS.md)
33 | * [Security](SECURITY.md)
34 |
35 |
36 | ## Code of Conduct
37 |
38 | This project has adopted the [Amazon Open Source Code of Conduct](CODE_OF_CONDUCT.md). For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq), or contact [opensource-codeofconduct@amazon.com](mailto:opensource-codeofconduct@amazon.com) with any additional questions or comments.
39 |
40 | ## License
41 |
42 | This project is licensed under the [Apache v2.0 License](LICENSE).
43 |
44 | ## Copyright
45 |
46 | Copyright OpenSearch Contributors. See [NOTICE](NOTICE) for details.
47 |
--------------------------------------------------------------------------------
/RELEASING.md:
--------------------------------------------------------------------------------
1 | This project follows the [OpenSearch release process](https://github.com/opensearch-project/.github/blob/main/RELEASING.md).
--------------------------------------------------------------------------------
/RELEVANCE.md:
--------------------------------------------------------------------------------
1 | # Search Relevance
2 |
3 | ## Overview
4 |
5 | In a search engine, the relevance is the measure of the relationship accuracy between the search query and the search result. Higher the relevance is, the higher is the quality of search result and the users are able to get more relevant content. This project aims to add plugins to OpenSearch to help users make their query results more accurate, contextual and relevant.
6 |
7 | ## Relevancy and OpenSearch
8 |
9 | Today, OpenSearch provides results in the order of scores generated by algorithms matching the indexed document contents to the input query. The documents that are more relevant to the query are ranked higher than the ones that are less relevant. These rankings may make sense to one set of users/applications and for others it may be very irrelevant. For example, relevancy for an E-commerce company can mean more similar products in the same category of the search query. While for a document search relevancy may mean, searching the query across different topics/categories present in the document store. This is why, we need more ways to customize the results and its rankings as per the need of the user/business.
10 |
11 | ## Relevancy Engineering
12 |
13 | Relevancy as a problem, can’t just be solved at the search layer. Improving relevancy should be envisioned holistically from understanding the ingested data and usage signals to extracting feature, adding re-writers and improving algorithms. Below is the architecture of OpenSearch Relevancy Engineering.
14 |
15 |
16 |
17 |
18 | [Initially presented at Haystack 2022 by @anirudha , @JohannesDaniel and @ps48].
19 |
20 |
21 | Overall the Relevancy Engineering can be divided into two tiers:
22 |
23 | 1. **Ingestion Tier:** This tier handles getting the data from different sources to OpenSearch. This data may include:
24 | 1. Search Data:
25 | 1. Core search data, that needs to be queried on by OpenSearch
26 | 2. Ingestion connectors to fetch the data from different data sources and sink in OpenSearch indices.
27 | 2. Search Management Data:
28 | 1. Adding rules and judgements to the rewriter indices.
29 | 3. Observability Data:
30 | 1. Adding customer usage signals to OpenSearch, these signals may include granular details like anonymized customer queries, clicks, orders and session details.
31 | 2. **Search & Relevancy Platform Tier:** This tier is responsible for analytics, re-wrtiers, model improvements and adding search configurations.
32 | 1. Search Analytics & Discovery:
33 | 1. Dashboards for analytics, metrics for search tests, search UIs and query profiling.
34 | 2. Querqy based query Rewriting:
35 | 1. Rewriters to customize queries with synonyms, word-breaks, spell corrections, query relaxation.
36 | 3. Search Back Office:
37 | 1. Manage business rules, ontologies and manual judgments.
38 | 4. Relevancy workbench:
39 | 1. Improve algorithms with automated testing, relevance model trainings, personalizations and custom re-rankers.
40 | ### [RFC Search Relevance](https://github.com/opensearch-project/search-processor/issues/1)
41 |
42 | ## Contributing
43 |
44 | See [developer guide](https://github.com/opensearch-project/opensearch-plugins/blob/main/BUILDING.md#developing-new-plugins-for-opensearch) and [how to contribute to this project](CONTRIBUTING.md).
45 |
46 | ## Getting Help
47 |
48 | If you find a bug, or have a feature request, please don't hesitate to open an issue in this repository.
49 |
50 | For more information, see [project website](https://opensearch.org/) and [documentation](https://opensearch.org/docs). If you need help and are unsure where to open an issue, try [forums](https://forum.opensearch.org/).
51 |
52 | ## Security
53 |
54 | If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public GitHub issue.
55 |
56 | ## License
57 |
58 | This project is licensed under the [Apache v2.0 License](LICENSE).
59 |
60 | ## Copyright
61 |
62 | Copyright OpenSearch Contributors. See [NOTICE](NOTICE) for details.
63 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | ## Reporting a Vulnerability
2 |
3 | If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/) or directly via email to aws-security@amazon.com. Please do **not** create a public GitHub issue.
--------------------------------------------------------------------------------
/amazon-kendra-intelligent-ranking/build.gradle:
--------------------------------------------------------------------------------
1 | import org.opensearch.gradle.test.RestIntegTestTask
2 |
3 | apply plugin: 'java'
4 | apply plugin: 'idea'
5 | apply plugin: 'opensearch.opensearchplugin'
6 | apply plugin: 'opensearch.yaml-rest-test'
7 | apply plugin: 'jacoco'
8 |
9 | group = 'org.opensearch'
10 |
11 | def pluginName = 'amazon-kendra-intelligent-ranking'
12 | def pluginDescription = 'Rerank search results using Amazon Kendra Intelligent Ranking'
13 | def projectPath = 'org.opensearch'
14 | def pathToPlugin = 'search.relevance'
15 | def pluginClassName = 'AmazonKendraIntelligentRankingPlugin'
16 |
17 | opensearchplugin {
18 | name "opensearch-${pluginName}-${plugin_version}.0"
19 | version "${plugin_version}"
20 | description pluginDescription
21 | classname "${projectPath}.${pathToPlugin}.${pluginClassName}"
22 | licenseFile rootProject.file('LICENSE')
23 | noticeFile rootProject.file('NOTICE')
24 | }
25 |
26 | java {
27 | targetCompatibility = JavaVersion.VERSION_21
28 | sourceCompatibility = JavaVersion.VERSION_21
29 | }
30 |
31 | // This requires an additional Jar not published as part of build-tools
32 | loggerUsageCheck.enabled = false
33 |
34 | // No need to validate pom, as we do not upload to maven/sonatype
35 | validateNebulaPom.enabled = false
36 |
37 | buildscript {
38 | repositories {
39 | mavenLocal()
40 | maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
41 | mavenCentral()
42 | maven { url "https://plugins.gradle.org/m2/" }
43 | }
44 |
45 | dependencies {
46 | classpath "org.opensearch.gradle:build-tools:${opensearch_version}"
47 | }
48 | }
49 |
50 | repositories {
51 | mavenLocal()
52 | maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
53 | mavenCentral()
54 | maven { url "https://plugins.gradle.org/m2/" }
55 | }
56 |
57 | dependencies {
58 | implementation 'com.ibm.icu:icu4j:57.2'
59 | implementation 'org.apache.httpcomponents:httpclient:4.5.14'
60 | implementation 'org.apache.httpcomponents:httpcore:4.4.16'
61 | implementation 'com.fasterxml.jackson.core:jackson-databind:2.18.2'
62 | implementation 'com.fasterxml.jackson.core:jackson-core:2.18.2'
63 | implementation 'com.fasterxml.jackson.core:jackson-annotations:2.18.2'
64 | implementation 'commons-logging:commons-logging:1.2'
65 | implementation 'com.amazonaws:aws-java-sdk-sts:1.12.300'
66 | implementation 'com.amazonaws:aws-java-sdk-core:1.12.300'
67 | }
68 |
69 |
70 | allprojects {
71 | plugins.withId('jacoco') {
72 | jacoco.toolVersion = '0.8.9'
73 | }
74 | }
75 |
76 |
77 | test {
78 | include '**/*Tests.class'
79 | finalizedBy jacocoTestReport
80 | }
81 |
82 | task integTest(type: RestIntegTestTask) {
83 | description = "Run tests against a cluster"
84 | testClassesDirs = sourceSets.test.output.classesDirs
85 | classpath = sourceSets.test.runtimeClasspath
86 | }
87 | tasks.named("check").configure { dependsOn(integTest) }
88 |
89 | integTest {
90 | // The --debug-jvm command-line option makes the cluster debuggable; this makes the tests debuggable
91 | if (System.getProperty("test.debug") != null) {
92 | jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005'
93 | }
94 | }
95 |
96 | testClusters.integTest {
97 | testDistribution = "ARCHIVE"
98 |
99 | // This installs our plugin into the testClusters
100 | plugin(project.tasks.bundlePlugin.archiveFile)
101 | }
102 |
103 | run {
104 | useCluster testClusters.integTest
105 | }
106 |
107 | jacocoTestReport {
108 | dependsOn test
109 | reports {
110 | xml.required = true
111 | html.required = true
112 | }
113 | }
114 |
115 | // TODO: Enable these checks
116 | dependencyLicenses.enabled = false
117 | thirdPartyAudit.enabled = false
118 | loggerUsageCheck.enabled = false
119 |
--------------------------------------------------------------------------------
/amazon-kendra-intelligent-ranking/src/main/java/org/opensearch/search/relevance/AmazonKendraIntelligentRankingPlugin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 | package org.opensearch.search.relevance;
9 |
10 | import org.opensearch.action.support.ActionFilter;
11 | import org.opensearch.client.Client;
12 | import org.opensearch.cluster.metadata.IndexNameExpressionResolver;
13 | import org.opensearch.cluster.service.ClusterService;
14 | import org.opensearch.common.settings.Setting;
15 | import org.opensearch.core.common.io.stream.NamedWriteableRegistry;
16 | import org.opensearch.core.xcontent.NamedXContentRegistry;
17 | import org.opensearch.env.Environment;
18 | import org.opensearch.env.NodeEnvironment;
19 | import org.opensearch.plugins.ActionPlugin;
20 | import org.opensearch.plugins.Plugin;
21 | import org.opensearch.plugins.SearchPipelinePlugin;
22 | import org.opensearch.plugins.SearchPlugin;
23 | import org.opensearch.repositories.RepositoriesService;
24 | import org.opensearch.script.ScriptService;
25 | import org.opensearch.search.pipeline.Processor;
26 | import org.opensearch.search.pipeline.SearchResponseProcessor;
27 | import org.opensearch.search.relevance.actionfilter.SearchActionFilter;
28 | import org.opensearch.search.relevance.client.OpenSearchClient;
29 | import org.opensearch.search.relevance.configuration.ResultTransformerConfigurationFactory;
30 | import org.opensearch.search.relevance.configuration.SearchConfigurationExtBuilder;
31 | import org.opensearch.search.relevance.transformer.ResultTransformer;
32 | import org.opensearch.search.relevance.transformer.kendraintelligentranking.KendraIntelligentRanker;
33 | import org.opensearch.search.relevance.transformer.kendraintelligentranking.client.KendraClientSettings;
34 | import org.opensearch.search.relevance.transformer.kendraintelligentranking.client.KendraHttpClient;
35 | import org.opensearch.search.relevance.transformer.kendraintelligentranking.configuration.KendraIntelligentRankerSettings;
36 | import org.opensearch.search.relevance.transformer.kendraintelligentranking.configuration.KendraIntelligentRankingConfigurationFactory;
37 | import org.opensearch.search.relevance.transformer.kendraintelligentranking.pipeline.KendraRankingResponseProcessor;
38 | import org.opensearch.threadpool.ThreadPool;
39 | import org.opensearch.watcher.ResourceWatcherService;
40 |
41 | import java.util.ArrayList;
42 | import java.util.Arrays;
43 | import java.util.Collection;
44 | import java.util.List;
45 | import java.util.Map;
46 | import java.util.function.Supplier;
47 | import java.util.stream.Collectors;
48 |
49 | public class AmazonKendraIntelligentRankingPlugin extends Plugin implements ActionPlugin, SearchPlugin, SearchPipelinePlugin {
50 |
51 | private OpenSearchClient openSearchClient;
52 | private KendraHttpClient kendraClient;
53 | private KendraIntelligentRanker kendraIntelligentRanker;
54 | private KendraClientSettings kendraClientSettings;
55 |
56 | private Collection getAllResultTransformers() {
57 | // Initialize and add other transformers here
58 | return List.of(this.kendraIntelligentRanker);
59 | }
60 |
61 | private Collection getResultTransformerConfigurationFactories() {
62 | return List.of(KendraIntelligentRankingConfigurationFactory.INSTANCE);
63 | }
64 |
65 | @Override
66 | public List getActionFilters() {
67 | return Arrays.asList(new SearchActionFilter(getAllResultTransformers(), openSearchClient));
68 | }
69 |
70 | @Override
71 | public List> getSettings() {
72 | // NOTE: cannot use kendraIntelligentRanker.getTransformerSettings because the object is not yet created
73 | List> allTransformerSettings = new ArrayList<>();
74 | allTransformerSettings.addAll(KendraIntelligentRankerSettings.getAllSettings());
75 | // Add settings for other transformers here
76 | return allTransformerSettings;
77 | }
78 |
79 | @Override
80 | public Collection