Search in sources :

Example 1 with GuardianNewsIterator

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;
}
Also used : GuardianNewsItem(com.rbmhtechnology.vind.demo.step5.guardian.GuardianNewsItem) GuardianNewsIterator(com.rbmhtechnology.vind.demo.step5.guardian.GuardianNewsIterator) Document(com.rbmhtechnology.vind.api.Document)

Aggregations

Document (com.rbmhtechnology.vind.api.Document)1 GuardianNewsItem (com.rbmhtechnology.vind.demo.step5.guardian.GuardianNewsItem)1 GuardianNewsIterator (com.rbmhtechnology.vind.demo.step5.guardian.GuardianNewsIterator)1