public Collection<? extends Entity> lookup(UriRef field,
Set<UriRef> includeFields,
List<String> search,
String[] languages,
Integer limit) throws EntitySearcherException {
Entityhub entityhub = getSearchService();
if(entityhub == null){
throw new EntitySearcherException("The Entityhub is currently not active");
}
FieldQuery query = EntitySearcherUtils.createFieldQuery(entityhub.getQueryFactory(),
field, includeFields, search, languages);
if(limit != null && limit > 0){
query.setLimit(limit);
} else if(this.limit != null){
query.setLimit(this.limit);
}
QueryResultList<Representation> results;
try {
results = entityhub.find(query);
} catch (EntityhubException e) {
throw new EntitySearcherException("Exception while searchign for "+
search+'@'+Arrays.toString(languages)+"in the Entityhub", e);
}
Collection<Entity> entities = new ArrayList<Entity>(results.size());