Package sagan.search

Examples of sagan.search.SearchEntry


        current = false;
        return this;
    }

    public SearchEntry build() {
        SearchEntry searchEntry = new SearchEntry();

        searchEntry.setTitle(title);
        searchEntry.setRawContent(rawContent);
        searchEntry.setSummary(summary);
        searchEntry.setPublishAt(publishAt);
        searchEntry.setPath(path);
        searchEntry.setCurrent(current);
        searchEntry.setFacetPaths(facetPaths);
        searchEntry.setVersion(version);
        searchEntry.setProjectId(projectId);

        if (type != null) {
            searchEntry.setType(type);
        }
        return searchEntry;
    }
View Full Code Here


    @Test
    public void summaryIsFirst500Characters() throws Exception {
        String content = Fixtures.load("/fixtures/understanding/amqp/README.html");
        UnderstandingDoc guide = new UnderstandingDoc("foo", content, "sidebar");
        SearchEntry entry = mapper.map(guide);
        assertThat(entry.getSummary().length(), equalTo(500));
    }
View Full Code Here

public class LocalStaticPagesSearchEntryMapper implements SearchEntryMapper<Document> {

    @Override
    public SearchEntry map(Document document) {
        SearchEntry entry = new SearchEntry();
        entry.setPublishAt(new Date(0L));
        String text = document.getElementsByClass("body--container").text();
        entry.setRawContent(text);
        entry.setSummary(text.substring(0, Math.min(500, text.length())));
        entry.setTitle(document.title());
        entry.setPath(document.baseUri());
        return entry;
    }
View Full Code Here

    @Test
    public void updateMemberProfileSavesProfileToSearchIndex() {
        MemberProfile savedProfile = new MemberProfile();
        given(teamRepository.findById(1234L)).willReturn(savedProfile);

        SearchEntry searchEntry = new SearchEntry();
        given(mapper.map(savedProfile)).willReturn(searchEntry);
        service.updateMemberProfile(1234L, new MemberProfile());

        verify(searchService).saveToIndex(searchEntry);
    }
View Full Code Here

    @Test
    public void updateMemberProfileUpdatesAvatarUrlFromGravatarEmail() {
        MemberProfile savedProfile = new MemberProfile();
        given(teamRepository.findById(1234L)).willReturn(savedProfile);

        SearchEntry searchEntry = new SearchEntry();
        given(mapper.map(savedProfile)).willReturn(searchEntry);
        MemberProfile updatedProfile = new MemberProfile();
        updatedProfile.setGravatarEmail("test@example.com");
        service.updateMemberProfile(1234L, updatedProfile);
View Full Code Here

    public void updateMemberProfileDoesNotUpdateAvatarUrlIfGravatarEmailIsEmpty() {
        MemberProfile savedProfile = new MemberProfile();
        savedProfile.setAvatarUrl("http://example.com/image.png");
        given(teamRepository.findById(1234L)).willReturn(savedProfile);

        SearchEntry searchEntry = new SearchEntry();
        given(mapper.map(savedProfile)).willReturn(searchEntry);
        MemberProfile updatedProfile = new MemberProfile();
        updatedProfile.setGravatarEmail("");
        service.updateMemberProfile(1234L, updatedProfile);
View Full Code Here

    @Test
    public void mapOlderJdkApiDocContent() throws Exception {
        InputStream html = new ClassPathResource("/fixtures/apidocs/apiDocument.html", getClass()).getInputStream();
        Document document = Jsoup.parse(html, "UTF-8", "http://example.com/docs");

        SearchEntry searchEntry = apiDocumentMapper.map(document);
        assertThat(searchEntry.getRawContent(), equalTo("SomeClass"));
    }
View Full Code Here

    @Test
    public void mapJdk7ApiDocContent() throws Exception {
        InputStream html = new ClassPathResource("/fixtures/apidocs/jdk7javaDoc.html", getClass()).getInputStream();
        Document document = Jsoup.parse(html, "UTF-8", "http://example.com/docs");

        SearchEntry searchEntry = apiDocumentMapper.map(document);
        assertThat(searchEntry.getRawContent(), equalTo(document.select(".block").text()));
    }
View Full Code Here

    @Test
    public void mapApiDoc() throws Exception {
        InputStream html = new ClassPathResource("/fixtures/apidocs/jdk7javaDoc.html", getClass()).getInputStream();
        Document document = Jsoup.parse(html, "UTF-8", "http://example.com/docs");

        SearchEntry searchEntry = apiDocumentMapper.map(document);
        assertThat(searchEntry.getType(), equalTo("apiDoc"));
        assertThat(searchEntry.getVersion(), equalTo("3.2.1.RELEASE"));
        assertThat(searchEntry.getProjectId(), equalTo(project.getId()));
        assertThat(searchEntry.getSubTitle(), equalTo("Spring Project (3.2.1.RELEASE API)"));
    }
View Full Code Here

TOP

Related Classes of sagan.search.SearchEntry

Copyright © 2018 www.massapicom. 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.