Searching for Occurrence Values

Make sure to read Using Indexes before.

String search = "tmapi";

Collection sOccs = oIndex.getOccurrencesByValue(search);

int found = sOccs.size();

if (found < 1) { 
  System.out.println(search + " not found");
} else {
  System.out.println(search + " found " + found + " results");
} 

Iterator sOccIt = sOccs.iterator();

while (sOccIt.hasNext()) {

  Occurrence currentOcc = (Occurrence) sOccIt.next();

  Topic currentTopic = currentOcc.getTopic();

  System.out.println("Found related to Topic: " + currentTopic.getObjectId());

}