Search in sources :

Example 1 with LexicalSearchEntry

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

the class SearchServiceImpl method rebuildSearchResults.

/**
 * Takes a new order and rebuilds a list of search results
 *
 * @param lexiconDefinitions the strong numbers, ordered
 * @param keyedOrder         the set of results to be re-ordered
 * @return a new list of results, now ordered
 */
private List<LexicalSearchEntry> rebuildSearchResults(final List<EntityDoc> lexiconDefinitions, final Map<String, List<LexicalSearchEntry>> keyedOrder) {
    final List<LexicalSearchEntry> newOrder = new ArrayList<LexicalSearchEntry>();
    for (final EntityDoc def : lexiconDefinitions) {
        final List<LexicalSearchEntry> list = keyedOrder.get(def.get(STRONG_NUMBER_FIELD));
        if (list != null) {
            newOrder.addAll(list);
            for (final LexicalSearchEntry e : list) {
                e.setStepGloss(def.get("stepGloss"));
                e.setStepTransliteration(def.get("stepTransliteration"));
                e.setAccentedUnicode(def.get("accentedUnicode"));
                e.setStrongNumber(def.get("strongNumber"));
            }
        }
    }
    return newOrder;
}
Also used : LexicalSearchEntry(com.tyndalehouse.step.core.models.search.LexicalSearchEntry) ArrayList(java.util.ArrayList) EntityDoc(com.tyndalehouse.step.core.data.EntityDoc)

Aggregations

EntityDoc (com.tyndalehouse.step.core.data.EntityDoc)1 LexicalSearchEntry (com.tyndalehouse.step.core.models.search.LexicalSearchEntry)1 ArrayList (java.util.ArrayList)1