掲示板
case insensitive keywords search for "shopping" portlet
14年前 に Sam Wan によって更新されました。
case insensitive keywords search for "shopping" portlet
Liferay Master 投稿: 660 参加年月日: 09/03/03 最新の投稿
Hi guys,
Anyone want me submit the following "fix" for " com/liferay/portlet/shopping/service/persistence/ShoppingItemFinderImpl.java"? It handles case insensitive keywords search.
Anyone want me submit the following "fix" for " com/liferay/portlet/shopping/service/persistence/ShoppingItemFinderImpl.java"? It handles case insensitive keywords search.
public List<shoppingitem> findByKeywords(
long groupId, long[] categoryIds, String keywords, int start,
int end)
throws SystemException {
Session session = null;
try {
session = openSession();
StringBuilder query = new StringBuilder();
query.append("SELECT {ShoppingItem.*} FROM ShoppingItem ");
query.append("INNER JOIN ShoppingCategory ON ");
query.append("ShoppingCategory.categoryId = ");
query.append("ShoppingItem.categoryId ");
query.append("WHERE ");
query.append("ShoppingCategory.groupId = ? AND (");
if ((categoryIds != null) && (categoryIds.length > 0)) {
query.append("(");
for (int i = 0; i < categoryIds.length; i++) {
query.append("ShoppingItem.categoryId = ? ");
if (i + 1 < categoryIds.length) {
query.append("OR ");
}
}
query.append(") AND ");
}
query.append("(lower(ShoppingItem.name) LIKE lower(?) OR ");
query.append("lower(ShoppingItem.description) LIKE lower(?) OR ");
query.append("lower(ShoppingItem.properties) LIKE lower(?)))");
keywords = '%' + keywords.toLowerCase() + '%';
SQLQuery q = session.createSQLQuery(query.toString());
q.addEntity("ShoppingItem", ShoppingItemImpl.class);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(groupId);
for (int i = 0; i < categoryIds.length; i++) {
qPos.add(categoryIds[i]);
}
qPos.add(keywords);
qPos.add(keywords);
qPos.add(keywords);
return (List<shoppingitem>)QueryUtil.list(
q, getDialect(), start, end);
}
catch (Exception e) {
throw new SystemException(e);
}
finally {
closeSession(session);
}
}
</shoppingitem></shoppingitem>
14年前 に Sam Wan によって更新されました。
RE: case insensitive keywords search for "shopping" portlet
Liferay Master 投稿: 660 参加年月日: 09/03/03 最新の投稿
Hi, anyone do not think this change is worthwhile? :d
Sam
Sam
14年前 に Lisa Simpson によって更新されました。
RE: case insensitive keywords search for "shopping" portlet
Liferay Legend 投稿: 2034 参加年月日: 09/03/05 最新の投稿
I think anything that makes their shopping portlet more usable is worthwhile. And that's certainly a worthy fix!
14年前 に Sam Wan によって更新されました。
RE: case insensitive keywords search for "shopping" portlet
Liferay Master 投稿: 660 参加年月日: 09/03/03 最新の投稿
I ha
I have submitted a fix, but no feedback yet.
Lisa Simpson:
I think anything that makes their shopping portlet more usable is worthwhile. And that's certainly a worthy fix!
I have submitted a fix, but no feedback yet.