Thanks.

Hannes Wyss wrote:

> Lou 
> 
> On Tue, Dec 20, 2005 at 11:19:44PM +0900, Lou Vanek wrote:
> 
>>How would you do a search?
> 
> 
> I'll have to eat my own example here: we've only ever been interested in
> string search - i.e. find all users whose last name begins with 'Van':
> 
> <example>
> 
> require 'odba'
> require 'odba/index_definition'
> 
> class User
>   attr_accessor :first_name, :last_name
>   include ODBA::Persistable
>   def initialize(first_name, last_name)
>     @first_name = first_name
>     @last_name = last_name
>   end
> end
> 
> index_def = ODBA::IndexDefinition.new
> index_def.index_name = 'users_by_last_name'
> index_def.origin_klass = 'User'
> index_def.target_klass = 'User'
> index_def.resolve_search_term = 'last_name.downcase'
> 
> ODBA.storage.dbi = DBI.connect('DBI:pg:test', 'test', '')
> ODBA.cache.create_index(index_def, Object)
> 
> composer = User.new('Ludwig', 'Van Beethoven')
> composer.odba_store
> painter = User.new('Vincent', 'Van Gogh')
> painter.odba_store
> scientist = User.new('Albert', 'Einstein')
> scientist.odba_store
> 
> ODBA.cache.retrieve_from_index('users_by_last_name', 'van') 
>   -> [composer, painter]
> 
> </example>
> 
>>For example, how would you find all Counters with a pos > 10 but not 13?
>>Is the search done centrally, or must you download all Counters before
>>you can do the search?
> 
> The numerical Counter#pos case could be done, but is not implemented..
> 
> Hannes