1 |
<?xml version="1.0" encoding="UTF-8"?> |
2 |
|
3 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
4 |
|
5 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
6 |
|
7 |
<head> |
8 |
<meta http-equiv="Content-Language" content="en" /> |
9 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
10 |
<meta http-equiv="Content-Style-Type" content="text/css" /> |
11 |
<meta name="author" content="Mikio Hirabayashi" /> |
12 |
<meta name="keywords" content="Hyper Estraier, Estraier, full-text search, API, Node, P2P" /> |
13 |
<meta name="description" content="API specifications of Hyper Estraier" /> |
14 |
<link rel="contents" href="./" /> |
15 |
<link rev="made" href="mailto:mikio@users.sourceforge.net" /> |
16 |
<title>The Java Binding of Hyper Estraier</title> |
17 |
</head> |
18 |
|
19 |
<body> |
20 |
|
21 |
<h1>Hyper Estraier.</h1> |
22 |
|
23 |
<div>a full-text search system for communities.</div> |
24 |
|
25 |
<h2>Introduction</h2> |
26 |
|
27 |
<p>This is a package implementing the node API of <a href="http://hyperestraier.sourceforge.net/">Hyper Estraier</a>. This is a pure java package though it is not uncertified. So, it works on Linux, Mac OS X, Windows, and so on. It does not depend on the core library of Hyper Estraier. Applications are implemented as clients of node servers running on local or remote machines.</p> |
28 |
|
29 |
<p>Though Hyper Estraier itself is released under the terms of the GNU LGPL, this package is released under the terms of a BSD-style license.</p> |
30 |
|
31 |
<h2>Setting</h2> |
32 |
|
33 |
<p>Get the JAR file `<a href="http://hyperestraier.sourceforge.net/jar/estraier.jar">estraier.jar</a>' and make the classpath include the JAR file.</p> |
34 |
|
35 |
<p>`estraier.*' should be imported in each source file of application programs.</p> |
36 |
|
37 |
<h2>Example of Gatherer</h2> |
38 |
|
39 |
<p>The following is the simplest implementation of a gatherer.</p> |
40 |
|
41 |
<pre style="margin: 0.5em 0.5em; padding: 0.1em 0.3em; border: 1pt solid #aaaaaa;">import estraier.*; |
42 |
|
43 |
public class NodeExample001 { |
44 |
public static void main(String[] args){ |
45 |
// create and configure the node connecton object |
46 |
Node node = new NodeImpl(); |
47 |
node.set_url("http://localhost:1978/node/test1"); |
48 |
node.set_auth("admin", "admin"); |
49 |
// create a document object |
50 |
Document doc = new DocumentImpl(); |
51 |
// add attributes to the document object |
52 |
doc.add_attr("@uri", "http://estraier.gov/example.txt"); |
53 |
doc.add_attr("@title", "Over the Rainbow"); |
54 |
// add the body text to the document object |
55 |
doc.add_text("Somewhere over the rainbow. Way up high."); |
56 |
doc.add_text("There's a land that I heard of once in a lullaby."); |
57 |
// register the document object to the node |
58 |
if(!node.put_doc(doc)) |
59 |
System.err.println("error: " + node.status()); |
60 |
} |
61 |
} |
62 |
</pre> |
63 |
|
64 |
<h2>Example of Searcher</h2> |
65 |
|
66 |
<p>The following is the simplest implementation of a searcher.</p> |
67 |
|
68 |
<pre style="margin: 0.5em 0.5em; padding: 0.1em 0.3em; border: 1pt solid #aaaaaa;">import estraier.*; |
69 |
|
70 |
public class NodeExample002 { |
71 |
public static void main(String[] args){ |
72 |
// create the node connecton object |
73 |
Node node = new NodeImpl(); |
74 |
node.set_url("http://localhost:1978/node/test1"); |
75 |
// create a search condition object |
76 |
Condition cond = new ConditionImpl(); |
77 |
// set the search phrase to the search condition object |
78 |
cond.set_phrase("rainbow AND lullaby"); |
79 |
// get the result of search |
80 |
NodeResult nres = node.search(cond, 0); |
81 |
if(nres != null){ |
82 |
// for each document in the result |
83 |
for(int i = 0; i < nres.doc_num(); i++){ |
84 |
// get a result document object |
85 |
ResultDocument rdoc = nres.get_doc(i); |
86 |
// display attributes |
87 |
System.out.println("URI: " + rdoc.attr("@uri")); |
88 |
System.out.println("Title: " + rdoc.attr("@title")); |
89 |
// display the snippet text |
90 |
System.out.print(rdoc.snippet()); |
91 |
} |
92 |
} else { |
93 |
System.err.println("error: " + node.status()); |
94 |
} |
95 |
} |
96 |
} |
97 |
</pre> |
98 |
|
99 |
<h2>License</h2> |
100 |
|
101 |
<div>Copyright (C) 2004-2005 Mikio Hirabayashi</div> |
102 |
<div>All rights reserved.</div> |
103 |
|
104 |
<p>Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p> |
105 |
|
106 |
<ul> |
107 |
<li>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</li> |
108 |
<li>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</li> |
109 |
<li>Neither the name of Mikio Hirabayashi nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.</li> |
110 |
</ul> |
111 |
|
112 |
<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p> |
113 |
|
114 |
</body> |
115 |
|
116 |
</html> |