use of org.compass.core.mapping.osem.ComponentMapping in project Gemma by PavlidisLab.
the class SearchServiceImpl method process.
/**
* Recursively cache the highlighted text. This must be done during the search transaction.
*
* @param givenMappings on first call, the root mapping(s)
*/
private void process(ResourceMapping[] givenMappings, CompassHits hits) {
for (ResourceMapping resourceMapping : givenMappings) {
// one for each property.
Iterator<Mapping> mappings = resourceMapping.mappingsIt();
for (; mappings.hasNext(); ) {
Mapping m = mappings.next();
if (m instanceof ComponentMapping) {
ClassMapping[] refClassMappings = ((ComponentMapping) m).getRefClassMappings();
this.process(refClassMappings, hits);
} else {
String name = m.getName();
for (int i = 0; i < hits.getLength(); i++) {
try {
// we might want to bail as soon as we find something?
hits.highlighter(i).fragment(name);
if (SearchServiceImpl.log.isDebugEnabled())
SearchServiceImpl.log.debug("Cached " + name);
} catch (Exception e) {
// skip this property entirely...
break;
}
}
}
}
}
}
Aggregations