Class ActsAsFerret::RemoteIndex
In: lib/remote_index.rb
Parent: AbstractIndex

This index implementation connects to a remote ferret server instance. It basically forwards all calls to the remote server.

Methods

<<   add   find_ids   method_missing   new   register_class  

Included Modules

RemoteFunctions

Public Class methods

[Source]

    # File lib/remote_index.rb, line 9
 9:     def initialize(config)
10:       super
11:       @server = DRbObject.new(nil, ActsAsFerret::remote)
12:     end

Public Instance methods

<<(record)

Alias for add

add record to index

[Source]

    # File lib/remote_index.rb, line 41
41:     def add(record)
42:       handle_drb_error { @server.add index_name, record.to_doc }
43:     end

[Source]

    # File lib/remote_index.rb, line 35
35:     def find_ids(q, options = {}, &proc)
36:       total_hits, results = handle_drb_error([0, []]) { @server.find_ids(index_name, q, options) }
37:       block_given? ? yield_results(total_hits, results, &proc) : [ total_hits, results ]
38:     end

[Source]

    # File lib/remote_index.rb, line 20
20:     def method_missing(method_name, *args)
21:       args.unshift index_name
22:       handle_drb_error { @server.send(method_name, *args) }
23:     end

Cause model classes to be loaded (and indexes get declared) on the DRb side of things.

[Source]

    # File lib/remote_index.rb, line 16
16:     def register_class(clazz, options)
17:       handle_drb_error { @server.register_class clazz.name }
18:     end

[Validate]