Class: Openurl

Inherits:
Object
  • Object
show all
Defined in:
lib/enju_biblio/openurl.rb

Overview


Constant Summary collapse

MATCH_EXACT =

一致条件ごとの分類

[:ndl_dpid]
MATCH_PART =

部分一致

[:aulast, :aufirst, :au, :title, :atitle, :jtitle, :btitle, :pub]
MATCH_AHEAD =

前方一致

[:issn, :isbn, :ndl_jpno]
LOGIC_MULTI_AND =

ある項目に対して複数語指定時の検索方法ごとの分類

[:au, :title, :atitle, :jtitle, :btitle, :pub]
LOGIC_MULTI_OR =

OR検索

[:ndl_dpid]
NUM_CHECK =

桁チェックが必要な項目

{:issn => 8, :isbn => 13}
SYNONYMS =

集約される項目

[:title, :aulast, :aufirst]
ENJU_FIELD =

enjuのフィールド名(検索用)管理

{:aulast => 'au_text', # aulast=au
              :aufirst => 'au_text', # aufirst=au
              :au => 'au_text',
              :title => 'btitle_text',  # title=btitle
              :atitle => 'atitle_text',
              :btitle => 'btitle_text',
              :jtitle => 'jtitle_text',
              :pub => 'publisher_text',
              :issn => 'issn_sm',
              :isbn => 'isbn_sm',
              :ndl_jpno => 'ndl_jpno_text', # TODO:現在対応項目はないので保留。
              :ndl_dpid => 'ndl_dpid_sm',   # TODO:現在対応項目はないので保留。これのみ完全一致であることに注意。
              :associate => ''              # TODO:フィールド名ではないので削除?
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Openurl

Returns a new instance of Openurl.



42
43
44
45
46
47
48
49
50
51
# File 'lib/enju_biblio/openurl.rb', line 42

def initialize(params)
  # @openurl_queryに検索項目ごとの検索文を格納
  if params.has_key?(:any) then
    # anyの場合は他に条件が指定されていても無視
    @openurl_query = [params[:any].strip]
  else
    @openurl_query = to_sunspot(params)
  end
  @manifestations = []
end

Instance Attribute Details

#manifestationsObject (readonly)

Returns the value of attribute manifestations.



53
54
55
# File 'lib/enju_biblio/openurl.rb', line 53

def manifestations
  @manifestations
end

#openurl_queryObject (readonly)

Returns the value of attribute openurl_query.



53
54
55
# File 'lib/enju_biblio/openurl.rb', line 53

def openurl_query
  @openurl_query
end

#query_textObject (readonly)

Returns the value of attribute query_text.



53
54
55
# File 'lib/enju_biblio/openurl.rb', line 53

def query_text
  @query_text
end

Instance Method Details

#searchObject

検索



56
57
58
59
60
61
62
# File 'lib/enju_biblio/openurl.rb', line 56

def search
  search = Sunspot.new_search(Manifestation)
  @query_text = build_query
  query = @query_text
  search.build{ fulltext query }
  search.execute!.results
end