private String constructLuceneQuery(ReadGraph graph, Resource type, String filter) throws DatabaseException {
Layer0 L0 = Layer0.getInstance(graph);
StringBuilder sb = new StringBuilder();
- if (!L0.Entity.equals(type)) {
+ boolean emptyFilter = filter.isEmpty();
+ if (emptyFilter || !type.equals(L0.Entity)) {
String typeName = graph.getPossibleRelatedValue(type, L0.HasName, Bindings.STRING);
if (typeName == null || typeName.isEmpty())
return null;
- sb.append("Types:*").append( IndexQueries.escape( typeName, true ) );
+ sb.append("Types:").append( IndexQueries.escape( typeName, true ) );
}
- if (filter.length() > 0) {
+ if (!emptyFilter) {
if (sb.length() > 0)
sb.append(" AND ");
sb.append(filter);