/[hyperestraier]/upstream/0.5.3/ruby/example/nodeexample002.rb
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /upstream/0.5.3/ruby/example/nodeexample002.rb

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10 - (show annotations)
Wed Aug 3 15:25:48 2005 UTC (18 years, 10 months ago) by dpavlin
File size: 787 byte(s)
import of upstream 0.5.3

1 require "estraier"
2 include Estraier
3
4 # create and configure the node connecton object
5 node = Node.new
6 node.set_url("http://localhost:1978/node/test1")
7 # create a search condition object
8 cond = Condition.new()
9 # set the search phrase to the search condition object
10 cond.set_phrase("rainbow AND lullaby")
11 # get the result of search
12 nres = node.search(cond, 0);
13 if(nres)
14 # for each document in the result
15 for i in 0...nres.doc_num
16 # get a result document object
17 rdoc = nres.get_doc(i)
18 # display attributes
19 value = rdoc.attr("@uri")
20 printf("URI: %s\n", value) if value
21 value = rdoc.attr("@title")
22 printf("Title: %s\n", value) if value
23 # display the snippet text */
24 printf("%s", rdoc.snippet)
25 end
26 else
27 STDERR.printf("error: %d\n", node.status)
28 end

  ViewVC Help
Powered by ViewVC 1.1.26