-
Notifications
You must be signed in to change notification settings - Fork 6
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
Improve cacheability of filters #871
base: development
Are you sure you want to change the base?
Conversation
if ( filters != null ) { | ||
Iterator<Iterable<Filter>> it = filters.iterator(); | ||
if ( it.hasNext() ) { | ||
Set<Long> ids = new HashSet<>( doLoadIdsWithCache( Filters.by( IterableUtils.toList( it.next() ) ), null, true ) ); |
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 might not be worth to do this for every single filter.
Maybe having a list of properties that are expensive to filter by would be interesting.
* @author tesarst | ||
* @author poirigui | ||
*/ | ||
@Value | ||
@EqualsAndHashCode(of = { "objectAlias", "operator", "requiredValue" }) | ||
public class Filter implements PropertyMapping { | ||
@EqualsAndHashCode(of = { "objectAlias", "propertyName", "operator", "requiredValue" }) |
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.
This should be included immediatly in the dev branch and next patch release.
* | ||
* <p> | ||
* Clauses and sub-clauses are always sorted by objectAlias, propertyName, operator and requiredValue. A clause is | ||
* sorted by its first element, if any. |
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.
This is not correct, a clause is sorted lexicographically and a sub-clause as mentioned.
@@ -89,7 +89,7 @@ public CacheManager cacheManager() { | |||
@Test | |||
public void testFindTerm() throws OntologySearchException { | |||
Collection<OntologyTerm> matches = gos.findTerm( "toxin" ); | |||
assertEquals( 4, matches.size() ); | |||
assertEquals( 7, matches.size() ); |
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.
This shouldn't be here...
// assertThat( filters.iterator().next().get( 1 ) ) | ||
// .hasFieldOrPropertyWithValue( "propertyName", "c" ) | ||
// .hasFieldOrPropertyWithValue( "operator", Filter.Operator.eq ) | ||
// .hasFieldOrPropertyWithValue( "requiredValue", "d" ); |
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.
Uncomment and fix this test.
// assertThat( filters.iterator().next().get( 1 ) ) | ||
// .hasFieldOrPropertyWithValue( "propertyName", "c" ) | ||
// .hasFieldOrPropertyWithValue( "operator", Filter.Operator.eq ) | ||
// .hasFieldOrPropertyWithValue( "requiredValue", "d" ); |
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.
Uncomment and fix this test.
// assertThat( of.get( 1 ) ) | ||
// .hasFieldOrPropertyWithValue( "propertyName", "g" ) | ||
// .hasFieldOrPropertyWithValue( "operator", Filter.Operator.eq ) | ||
// .hasFieldOrPropertyWithValue( "requiredValue", "h" ); |
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.
Uncomment and fix this test.
// assertThat( of.get( 1 ) ) | ||
// .hasFieldOrPropertyWithValue( "propertyName", "e" ) | ||
// .hasFieldOrPropertyWithValue( "operator", Filter.Operator.eq ) | ||
// .hasFieldOrPropertyWithValue( "requiredValue", "f" ); |
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.
Uncomment and fix this test.
9c76424
to
068b152
Compare
84692c7
to
e0ec3da
Compare
Sort clauses and sub-clauses so that equivalent queries have identical filters. Implement padding to the next power-of-two by repeating the last element of a collection.
068b152
to
0b3ce18
Compare
This has to be rebased and tested again. I'll try to squeeze it in tomorrow's release. |
Sort clauses and sub-clauses so that equivalent queries have identical filters.
Implement padding to the next power-of-two by repeating the last element of a collection.
Break-up filters so we can cache expensive clauses and run simpler queries against the database.
Fix #869 and #870
TODO