| Class | EstraierPure::ResultDocument |
| In: |
lib/vendor/estraierpure.rb
|
| Parent: | Object |
Create a result document object.
# File lib/vendor/estraierpure.rb, line 378
378: def initialize(uri, attrs, snippet, keywords)
379: Utility::check_types({ uri=>String, attrs=>Hash,
380: snippet=>String, keywords=>String }) if $DEBUG
381: @uri = uri
382: @attrs = attrs
383: @snippet = snippet
384: @keywords = keywords
385: end
Get the value of an attribute. The return value is the value of the attribute or `nil’ if it does not exist.
# File lib/vendor/estraierpure.rb, line 355
355: def attr(name)
356: Utility::check_types({ name=>String }) if $DEBUG
357: @attrs[name]
358: end
Get a list of attribute names. The return value is a list object of attribute names.
# File lib/vendor/estraierpure.rb, line 350
350: def attr_names()
351: @attrs.keys.sort
352: end
Get keywords. The return value is a string of serialized keywords of the result document object. There are tab separated values. Keywords and their scores come alternately.
# File lib/vendor/estraierpure.rb, line 370
370: def keywords()
371: @keywords
372: end
Get the snippet of a result document object. The return value is a string of the snippet of the result document object. There are tab separated values. Each line is a string to be shown. Though most lines have only one field, some lines have two fields. If the second field exists, the first field is to be shown with highlighted, and the second field means its normalized form.
# File lib/vendor/estraierpure.rb, line 364
364: def snippet()
365: @snippet
366: end