use of com.rbmhtechnology.vind.demo.step5.guardian.GuardianNewsIterator in project vind by RBMHTechnology.
the class SearchService method index.
public boolean index() {
GuardianNewsIterator iterator = new GuardianNewsIterator(this.guardianApiKey);
while (iterator.hasNext()) {
for (GuardianNewsItem item : iterator.getNext()) {
Document document = newsItems.createDoc(item.getId());
document.setValue(title, item.getWebTitle());
document.setValue(publicationDate, item.getWebPublicationDate());
document.setValue(category, item.getSectionName());
document.setValue(kind, item.getType());
document.setValue(url, item.getWebUrl());
server.index(document);
}
server.commit();
}
return true;
}
Aggregations