Search in sources :

Example 1 with SubjectHeadingSearchEntry

use of com.tyndalehouse.step.core.models.search.SubjectHeadingSearchEntry in project step by STEPBible.

the class SubjectSearchServiceImpl method getResultsAsHeadings.

private SearchResult getResultsAsHeadings(SearchQuery sq, String[] searchableVersions, Key allTopics) {
    final SearchResult headingsSearch = this.jswordSearch.getResultsFromTrimmedKeys(sq, searchableVersions, allTopics.getCardinality(), allTopics, HEADINGS_ONLY);
    // build the results and then return
    final SubjectHeadingSearchEntry headings = new SubjectHeadingSearchEntry();
    headings.setHeadingsSearch(headingsSearch);
    // return the results
    final SearchResult sr = new SearchResult();
    sr.addEntry(headings);
    sr.setTotal(headingsSearch.getTotal());
    sr.setTimeTookToRetrieveScripture(headingsSearch.getTimeTookToRetrieveScripture());
    return sr;
}
Also used : SubjectHeadingSearchEntry(com.tyndalehouse.step.core.models.search.SubjectHeadingSearchEntry) SearchResult(com.tyndalehouse.step.core.models.search.SearchResult)

Example 2 with SubjectHeadingSearchEntry

use of com.tyndalehouse.step.core.models.search.SubjectHeadingSearchEntry in project step by STEPBible.

the class SearchServiceImplTest method testSubjectSearch.

/**
 * test exact strong match
 */
@Test
public void testSubjectSearch() {
    final SearchResult searchSubject = this.searchServiceUnderTest.search(new SearchQuery("sh=elijah", new String[] { "ESV_th" }, "false", 0, 1, 1, null));
    final List<SearchEntry> entries = ((SubjectHeadingSearchEntry) searchSubject.getResults().get(0)).getHeadingsSearch().getResults();
    for (final SearchEntry e : entries) {
        LOGGER.debug(((VerseSearchEntry) e).getPreview());
    }
    assertTrue(searchSubject.getResults().size() > 0);
}
Also used : SearchQuery(com.tyndalehouse.step.core.service.impl.SearchQuery) SearchResult(com.tyndalehouse.step.core.models.search.SearchResult) SubjectHeadingSearchEntry(com.tyndalehouse.step.core.models.search.SubjectHeadingSearchEntry) VerseSearchEntry(com.tyndalehouse.step.core.models.search.VerseSearchEntry) TimelineEventSearchEntry(com.tyndalehouse.step.core.models.search.TimelineEventSearchEntry) SearchEntry(com.tyndalehouse.step.core.models.search.SearchEntry) Test(org.junit.Test)

Aggregations

SearchResult (com.tyndalehouse.step.core.models.search.SearchResult)2 SubjectHeadingSearchEntry (com.tyndalehouse.step.core.models.search.SubjectHeadingSearchEntry)2 SearchEntry (com.tyndalehouse.step.core.models.search.SearchEntry)1 TimelineEventSearchEntry (com.tyndalehouse.step.core.models.search.TimelineEventSearchEntry)1 VerseSearchEntry (com.tyndalehouse.step.core.models.search.VerseSearchEntry)1 SearchQuery (com.tyndalehouse.step.core.service.impl.SearchQuery)1 Test (org.junit.Test)1