clintongormley / Elastic-Model

Use ElasticSearch as a NoSQL database in Perl
9 stars 8 forks source link

Use objects after partial doc retrieval #6

Closed diegok closed 12 years ago

diegok commented 12 years ago

Would be nice to be able to select which fields to retrieve and then be able to use the object without the need of a full 'get'. It can probably work in some way of "read only" mode, just retrieve full object when trying to write on it or more fine grained like when trying to access a not full retrieved field. On my planned usage I will never write back as this is for search results only, so setting it as read only and raise exception when trying to use other way is fine for me.

Another approach can be to let the class define a constructor that will be in charge of parsing partial result... but automatic functioning is much better and probably doable as it's always the same.

Of course, required attributes should have default values if you plan to selectively not retrieve one of those.

One problem I see is when selecting partial data from a hash returned data is in dot notation, so it should be converted back to a hash before inflation on partial objects.

I see this feature very interesting for online search over docs that can have lot of data with the only purpose of searching/filtering.