use of com.tyndalehouse.step.core.data.EntityDoc in project step by STEPBible.
the class MorphologyServiceImpl method getDisplayMorphology.
/**
* @param code the code encountered during the xsl transformation
* @return the string to be displayed to the user
*/
public String getDisplayMorphology(final String code) {
final List<EntityDoc> morphologies = getMorphology(code);
final StringBuilder sb = new StringBuilder(128);
for (final EntityDoc m : morphologies) {
sb.append(m.get("inlineHtml"));
sb.append(NON_BREAKING_SPACE);
}
return sb.toString();
}
use of com.tyndalehouse.step.core.data.EntityDoc in project step by STEPBible.
the class SearchQuery method setDefinitions.
/**
* Gives the search query a bunch of definitions that have been found, using it in a "session" fashion.
*
* @param definitions the list of definitions.
*/
public void setDefinitions(final EntityDoc[] definitions) {
final List<EntityDoc> list = new ArrayList<EntityDoc>(definitions.length);
for (final EntityDoc d : definitions) {
list.add(d);
}
this.definitions = list;
}
use of com.tyndalehouse.step.core.data.EntityDoc in project step by STEPBible.
the class OriginalWordSuggestionServiceImpl method getMatchingAllForms.
/**
* retrieves forms from the lexicon
*
* @param greek true to indicate greek, false to indicate hebrew
* @param form form in lower case, containing a % if appropriate
* @return the list of suggestions
*/
private List<LexiconSuggestion> getMatchingAllForms(final boolean greek, final String form) {
final List<LexiconSuggestion> suggestions = new ArrayList<LexiconSuggestion>();
final EntityDoc[] results;
// search by unicode or translit?
if (isHebrewText(form) || GreekUtils.isGreekText(form)) {
results = this.specificForms.search(new String[] { "accentedUnicode" }, QueryParser.escape(form) + '*', getFilter(greek), TRANSLITERATION_SORT, true, SearchService.MAX_SUGGESTIONS);
} else {
// assume transliteration - at this point suggestionType is not going to be MEANING
final String simplifiedTransliteration = getSimplifiedTransliterationClause(greek, form, true);
results = this.specificForms.search(new String[] { "simplifiedStepTransliteration" }, simplifiedTransliteration, getFilter(greek), TRANSLITERATION_SORT, true, simplifiedTransliteration, SearchService.MAX_SUGGESTIONS);
}
for (final EntityDoc f : results) {
final LexiconSuggestion suggestion = convertToSuggestionFromSpecificForm(f);
if (suggestion != null) {
suggestions.add(suggestion);
}
}
return suggestions;
}
use of com.tyndalehouse.step.core.data.EntityDoc in project step by STEPBible.
the class SearchServiceImpl method buildTimelineSearchResults.
/**
* Construct the relevant entity structure to represent timeline search results
*
* @param sq the search query
* @param events the list of events retrieved
* @return the search results
*/
private SearchResult buildTimelineSearchResults(final SearchQuery sq, final EntityDoc[] events) {
final List<SearchEntry> results = new ArrayList<SearchEntry>();
final SearchResult r = new SearchResult();
r.setResults(results);
for (final EntityDoc e : events) {
final String refs = e.get("storedReferences");
final String[] references = StringUtils.split(refs);
final List<VerseSearchEntry> verses = new ArrayList<VerseSearchEntry>();
// TODO FIXME: REFACTOR to only make 1 jsword call?
for (final String ref : references) {
// TODO: REFACTOR only supports one version lookup
final VerseSearchEntry verseEntry = new VerseSearchEntry();
verses.add(verseEntry);
}
final TimelineEventSearchEntry entry = new TimelineEventSearchEntry();
entry.setId(e.get("id"));
entry.setDescription(e.get("name"));
entry.setVerses(verses);
results.add(entry);
}
return r;
}
use of com.tyndalehouse.step.core.data.EntityDoc in project step by STEPBible.
the class SearchServiceImpl method filterDefinitions.
/**
* Keep definitions that are of current interest to the user... Remove all others
*
* @param sq the search criteria
* @param lexiconDefinitions the definitions
* @return a list of definitions to be included in the filter
*/
private List<EntityDoc> filterDefinitions(final SearchQuery sq, final List<EntityDoc> lexiconDefinitions) {
final String[] originalFilter = sq.getCurrentSearch().getOriginalFilter();
if (originalFilter == null || originalFilter.length == 0) {
return lexiconDefinitions;
}
// bubble intersection, acceptable, because we're only dealing with a handful of definitions
final List<EntityDoc> keep = new ArrayList<EntityDoc>(lexiconDefinitions.size());
for (final EntityDoc def : lexiconDefinitions) {
for (final String filteredValue : originalFilter) {
if (def.get("strongNumber").equals(filteredValue)) {
keep.add(def);
// break out of filterValues loop, and proceed with next definition
break;
}
}
}
return keep;
}
Aggregations