[Glass] GsQuery executing on SortedCollection ...
Dale Henrichs via Glass
glass at lists.gemtalksystems.com
Wed May 25 10:11:43 PDT 2016
The index/query subsystems pretty much expects a close to full
complement of comparison operators and I agree that you might see
failures depending upon which code paths get taken ..
The the query and indexing code actually uses a set of _idxForCompare
and _idxForSort methods to evaluate queries, so you should take a look
at the following methods in Object:
_classSortOrdinal
_classSortsGreaterThan:
_classSortsLessThan:
_idxForCompareEqualTo:
_idxForCompareGreaterThan:
_idxForCompareGreaterThanOrEqualTo:
_idxForCompareLessThan:
_idxForCompareLessThanOrEqualTo:
_idxForCompareNotEqualTo:
_idxForSortEqualTo:
_idxForSortGreaterThan:
_idxForSortGreaterThanOrEqualTo:
_idxForSortLessThan:
_idxForSortLessThanOrEqualTo:
_idxForSortNotEqualTo:
and consider implementing the appropriate _idxFor methods in your
classes to avoid MNU on queries.
Dale
On 05/25/2016 03:16 AM, Marten Feldtmann via Glass wrote:
>
> The following code might not work. We have domain objects, which do
> not respond to #<= method.
>
> * We have a sortedCollection of these domain object, but sorted by
> an attribute of an instance variable (sub-attribute).
> * GsQuery now tries to build the result and creates a
> SortedCollection and the domain objects are sorted by #<= and this
> might fail, because the domain objects do not #<=
>
> sortedObjects := SortedCollection
> sortBlock: [ :a :b | a getAddress get importNumber < b getAddress get importNumber ].
> possibleObject addAll: (lots of objects).
> (aGsQuery :=GsQuery fromString: 'each.address.importNumber = 10') on: sortedObjects.
> aGsQuery asArray
>
>
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20160525/4a300f9e/attachment-0001.html>
More information about the Glass
mailing list