OmniFind

Page 23

System.out.println("\tLanguage: " + r[k].getLanguage()); System.out.println("\tType: " + r[k].getDocumentType()); System.out.println("\tSource: " + r[k].getDocumentSource()); System.out.println("\tDate: " + r[k].getDate()); System.out.println("\tDescription: " + r[k].getDescription()); // walk any categories that this result belongs to ResultCategory[] cats = r[k].getCategories(); if(cats != null) { for(int s = 0; s < cats.length; s++) { CategoryInfo info = cats[s].getInfo(); // print out the taxonomy id, the category id, and the category label // for each ResultCategory returned System.out.println("\tTaxonomy : " + cats[s]. getTaxonomyID()); if(info != null) { System.out.println("\tCategory " + s + ": " + info.getID()); System.out.println("\t\tLabel " + s + ": " + info.getLabel()); } } } // print out any additional field names and their // values (document metadata) NameValuePair[] fields = r[k].getFields(); if(fields != null) { for(int s = 0; s < fields.length; s++) { NameValuePair nvp = fields[s]; if(nvp != null) { System.out.print("\tField " + nvp.getName() + ": " + nvp.getValue()); } } } System.out.println(""); } } } } public static void main(String[] args) throws Exception { AdvancedSearchExample sc = new AdvancedSearchExample(); if (args.length < 5) { System.out.println("Usage: AdvancedSearchExample <queryString> <collection id> <application name>" + "<application password><hostname><port>"); System.out.println("Example Usage: AdvancedSearchExample lotus col1 app1 password localhost 80"); return; } sc.queryString = args[0]; sc.collectionId = args[1]; sc.applicationName = args[2]; sc.applicationPassword = args[3]; sc.hostname = args[4]; sc.portNumber = args[5]; sc.execute(); } }

BrowseExample class The BrowseExample class gives an example of accessing a collection’s taxonomy tree and printing out some of the basic navigation properties

Chapter 3. Search and Index API (SIAPI)

17


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.