Class: Libis::Services::Sharepoint::Search

Inherits:
Object
  • Object
show all
Includes:
GenericSearch, Libis::Services::SoapClient, Tools::Logger
Defined in:
lib/libis/services/sharepoint/search.rb,
lib/libis/services/sharepoint/connector.rb

Instance Attribute Summary

Attributes included from Libis::Services::SoapClient

#client

Attributes included from GenericSearch

#base, #host, #index, #num_records, #record_pointer, #session_id, #set_number, #term

Instance Method Summary collapse

Methods included from Libis::Services::SoapClient

#configure, #operations, #request

Methods included from GenericSearch

#find, #next_record

Constructor Details

#initialize(options = {}) ⇒ Search

Returns a new instance of Search.



12
13
14
# File 'lib/libis/services/sharepoint/search.rb', line 12

def initialize
  puts 'TODO'
end

Instance Method Details

#each(options) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/libis/services/sharepoint/connector.rb', line 62

def each(options)

  # we start with a new search
  restart_query options
  get_next_set options

  while records_to_process? options

    yield options[:result][:records][options[:current]]

    options[:current] += 1

    get_next_set(options) if require_next_set?(options)

  end

  restart_query(options)

end

#query(term, options = {}) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/libis/services/sharepoint/connector.rb', line 45

def query(term, options = {})

  options[:term] = term

  options[:limit] ||= 100
  options[:value_type] ||= 'Text'
  options[:query_operator] = MY_QUERY_SYMBOLS[options[:query_operator] || '==']

  options[:query_operator] = 'BeginsWith' if term =~ /^[^*]+\*$/
  options[:query_operator] = 'Contains' if term =~ /^\*[^*]+\*$/

  restart_query options

  options

end