log.debug(" > field : " + field);
log.debug(" > lang : " + language);
log.debug(" > limit : " + limit);
log.debug(" > offset: " + offset);
log.debug(" > ldpath: " + ldpath);
FieldQuery query;
if(ldpath != null && !ldpath.isEmpty()){ //STANBOL-417
query = new LDPathFieldQueryImpl();
((LDPathFieldQueryImpl)query).setLDPathSelect(ldpath);
} else { //if no LDPath is parsed select the default field
query = queryFactory.createFieldQuery();
Collection<String> selectedFields = new ArrayList<String>();
selectedFields.add(field); //select also the field used to find entities
query.addSelectedFields(selectedFields);
}
if (language == null || language.trim().isEmpty()) {
query.setConstraint(field, new TextConstraint(name, PatternType.wildcard, false));
} else {
query.setConstraint(field, new TextConstraint(name, PatternType.wildcard, false, language));
}
if (limit != null && limit > 0) {
query.setLimit(limit);
}
if(offset != null && offset > 0) {
query.setOffset(offset);
}
return query;
}