source: other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/GSearchConnection.java@ 26360

Last change on this file since 26360 was 26360, checked in by ak19, 12 years ago

Searching on all fields has changed. Previously searching over all fields was to be specified without any index field prefixed to the query. Now, searching over all fields requires the foxml.all.text index field to be prefixed to the query.

File size: 23.7 KB
Line 
1/**
2 *#########################################################################
3 * GSearchConnection.java - works with the demo-client for Greenstone 3,
4 * of the Greenstone digital library suite from the New Zealand Digital
5 * Library Project at the * University of Waikato, New Zealand.
6 * <BR><BR>
7 * Copyright (C) 2008 New Zealand Digital Library Project
8 * <BR><BR>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 * <BR><BR>
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *########################################################################
19 */
20
21package org.greenstone.fedora.services;
22
23import java.util.Vector;
24import java.util.Iterator;
25import java.util.Map;
26import java.util.HashMap;
27
28import java.net.URL;
29import javax.xml.namespace.QName;
30import javax.xml.parsers.DocumentBuilder;
31import javax.xml.parsers.DocumentBuilderFactory;
32import javax.xml.rpc.ServiceException;
33import java.net.MalformedURLException;
34
35import org.apache.axis.client.Call;
36import org.apache.axis.client.Service;
37import org.apache.log4j.Logger;
38
39import javax.xml.parsers.ParserConfigurationException;
40import org.w3c.dom.Element;
41import org.w3c.dom.NodeList;
42
43
44/**
45 * Class GSearchConnection connects to FedoraGSearch's web services.
46 * FedorGSearch offers indexing and full-text search functionality for
47 * Fedora repositories. Its search web service (method gFindObjects)
48 * returns the response of a search as XML.
49 * GSearchConnection offers more convenient methods that extract just
50 * the parts of search results that FedoraGS3Connection needs and returns
51 * that.
52 * @author ak19
53*/
54public class GSearchConnection implements FedoraToGS3Interface.Constants {
55 /** Logger for this class. */
56 private static final Logger LOG = Logger.getLogger(
57 GSearchConnection.class.getName());
58
59 /* Accessing the web services of Fedora Generic Search */
60 protected static String NAMESPACE_URI = "http://server.fedoragsearch.defxws.dk";
61 protected static String SERVICE_NAME = "OperationsService";
62
63 /** The names of the methods we use of Fedora Generic Search's web services
64 * are declared here as static final Strings. */
65 protected static final String G_FIND_OBJECTS = "gfindObjects";
66
67 /* Some fixed string literals that will be encountered in the response XMLs
68 * that FedoraGSearch's method gFindObjects() returns. */
69 protected static final String PID = "PID";
70 protected static final String HIT_TOTAL = "hitTotal";
71 protected static final String OBJECT = "object";
72 protected static final String FIELD = "field";
73 protected static final String NAME = "name";
74 protected static final String DC_TITLE_FIELD = "dc.title";
75 protected static final String FULLTEXT_FIELD = "ds.fulltext";
76 public static final String ALL_INDEXED_FIELDS = "foxml.all.text";
77
78 /** separator used internally to separate values of a search field */
79 protected static final String SPACE = " ";
80
81 /** The name of the Index wherein FedoraGSearch has indexed all the GS3 docs.
82 * This final member is public here so that others may read the indexName
83 * that this GSearchConnection works with. */
84 public final String indexName;
85
86 /** The Service object used to connect to the FedoraGSearch web services */
87 protected final Service service;
88 /** The Call object used to connect to the FedoraGSearch web services */
89 protected final Call call;
90 /** The portName object used when connecting to FedoraGSearch's web services */
91 protected final QName portName;
92
93 /** A DocumentBuilder object used to construct and parse XML */
94 protected final DocumentBuilder builder;
95
96
97 /** Constructor that takes a String representing the url of the WSDL
98 * file for FedoraGSearch's web services, and tries to establish a
99 * connection to those web services.
100 * @param wsdlFileLocation is a String representing the url of the WSDL file
101 * @param indexName is the name of the index that Fedora Generic Search
102 * should work with (the index wherein the indexed GS3 documents have been
103 * placed).
104 */
105 public GSearchConnection(String wsdlFileLocation, String indexName)
106 throws MalformedURLException, ServiceException,
107 ParserConfigurationException
108 {
109 this.indexName = indexName;
110
111 URL wsdlURL = new URL(wsdlFileLocation);
112 service = new Service(wsdlURL, new QName(NAMESPACE_URI, SERVICE_NAME));
113 //call = (Call) service.createCall(new QName(NAMESPACE_URI, PORT_NAME));
114
115 Iterator i = service.getPorts();
116 // FIXME: can we just assume it's the first port of service SERVICE_NAME?
117 // Do we need to work out which port to get??? Remember, the port names
118 // vary between wsdls though!
119 if(i.hasNext()) {
120 portName = (QName)i.next();
121 call = (Call) service.createCall(portName);
122
123 String endpointLocation = call.getTargetEndpointAddress();
124 LOG.debug("Wsdl file url: " + wsdlURL
125 + "\nEndpoint location is: " + endpointLocation);
126 } else { // should never happen: a service without a port
127 // portName = null;
128 call = (Call)service.createCall();
129 // FIXME: possibly manually get the ports and choose
130 // one containing "FEDORA" and "API-A" in its name?
131 throw new ServiceException(this.getClass() + ": No port in wsdl file");
132 }
133
134 // we can set the portName which remains constant for the various methods
135 // call.setPortName(portName);
136
137 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
138 builder = factory.newDocumentBuilder(); // to create XML docs
139 }
140
141 /**
142 * Method to invoke gfindObjects operation of Fedora Generic Search
143 * web services.
144 *
145 * Parameter types, parameter order and return type of gFindObjects are as
146 * obtained from the wsdl file for the Fedora Generic Search web services
147 * located at:
148 * http://localhost:8080/fedoragsearch/services/FgsOperations?wsdl
149 * &lt;wsdl:message name="gfindObjectsRequest"&gt;
150 * &lt;wsdl:part name="query" type="xsd:string"/&gt;
151 * &lt;wsdl:part name="sort" type="xsd:string"/&gt;
152 * &lt;wsdl:part name="hitPageStart" type="xsd:int"/&gt;
153 * &lt;wsdl:part name="hitPageSize" type="xsd:int"/&gt;
154 * &lt;wsdl:part name="snippetsMax" type="xsd:int"/&gt;
155 * &lt;wsdl:part name="fieldMaxLength" type="xsd:int"/&gt;
156 * &lt;wsdl:part name="indexName" type="xsd:string"/&gt;
157 * &lt;wsdl:part name="resultPageXslt" type="xsd:string"/&gt;
158 * &lt;/wsdl:message&gt;
159 *
160 * &lt;wsdl:message name="gfindObjectsResponse"&gt;
161 * &lt;wsdl:part name="gfindObjectsReturn" type="xsd:string"/&gt;
162 * &lt;/wsdl:message&gt;
163 *
164 * &lt;wsdl:operation name="gfindObjects"
165 * parameterOrder="query sort hitPageStart hitPageSize snippetsMax
166 * fieldMaxLength indexName resultPageXslt"&gt;
167 *
168 * This method works: it searches the dc.title field of our FedoraIndex
169 * for the term (e.g. "interview") and the result returned is an XML String.
170 *
171 * There's no example on how to call gFindObjects with parameters. In
172 * particular, I don't know what values the parameter <b>sort</b> can take.
173 * But topazproject has an example on how to call updateIndex().
174 * @see <a href="http://www.topazproject.org/trac/wiki/FedoraSearch?format=txt">An example on how to call updateIndex() with parameters</a>
175 * @see <a href="http://ws.apache.org/axis/java/apiDocs/org/apache/axis/client/Service.html">Axis Service class</a>
176 * @see <a href="http://ws.apache.org/axis/java/apiDocs/javax/xml/rpc/Call.html">Axis RPC Call, for specification of interface Call</a>
177 * @see <a href="http://ws.apache.org/axis/java/apiDocs/org/apache/axis/client/Call.html">Axis client Call class, for implementation of interface Call</a>
178 */
179 protected String gFindObjects(String searchFieldedTerms, String sort,
180 int hitPageStart, int hitPageSize, int snippetsMax,
181 /*int fieldMaxLength,*/ String indexName, String resultPageXslt) throws Exception
182 {
183 // "Prefills as much info from the WSDL as it can. Right now it's SOAPAction,
184 // operation qname, parameter types and return type of the Web Service.
185 // This method considers that port name and target endpoint address have
186 // already been set. This is useful when you want to use the same Call instance
187 // for several calls on the same Port. NOTE: Not part of JAX-RPC specification."
188
189 //call.removeAllParameters(); // no need for this when using setOpName below
190 call.setOperationName(G_FIND_OBJECTS);
191
192 // Max num of chars in field vals returned. Since return values exceeding
193 // maxlength will be truncated, ensure length suffices for long PIDs returned.
194 // The only element of the response XML we'll be using is the PID of the document
195 // in which the searchTerm occurred.
196 final int fieldMaxLength = 100; // NOT TRUE: max length in words of field values
197 // returned. E.g. snippet sizes will be reduced to fieldMaxLength words too.
198
199 // This is the method call for Fedora 2's GSearch
200 //String valueFound =(String)call.invoke( new Object[] {
201 // searchFieldedTerms, sort, hitPageStart, hitPageSize, snippetsMax,
202 // fieldMaxLength, indexName, resultPageXslt} );
203
204 // The method call for GSearch 2.2 of Fedora 3 takes the args in a different order:
205 String valueFound =(String)call.invoke( new Object[] {
206 searchFieldedTerms, hitPageStart, hitPageSize, snippetsMax,
207 fieldMaxLength, indexName, sort, resultPageXslt} );
208
209 // for debugging
210 //javax.swing.JOptionPane.showMessageDialog(null, "GSearchConnection.gFindObjects:" + valueFound);
211 //LOG.error("gfindObjects result: " + valueFound);
212
213 return valueFound;
214 }
215
216 /**
217 * Method that performs a search for the given searchTerm inside the given
218 * indexed field.
219 * @param searchFieldName is the name of the indexed field within which the
220 * given searchTerm is to be searched for.
221 * @param searchTerm is the term to be searched for.
222 * @param hitPageStart is the page of search results to start returning.
223 * @param hitPageSize is the number of search result pages to return,
224 * starting from hitPageStart.
225 * @param snippetsMax is the maximum number of separate snippets containing
226 * the searchTerm that are to be returned. (snippetsMax or a fewer number of
227 * occurrences of the word in the text will be returned)
228 */
229 public String search(String searchFieldName, String searchTerm,
230 int hitPageStart, int hitPageSize, int snippetsMax) throws Exception
231 {
232 final String sort = ""; // returns results from highest to lowest rank
233 final String resultPageXslt = "";
234
235 // when a fieldname is given to search in (ds.fulltext, dc.title)
236 // then prepend that followed by a COLON to the searchTerm.
237 final String fullSearchTerm = searchFieldName.equals("") ?
238 searchTerm : (searchFieldName+":"+searchTerm);
239
240 return gFindObjects(fullSearchTerm, sort,
241 hitPageStart, hitPageSize, snippetsMax,
242 indexName, resultPageXslt);
243 }
244
245 /**
246 * FedoraGSearch accepts a query of the form:
247 * <code>&lt;"cyclone val" "Gender Inequalities" ds.fulltext:"cyclone val"
248 * ds.fulltext:"worst storm"&gt;</code>
249 * where the first two phrases are searched for in all indexed fields,
250 * (in this case dc.title and ds.fulltext), while the last two are
251 * searched for in the ds.fulltext field.
252 * Another example:
253 * <code>&lt;gender dc.title:interview ds.fulltext:"cyclone val"&gt;
254 * titles and fulltexts are searched for "gender", while title index
255 * is searched for "interview" and fulltexts are searched for the phrase
256 * "cyclone val"</code>
257 * @param fieldsToSearchTerms is a Hashmap of searchfields and
258 * associated search terms (words or phrases). The terms are in a
259 * comma-separated list. fieldsToSearchTerms is a Hashmap of
260 * (Searchfields, associated-searchTerms) pairs. It can contain 3
261 * searchfields: allfields, titles, text. The value for each is a
262 * comma-separated list of search terms in that field.
263 * Internally the field names get converted to what FedoraGSearch's
264 * gfindObjects understands: titles becomes dc.title:, text becomes
265 * ds.fulltext and allfields becomes nothing.
266 * @param hitPageStart is the page of search results to start returning.
267 * @param hitPageSize is the number of search result pages to return,
268 * starting from hitPageStart.
269 * @return the XML (in string format) returned from Fedora Generic Search's
270 * gfindObjects method
271 *
272 */
273 public String search(Map fieldsToSearchTerms,
274 int hitPageStart, int hitPageSize)
275 throws Exception
276 {
277 LOG.debug("In FedoraGS3's GSearchConnection.search(Map,...)");
278
279 // HashMap consists of several (key, value) entries, 3 of
280 // which will be dealt with here:
281 // - allfields, <comma separated list of search terms/phrases>
282 // - titles, <comma separated list of search terms/phrases>
283 // - (full)text, <comma separated list of search terms/phrases>
284 // We need to obtain each value and change the separator to space:
285 String allfields = (String)fieldsToSearchTerms.get(ALL_FIELDS);
286 String titles = (String)fieldsToSearchTerms.get(ALL_TITLES);
287 String fulltexts = (String)fieldsToSearchTerms.get(FULLTEXT);
288
289 // Each field is a comma separated list of terms that may be
290 // either a word OR a phrase.
291 // We're going to separate each term from the list,
292 // and put quotes around phrases, then combine all the terms
293 // together again with spaces to separate them.
294 allfields = formatSearchTermsInField(allfields, ALL_FIELDS); // searches foxml.all.text
295 // ALL_FIELDS has no field name
296 titles = formatSearchTermsInField(titles, DC_TITLE_FIELD);
297 fulltexts = formatSearchTermsInField(fulltexts, FULLTEXT_FIELD);
298
299 String fullSearchTerm = allfields + titles + fulltexts;
300 if(fullSearchTerm.trim().equals("")) { // nothing to search on
301 return "";
302 }
303
304 // Finally, restrict the search to the Greenstone digital objects
305 // stored in Fedora
306 final String greenstonePID
307 = PID + FedoraGS3DL.COLON + FedoraGS3DL.GREENSTONE;
308 //"PID:\"greenstone\"";
309 fullSearchTerm += greenstonePID;
310 //! Everything after the colon in the pid is ignored by FedoraGSearch:
311 // "PID:\"greenstone:gs2mgdemo\""; // ignores "gs2mgdemo"
312
313 // <snippet> tags interfere when PID field is searched on, set it to 0
314 return search(fullSearchTerm, hitPageStart, hitPageSize, 0);
315 // return search(fullSearchTerm, hitPageStart, hitPageSize, snippetsMax);
316 }
317
318 /** Each field is a comma separated list of terms that may be either a word
319 * OR a phrase. We're going to separate each term from the list, and put
320 * quotes around phrases, then combine all the terms together again with
321 * spaces to separate them. Examples:
322 * <pre>dc.title:"a phrase" word
323 * dc.fulltext: "cyclone val"
324 * (ALL_FIELDS) interview gender</pre>
325 * This is required to facilitate fielded searching with fedoraGSearch.
326 * @param field is a comma separated list of search terms (corresponding
327 * to one fieldName) to be reorganised
328 * @param fieldName is the name of the field to prepend to the reorganised
329 * field value. FieldName ALL_FIELDS is ignored.
330 * @return parameter field reorganised such that terms that are phrases
331 * are in quotes and each term is separated by a space from the previous one.
332 */
333 protected String formatSearchTermsInField(String field, String fieldName)
334 {
335 if(field != null) { // check that the field isn't empty
336 //LOG.debug("field: " + field);
337 String[] terms = field.split(",");
338 field = ""; // we'll build it up again
339 for(int i = 0; i < terms.length; i++) {
340 // if it contains a space, then the term's a phrase,
341 // put it in quotes
342 if(terms[i].indexOf(SPACE) != -1) {
343 terms[i] = "\"" + terms[i] + "\"";
344 }
345 field = field + terms[i] + SPACE;
346 }
347
348 // Prefix it with the name of the field we want to search for
349 // the term in. Every field other than allfields has a prefix
350 if(!fieldName.equals(ALL_FIELDS)) {
351 field = fieldName + ":" + field;
352 }
353 // in older versions of GSearch (version 2.2), searching over all fields
354 // meant not specifying an index to search in. From GSearch version 2.4/2.5
355 // need to search in field "foxml.all.text" to search all indexed fields.
356 else {
357 field = ALL_INDEXED_FIELDS + ":" + field; //searches in foxml.all.text
358 }
359
360 } else field = "";
361 return field;
362 }
363
364 /**
365 * Uses FedoraGSearch to perform a search where the query is embedded in
366 * fieldedSearchTerms, which not only provides the terms to search on, but
367 * also the fields to search the (various) given terms in.
368 * @param fieldedSearchTerms is the String specifying all the search terms
369 * with their fields (or no field if it should search for the terms in
370 * all fields). The terms with no associated search-fields should come first.
371 * Search terms may be in quotes.
372 * @param snippetsMax is the maximum number of separate snippets containing
373 * the searchTerm (snippetsMax number of occurrences of the word in the text)
374 * returned.
375 * @param hitPageStart is the page of search results to start returning.
376 * @param hitPageSize is the number of search result pages to return,
377 * starting from hitPageStart.
378 * @return the XML (in string format) returned from Fedora Generic Search's
379 * gfindObjects method
380 */
381 public String search(String fieldedSearchTerms,
382 int hitPageStart, int hitPageSize, int snippetsMax) throws Exception
383 {
384 LOG.debug("In method search(String fieldedSearchTerms,...). "
385 + "Query is:\n" + fieldedSearchTerms);
386
387 final String sort = ""; // returns results from highest to lowest rank
388 final String resultPageXslt = "";
389 return gFindObjects(fieldedSearchTerms, sort,
390 hitPageStart, hitPageSize, snippetsMax,
391 indexName, resultPageXslt);
392 }
393
394 /** Call this method with the return value of calling search().
395 * Search results are returned in GSearch's XML response format,
396 * containing information that includes the PIDs of the documents that
397 * matched the search. These PIDs are returned in the array.
398 * @param collectionName is the name of the collection to restrict the
399 * search results by. If it's "", then results from all collections are
400 * returned. Generally, don't want to pass "", because, theoretically,
401 * all indexed collections in the repository could be considered and
402 * not all of them may be Greenstone collections. If all Greenstone
403 * collections should be searched for, pass "greenstone" as the
404 * collection name instead.
405 * @param searchResult is the Fedora Generic Search XML response returned
406 * from performing a gfindObjects() operations.
407 * @return an array of the pids of documents found for the search. */
408 public String[] getPIDsFromSearchResult(String collectionName,
409 String searchResult)
410 throws Exception
411 {
412 final String[] empty = {};
413 if(searchResult.equals("")) {
414 return empty;
415 }
416
417 // <?xml version="1.0" encoding="UTF-8"?>
418 // <resultPage xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:foxml="info:fedora/fedora-system:def/foxml#" xmlns:zs="http://www.loc.gov/zing/srw/" indexName="FedoraIndex" dateTime="Sat Feb 09 16:43:04 NZDT 2008">
419 // <gfindObjects hitTotal="1" resultPageXslt="" hitPageSize="10" hitPageStart="1" query="ds.fulltext:Cyclone">
420 // <objects>
421 // <object no="1" score="0.24639596">
422 // <field name="PID">greenstone:gs2mgdemo-HASH01d667303fe98545f03c14ae</field>
423 // <field name="repositoryName">Fedora</field>
424 // <field name="object.type">FedoraObject</field>
425 // <field name="object.state">Active</field>
426 // <field name="object.label">The Courier - N°159 - Sept- Oct 1996 Dossier Inves ... </field>
427 // <field name="object.createdDate">2007-11-23T04:23:15.363Z</field>
428 // <field name="object.lastModifiedDate">2008-01-15T04:37:49.518Z</field>
429 // <field name="dc.title">some title</field>
430 // <field name="dc.title">some title2</field>
431 // ...
432 // <field name="ds.fulltext" snippet="yes">(The 1993 <span class="highlight">cyclone</span>, although</field>
433 // <field name="ds.label">Metadata</field>
434 // ...
435 // </object>
436 // </objects>
437 // </gfindObjects>
438 // 1. Get documentElement, which is <resultPage>
439 Element resultPage = FedoraCommons.getResponseAsDOM(builder, searchResult);
440 // 2. find the hitTotal value which is the number of results
441 // it's an attribute of the sole compulsory <gFindObjects> element
442 int hitTotal = 0;
443 Element gfindObjectsEl
444 = (Element)resultPage.getElementsByTagName(G_FIND_OBJECTS).item(0);
445 String value = gfindObjectsEl.getAttribute(HIT_TOTAL);
446 hitTotal = Integer.parseInt(value);
447 if(hitTotal == 0) {
448 return new String[]{};
449 }
450
451 // Our resulting list of pids will be no more than hitTotal,
452 // but may be fewer if we constrain the results to a collection
453 Vector pidsInCollection = new Vector(hitTotal);
454
455 // Returns a NodeList of all descendant Elements with object tagname
456 NodeList objects = gfindObjectsEl.getElementsByTagName(OBJECT);
457 for(int i = 0; i < objects.getLength(); i++) {
458 // should be the case that pids.length == (digital)objects.getLength()
459 // get the PID of each object
460 Element object = (Element)objects.item(i);
461 NodeList fields = object.getElementsByTagName(FIELD);
462
463 for(int j = 0; j < fields.getLength(); j++) {
464 // find the sole <field> of <object> where NAME attribute == PID
465 Element field = (Element)fields.item(j);
466 if(field.getAttribute(NAME).equals(PID)) {
467 String pid = FedoraCommons.getValue(field);
468 // Either store only the pids which are part of the collection,
469 // or, if no collection is specified (=""),then store the pid too
470 if(collectionName.equals("") || pid.contains(collectionName)) {
471 pidsInCollection.add(pid);
472 }
473 break; // found pid field, meaning that we have
474 // finished for loop on <field>s of this <object>,
475 // consider next <object>
476 }
477 }
478 }
479 String[] pids = new String[pidsInCollection.size()];
480 pidsInCollection.toArray(pids);
481 return pids;
482 }
483
484 public static void main(String[] args) {
485 try {
486 GSearchConnection searcher = new GSearchConnection(
487 "http://localhost:8080/fedoragsearch/services/FgsOperations?wsdl", "FedoraIndex");
488
489
490 HashMap map = new HashMap();
491 map.put(GSearchConnection.ALL_FIELDS, "gender inequalities");
492 map.put(GSearchConnection.FULLTEXT, "cyclone val,worst storm");
493 //map.put(GSearchConnection.ALL_FIELDS, "\"gender inequalities\"");
494 //map.put(GSearchConnection.FULLTEXT, "\"cyclone val\",\"worst storm\"");
495 String searchResult = searcher.search(map, 1, 10); //snippetsMax: 3);
496 System.out.println(searchResult);
497
498 String[] pids = searcher.getPIDsFromSearchResult("gs2mgdemo", searchResult);
499 System.err.println("Found pids for search:\n");
500 for(int i = 0; i < pids.length; i++) {
501 System.out.println(pids[i]);
502 }
503
504 //searchResult = searcher.search("", "minh", 0, 50, 50);
505 //System.err.println(searchResult);
506
507 //String searchTerms = "cyclone dc.title:interview dc.title:gender";
508 String searchTerms="\"gender inequalities\" ds.fulltext:\"cyclone val\" ds.fulltext:\"worst storm\"";
509 searchResult = searcher.search(searchTerms, 1, 10, 3);
510 System.out.println(searchResult);
511
512 // Not restricting results to any collection (search results from
513 // all collections)
514 pids = searcher.getPIDsFromSearchResult("", searchResult);
515 System.err.println("Found pids for search: ");
516 for(int i = 0; i < pids.length; i++) {
517 System.out.println(pids[i]);
518 }
519
520 searchResult = searcher.search("ds.fulltext", "cyclone", 1, 10, 3);
521 //String searchResult = searcher.search("ds.label", "hierarchical", 1, 10, 3);
522 // System.out.println(searcher.search("ds.fulltext", "Pinky", 1, 10, 3));
523 System.out.println(searchResult);
524
525 pids = null;
526 pids = searcher.getPIDsFromSearchResult("", searchResult);
527 System.err.println("Found pids for search: ");
528 for(int i = 0; i < pids.length; i++) {
529 System.out.println(pids[i]);
530 }
531
532 }catch(Exception e) {
533 System.err.println(e.getMessage());
534 }
535
536 }
537
538}
Note: See TracBrowser for help on using the repository browser.