Skip to content

Refactor the search endpoint to allow for customisation#10

Merged
johnf merged 4 commits intomainfrom
customsearch
Mar 18, 2026
Merged

Refactor the search endpoint to allow for customisation#10
johnf merged 4 commits intomainfrom
customsearch

Conversation

@alvinsw
Copy link
Member

@alvinsw alvinsw commented Mar 13, 2026

Changes required to allow user to customise opensearch search query and result:
Extract the codes for building the opensearch search query into an extendable class.
Added queryBuilderClass and queryBuilderOptions to the main Options.

@alvinsw alvinsw requested a review from johnf March 13, 2026 01:38
@johnf
Copy link
Collaborator

johnf commented Mar 15, 2026

@alvinsw Can you update so the linting tests pass.
Probably worth rebasing first. I've added lefthook to enforce conventional commits and linting before commit.

You can run the tests with pnpm test:ui

@github-actions
Copy link

github-actions bot commented Mar 18, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 100% (🎯 100%) 329 / 329
🔵 Statements 100% (🎯 100%) 339 / 339
🔵 Functions 100% (🎯 100%) 51 / 51
🔵 Branches 100% (🎯 100%) 159 / 159
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/app.ts 100% 100% 100% 100%
src/routes/search.ts 100% 100% 100% 100%
src/utils/queryBuilder.ts 100% 100% 100% 100%
Generated in workflow #42 for commit 17c6875 by the Vitest Coverage Report Action

Copy link
Collaborator

@johnf johnf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alvinsw this looks great!

I'd also like to aim for 100% test coverage.

You can dig into the coverage in the UI

All though I suspect if you remove the if around the logging statement it will jump back to 100% by itself.

Image

README.md Outdated

### Query Builder (Optional)
Use the `queryBuilderClass` optional parameter to specify a custom builder class.
If not apecified, the default `OpensearchQueryBuilder` is used.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo -> specified

@alvinsw
Copy link
Member Author

alvinsw commented Mar 18, 2026

@johnf I don't have time to fix the errors from the coverage checks. Can you you help with that or just remove the coverage checks for now.

@johnf
Copy link
Collaborator

johnf commented Mar 18, 2026

@alvinsw Let me know when you've made the other changes and I'll take a look

@johnf johnf merged commit 66c9ac8 into main Mar 18, 2026
1 check passed
@johnf johnf deleted the customsearch branch March 18, 2026 21:52
github-actions bot pushed a commit that referenced this pull request Mar 18, 2026
## [2.1.0](v2.0.4...v2.1.0) (2026-03-18)

### Features

* refactor the search endpoint to allow for customisation ([#10](#10)) ([66c9ac8](66c9ac8))
@github-actions
Copy link

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants