-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat(api): enhance /search
endpoint with flexible filtering and dynamic aggregations
#155
base: staging
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
147de66
to
d91b8b2
Compare
d91b8b2
to
25d498f
Compare
25d498f
to
bdd0bb1
Compare
bdd0bb1
to
547cfb8
Compare
547cfb8
to
2c4e9b8
Compare
27e6de5
to
2bcc1ec
Compare
}, | ||
}; | ||
const buildFilterQueryClause = (filter: Facet): QueryDslQueryContainer => { | ||
if (Array.isArray(filter.value)) { |
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.
In what situation would you have the filter value as an array?
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.
cc: @kouloumos
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.
An array filter means OR clause between the filters in the array. For more you can read the comment on the line below this or the extended explanation in the connected issue.
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.
Works good! (Tested with postman)
@kouloumos can you rebase on staging |
0647ce3
to
7158263
Compare
Add support for filter operations (include/exclude), OR logic via array values, dynamic aggregation fields and sub-aggregations in the search API. Allow switching between default and coredev indices. This consolidates search functionality across products by making the Bitcoin Search API more flexible while maintaining backward compatibility.
7158263
to
9e642c9
Compare
I just updated the PR with a change in the Explore Page that takes advantage of the newly introduced API functionality for switching between indices to allow exploration of documents on both of our indices. |
Just pushed an update that removes the need for index-related environment variables (
|
Introduces a flexible explore page that generalizes source exploration to handle domains, authors, and tags. Consolidates API usage by leveraging the existing /search endpoint with aggregations instead of specialized source endpoints. The new implementation uses reusable hooks for data fetching and provides threaded, flat, and summary view modes across different content types.
Removes /sources and /sourceDocuments endpoints and their associated hooks now that their functionality has been consolidated into the /search endpoint used by the explore interface.
9b54bf4
to
c4c1e7f
Compare
8c9a812
to
2e5a701
Compare
The application was previously using URLs to fetch document content, but URLs are not guaranteed to be unique across documents. Switch to using Elasticsearch document IDs which are guaranteed unique identifiers. Update types, API endpoints, and components to pass document IDs instead of URLs throughout the content fetching flow.
Implement index selector dropdown to toggle between default and coredev indexes throughout the explore page. Update all data fetching hooks and components to support index selection, including document exploration, thread views, and content modal. This enables users to seamlessly switch between different elasticsearch indices while maintaining consistent data fetching across all views.
Moves index names from environment variables to config.ts since they aren't sensitive data. This provides type-safety and makes it easier to add new indexes. Updates API endpoints, components and documentation to use the new configuration.
Adds a clickable code icon to search result cards when dev mode is enabled (via localStorage) that opens a modal showing the raw document data.
2e5a701
to
846159e
Compare
</div> | ||
|
||
{showModal && ( | ||
<DocumentModal |
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.
For devMode
in the results page, is there a reason fetching the document again?
we can pull the data already and pass it along to render. The only difference is data exempted from the main query, i.e summary_embeddings
will be unavaialable
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.
it makes it easier:
- it allows us to reuse the same component as is
- I don't need to care about moving data
- This is a mode that will not be used a lot
This PR is the first step towards addressing #154, enhancing the Bitcoin Search API with several new features and improvements:
Search API Enhancements:
For a deeper dive into the rationale and specifics of the new implementation, refer to Consolidate search functionality across products by enhancing Bitcoin Search API #154.
New
/explore
Page:/sources
page, generalizing document exploration to include sources, authors, and tags./search
endpoint for a unified exploration experience./search
API.Search Page Enhancements:
Set dev mode by running in the browser console:
Code Refactor: