Comments (8)
You mean change the API from this:
QueryOption<Car> deduplicate = deduplicate(DeduplicationStrategy.LOGICAL_ELIMINATION);
QueryOption<Car> order = orderBy(Car.PRICE, Car.DOORS);
ResultSet<Car> results = cars.retrieve(lessThan(Car.PRICE, 5000.0), queryOptions(deduplicate, order));
To this?:
DeduplicationOption<Car> deduplicate = deduplicate(DeduplicationStrategy.LOGICAL_ELIMINATION);
OrderByOption<Car> order = orderBy(Car.PRICE, Car.DOORS);
ResultSet<Car> results = cars.retrieve(lessThan(Car.PRICE, 5000.0), queryOptions(deduplicate, order));
The query engine will need to use the instanceof operator internally anyway,
because all QueryOptions (of various types) get bundled into a map by the
queryOptions method.
Note I am thinking of overhauling Ordering support in a later release anyway.
For example it currently lack support to order by one attribute ascending, and
another descending (without defining a dummy attribute just for ordering). Let
me know what you would like to see and I'll try to accommodate it. Thanks!
Original comment by [email protected]
on 8 May 2013 at 1:24
- Changed state: Accepted
from cqengine.
Yes.
DeduplicationOption<Car> deduplicate = deduplicate(DeduplicationStrategy.LOGICAL_ELIMINATION);
OrderByOption<Car> order = orderBy(Car.PRICE, Car.DOORS);
ResultSet<Car> results = cars.retrieve(lessThan(Car.PRICE, 5000.0), queryOptions(deduplicate, order));
it's what I had in mind.
First of all, I think this is not a defect, but a enhancement. It is a design
decision which change does not affect backwards compatibility.
And why i was suggesting the change?
Let me explain. Unfortunately I was not thinking in the cqengine internals but
a class of my domain (CachedIndexedCollection) which wraps
cqengine.IndexedCollection and where it's needed the operator instanceof in
order to filter (and allow) orderByOption object (and reject the other one). My
apologizes for the mess.
This is the piece of code:
com.googlecode.cqengine.resultset.ResultSet queryResult =
CachedIndexedCollection.retrieve(query, queryOptions); // needs internal check
com.googlecode.cqengine.resultset.ResultSet queryResult =
CachedIndexedCollection.retrieve(query, orderOptions);
But my thoughts about the cqengine API design were: DeduplicationOption
(single) are related to the ResultSet, whereas that OrderOptions (could be more
than one) are related to Query. And the operator instanceof usage in
queryEngine could offer a clue for that.
Probably this humble opinion on the nature of queryOptions objects are better
to discuss in the forum and Ordering support improvement you are evaluating is
the best way for changing QueryOption interface. Let me time to read cqengine
code and think about until weekend and then, if you agree, I will open a new
topic there.
Original comment by [email protected]
on 9 May 2013 at 8:01
from cqengine.
Feel free to open a topic in the forum. I think I see what you would like to
do. I will rename this issue to "Consider combining Query with QueryOptions for
caching purposes" - i.e. you would like to associate result sets with a query +
query options, to retrieve them later. Let's put the requirements on hold
(shelved temporarily) until we have a plan from the forum.
Original comment by [email protected]
on 9 May 2013 at 2:29
- Changed title: Support combining query with query options for caching purposes
- Changed state: Shelved
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
from cqengine.
[deleted comment]
from cqengine.
Re-opening this based on Roberto's patch from the forum, attached. It adds
support to order results with combinations of ascending and descending
attributes. Will try to integrate later in the week.
Original comment by [email protected]
on 9 Jun 2013 at 11:50
- Changed state: Started
Attachments:
from cqengine.
[deleted comment]
from cqengine.
Original comment by [email protected]
on 9 Jun 2013 at 11:52
- Changed title: Support to order by combinations of attributes, ascending/descending
from cqengine.
This is done, released as CQEngine 1.2.0.
Roberto thanks for the patch, I have integrated it. I slimmed down the patch as
I didn't want to maintain two APIs to order results going forward (the previous
way, and this new way). So this way replaces the old approach. Actually it
reduces the amount of code involved overall.
I integrated it with QueryFactory so there is a new syntax for ordering results:
ResultSet<Car> results = cars.retrieve(query,
queryOptions(orderBy(descending(Car.PRICE), ascending(Car.DOORS))));
Thanks again for this contribution.
Original comment by [email protected]
on 20 Aug 2013 at 10:30
- Changed state: Fixed
from cqengine.
Related Issues (20)
- Support STRICT_REPLACEMENT in ObjectLockingIndexedCollection/ConcurrentIndexedCollection
- TransactionalIndexedCollection support for UniqueIndex is broken
- Support for attribute accessors for Java record type HOT 1
- Kryo generates InaccessibleObjectException - Make Dependencies "Java 17 compatible"
- Bug in AttributeOrdersComparator HOT 5
- Offheap cache visibility HOT 1
- Support for ANTLR 4.10.1 HOT 12
- Does it support SQL statistics queries HOT 3
- Thread blocked when using Materialized View Sort For the Longest Prefix for CSV that contain more than 11 K rows HOT 3
- Error while parsing SQL NOT LIKE query HOT 1
- Error while parsing SQL LIKE '%%%' query
- java.lang.IllegalStateException thrown in the getGenericType(Member member) method of AttributeBytecodeGenerator.java
- CQNGrammar Sources missing from master HOT 1
- What is use of sqlite-jdbc in cqengine HOT 2
- Index updated even though objectStore is not modified during IndexedCollection add HOT 2
- Does CQEngine compatible with Java 17 HOT 2
- Issues with Offheap Concurrent Index collection clear()
- Getting below error on jdk17.0.8.8.1 HOT 1
- Is CQEngine officially dead? HOT 6
- com/googlecode/concurrenttrees/radix/node/NodeFactory
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cqengine.