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
ISPN-14194 Add config property for default max result #10378
Conversation
<xs:attribute name="default-max-result" type="xs:integer" default="${Query.default-max-result}"> | ||
<xs:annotation> | ||
<xs:documentation> | ||
Applies the given value as maxResults as a default to any query (indexed, non-indexed and hybrid). |
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.
A suggestion:
Limits the number of results returned by a query. Applies to indexed, non-indexed, and hybrid queries. Setting the default-max-results significantly improves performance of queries that don't have an explicit limit set.
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.
Looks good to me
The name of the property should be plural ( |
Thank you for the review @dvagnero and @tristantarrant, going to apply the changes. |
66110c0
to
d702cd0
Compare
I applied the changes and fixed the last stuff. I'm writing my doc additions. |
@@ -104,6 +111,10 @@ public SearchQueryBuilder getSearchQueryBuilder() { | |||
return searchQueryBuilder; | |||
} | |||
|
|||
public boolean maxResultsHasChanged() { |
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.
I don't like the name. Maybe isCustomMaxResults()
?
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.
good idea. changed it
*/ | ||
public class QueryConfiguration extends AbstractTypedPropertiesConfiguration implements Matchable<QueryConfiguration> { | ||
|
||
public static final AttributeDefinition<Integer> DEFAULT_MAX_RESULTS = AttributeDefinition.builder(org.infinispan.configuration.parsing.Attribute.DEFAULT_MAX_RESULTS, 100).immutable().build(); |
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 now, immutable is fine, but in the future we could turn this into a runtime-mutable attribute. Can you create a Jira for it ?
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.
One small change in a method name. Otherwise LGTM
We may want to add some query benchmarks to https://github.com/infinispan/infinispan-benchmarks |
thanks @tristantarrant for the review! |
@dvagnero I made my attempt to document the (restored) behavior and the new property here: ISPN-14194 Document query default max results |
@wfink I don't know if you want to take a look at it |
== Query efficiency | ||
|
||
Restore the default query max results that used to be present in older Infinispan versions (prior of 12.1.5.Final) | ||
and provide a new configuration attribute to change this default, that is now restored to 100. | ||
Limiting the number of results returned by a query. Applies to indexed, non-indexed, and hybrid queries. | ||
It significantly improves performance of queries that don't have an explicit limit set. |
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.
== Query efficiency | |
Restore the default query max results that used to be present in older Infinispan versions (prior of 12.1.5.Final) | |
and provide a new configuration attribute to change this default, that is now restored to 100. | |
Limiting the number of results returned by a query. Applies to indexed, non-indexed, and hybrid queries. | |
It significantly improves performance of queries that don't have an explicit limit set. | |
== Query efficiency | |
The `default-max-results` property that was present in Infinispan 12.1.5.Final and earlier versions has been restored. | |
This property limits the number of results returned by a query and significantly improves performance of queries that don't have an explicit limit set. | |
The default value of `default-max-results` is 100. |
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.
Not quite @dvagnero : Infinispan never had a default-max-results
property. It just had a default, unmodifiable value for it.
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.
Thanks @dvagnero, I merged them:
The default query max results that was present in Infinispan 12.1.5.Final and earlier versions has been restored,
together with the fact that you can now also change this default by setting thequery.default-max-results
cache property.
Limiting the number of results returned by a query significantly improves performance of queries that don't have an explicit limit set.
The default value ofdefault-max-results
is 100.
@dvagnero what do you think of?
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.
Thanks! What about...
The default for maximum results returned by a query that was present in Infinispan 12.1.5.Final and earlier versions has been restored. You can now change the default limit by setting the default-max-results
cache property. The default value of default-max-results
is 100.
Limiting the number of results returned by a query significantly improves performance of queries that don't have an explicit limit set.
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.
sounds great to me... I'm applying it. Thanks
The default limit of `100` is applied if `maxResults` is not explicitly set to the query instance. | ||
You can change this default for all the queries by setting the cache property `query.default-max-result`. |
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.
The default limit of `100` is applied if `maxResults` is not explicitly set to the query instance. | |
You can change this default for all the queries by setting the cache property `query.default-max-result`. | |
NOTE | |
==== | |
If you don't explicitly set the `MaxResults` for a query instance, {brandname} limits the number of results returned by the query to `100`. | |
You can change the default limit by setting the `query.default-max-results` cache property. | |
==== |
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.
Applied, thanks!
I applied the changes to the docs, thanks @dvagnero! |
Both indexed and non-indexed
Both indexed and non-indexed
That is the way aggregations currently work, the inefficiency could be removed delegating them to Search! (see ISPN-13986)
-1 is not the infinite any more, it means apply the default, and the default is not the infinite anymore
Hybrid query, as they are, they require an unbounded max results, another reason to avoid using them
Co-authored-by: Dominika Vagnerova <dvagnero@redhat.com>
Applied the last changes from @dvagnero. |
In the previous run there were two thread leaks associated with indexing tests: ThreadLeakChecker – org.infinispan.query.api.ManualIndexingTest |
@tristantarrant I don't know how the current changes may affect those tests. I think that we could have the same failures on the main branch. |
Merged, thanks |
Thank you! |
https://issues.redhat.com/browse/ISPN-14194
Just the first step, that is adding the config property for it.ready for the reviewI'm writing the documentation