-
Notifications
You must be signed in to change notification settings - Fork 41
feat: add count(SelectQuery) support to Neo4J, Solr, Tinkerpop, OrientDB, and Oracle NoSQL #347
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
Open
dearrudam
wants to merge
31
commits into
main
Choose a base branch
from
optimize-count-queries
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Implemented a new method to build count queries for SelectQuery, enhancing the query capabilities for counting entities in Neo4J. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Implemented unit tests for building count queries with and without conditions in Neo4JQueryBuilder, ensuring correct Cypher query generation and parameter binding for the SelectQuery interface. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Implemented a count method for executing count queries on entities using the Neo4J database, enhancing query capabilities and ensuring proper error handling. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Implemented a test to verify the count functionality using SelectQuery, ensuring correct behavior and handling of null queries. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Implemented tests for counting entities by collection name and by SelectQuery, ensuring correct behavior and exception handling for null inputs. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Implemented a count method for SelectQuery to enhance query capabilities and improve performance in counting entities within the graph database. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Implemented a test to verify the count functionality using SelectQuery, ensuring accurate counting of entities in the graph database. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
…anagers Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Refactored Neo4JQueryBuilderTest to utilize the new buildCountQuery method for generating count queries, ensuring accurate query construction for counting entities. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Implemented tests for counting documents using SelectQuery, ensuring correct behavior for both valid and null inputs. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
…mentation Implemented a new count method in DefaultSolrDocumentManager to allow counting documents based on a SelectQuery, improving query capabilities and performance. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Updated the Neo4J query builder to utilize count queries and added a count method for SelectQuery in the Solr Document Manager implementation to enhance query capabilities. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Modified the count query in Neo4JQueryBuilder to return the count with an alias for better clarity in results. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
otaviojava
approved these changes
Dec 18, 2025
Contributor
|
Amazing @dearrudam as the previous one, don't forget tod o the backport on 1.1 |
Implemented a new method to generate count queries for the SelectQuery, enhancing the query capabilities of the QueryOSQLConverter. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Implemented a new method to convert SelectQuery to a count query, enhancing the query capabilities for counting documents. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Refactored the URL handling logic to ensure proper formatting of host URLs based on their type (embedded or remote), enhancing the robustness of the OrientDB connection setup. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Added tests for creating document manager factories for both remote and embedded databases, and included checks for unsupported URL formats to ensure proper exception handling. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Implemented a count method that executes a count query against the database, returning the total number of results for a given SelectQuery. This enhances the querying capabilities of the document manager. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Set up a GenericContainer for OrientDB to facilitate testing with a local instance, improving the reliability of database interactions during development. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Enhanced the test setup by adding necessary packages and dependencies to improve integration testing for the DefaultOrientDBTemplate. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Implemented a test to verify the count functionality with a select query in the OrientDBDocumentManager, ensuring accurate counting of inserted entities. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Refactored the integration test setup by adding necessary packages and removing obsolete system property settings to improve test reliability and maintainability. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Enhanced the integration test setup by adding necessary packages for OrientDBTemplate and Converters, ensuring better compatibility and functionality in tests. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Clarified the configuration property for `jnosql.orientdb.host` to specify options for remote and embedded databases, including a link to the OrientDB Javadoc for further details. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Implemented count query functionality in QueryOSQLConverter and QueryOSQLFactory, improved URL handling, and enhanced tests for OrientDBDocumentConfiguration. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Changed the return value from 0l to 0L for clarity and to adhere to Java conventions regarding long literals. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
…tBuilder for OracleNoSQL count queries support Updated the condition method to support a new parameter indicating whether the query is for a count operation, allowing for optimized handling of ID conditions. Introduced SelectCountBuilder class to facilitate building SQL count queries, enhancing query capabilities for the Oracle database integration. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Modified the condition method calls in DeleteBuilder and SelectBuilder to include an additional parameter for improved query handling. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Refactored assertions to use assertSoftly for better readability and added a new test to verify count queries with specific conditions in the OracleNoSQLDocumentManagerTest. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Implemented a new count method that accepts a SelectQuery object, allowing for more flexible counting of query results in the DefaultOracleNoSQLDocumentManager. Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
…tBuilder for OracleNoSQL support Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR implements
count(SelectQuery)support across five database drivers (Neo4J, Solr, Tinkerpop, OrientDB, and Oracle NoSQL), enabling optimized counting with complex query criteria instead of fetching and counting results in memory.Motivation
Currently, counting entities with complex query criteria requires fetching all results into memory and counting them, which is inefficient and resource-intensive. This PR introduces native count query support for each database, leveraging their built-in count capabilities for significantly better performance.
Implementation Details
Neo4J
count(SelectQuery)method toDefaultNeo4JDatabaseManagerNeo4JQueryBuilderto generate optimized Cypher count queriesCOUNT()function for efficient countingSolr
count(SelectQuery)method toDefaultSolrDocumentManagerTinkerpop
count(SelectQuery)method toDefaultTinkerpopGraphDatabaseManagerOrientDB
count(SelectQuery)method toDefaultOrientDBDocumentManagerQueryOSQLConverterto generate OSQL count queries with proper condition handlingQueryOSQLFactoryto support count query generationOrientDBDocumentManagerFactoryfor better connection managementOracle NoSQL
AbstractQueryBuilderfor better condition handlingSelectCountBuilderfor dedicated count query supportDefaultOracleNoSQLDocumentManagerto support SelectQuery count operationsTest Coverage
Documentation
CHANGELOG.adocwith count query features for all five database managersREADME.adocwith host configuration detailsBreaking Changes
None. This is a backward-compatible feature addition that extends existing functionality.
Performance Impact
This change significantly improves performance for count operations with query criteria by:
Related Issues
Part of the count query optimization initiative to improve performance across all JNoSQL database drivers.
Note: This PR builds upon previous work that added count support to MongoDB, Cassandra, ArangoDB, and Couchbase, completing the count(SelectQuery) implementation across the major database drivers in the JNoSQL ecosystem.