Package sagan.guides.support

Source Code of sagan.guides.support.UnderstandingDocMapper

package sagan.guides.support;

import sagan.guides.UnderstandingDoc;
import sagan.search.SearchEntry;
import sagan.search.SearchEntryMapper;

import java.util.Date;

import org.jsoup.Jsoup;

class UnderstandingDocMapper implements SearchEntryMapper<UnderstandingDoc> {
    @Override
    public SearchEntry map(UnderstandingDoc guide) {
        SearchEntry entry = new SearchEntry();
        String rawContent = Jsoup.parse(guide.getContent()).text();
        entry.setRawContent(rawContent);
        entry.setTitle(guide.getSubject());
        entry.setPath("understanding/" + guide.getSubject());
        entry.setSummary(rawContent.substring(0, Math.min(500, rawContent.length())));
        entry.addFacetPaths("Guides", "Guides/Understanding");
        entry.setPublishAt(new Date(0L));
        entry.setSubTitle("Understanding Doc");
        return entry;
    }
}
TOP

Related Classes of sagan.guides.support.UnderstandingDocMapper

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.