[Glass] There is really no way to have an ordered/sorted collection together with indexes?

Richard Sargent via Glass glass at lists.gemtalksystems.com
Mon Aug 7 13:04:05 PDT 2017


GLASS mailing list wrote
> Hi guys,
> 
> I am storing huge lists of "prices". For this, it really helps me to store
> things ordered (by date)...either in an SequenceableCollection or a
> SortedCollection. On the other hand, I do want to use indexes to speedup
> my
> query to find price for a given date (equality index).
> 
> But I have found no way to have them both. The only workaround I found is
> to keep 2 collections for each of these collections, one sorted/ordered,
> and the other one an unordered one for querying via index. But this is a
> pain from "developing" point of view, as well as for unnecessary
> repository
> growth.
> 
> Am I missing something?

Mariano, have you read chapter 7 in the GemStone/S 64 Programming Guide?
It's all about indexing.

It looks like you could define a "range" query over the unordered collection
to get the sorted sequence needed to traverse all the prices in date order.
The index would be on the date and the range query would be from some "least
date" through some "greatest date". You would then use the streaming results
or the #do: message I think) to iterate over the query result in date order.
There is a section in chapter 7.2 discussing result order.


It might be helpful to discuss the use cases for the two collections. When
would you iterate over all the dates versus when would you search for
specific dates or ranges of dates?



> Thanks in advance,
> 
> -- 
> Mariano
> http://marianopeck.wordpress.com
> 
> _______________________________________________
> Glass mailing list

> Glass at .gemtalksystems

> http://lists.gemtalksystems.com/mailman/listinfo/glass





--
View this message in context: http://forum.world.st/There-is-really-no-way-to-have-an-ordered-sorted-collection-together-with-indexes-tp4959121p4959135.html
Sent from the GLASS mailing list archive at Nabble.com.


More information about the Glass mailing list