on ‎2018 May 16 9:26 AM
Hi Experts,
how can we Limit the no. of rows in in flexible search
e.g. If i want to get only 3 rows from given result. the operation should perform at database side Thanks, Jayant
Request clarification before answering.
Hello Jayant,
You can use most of the common SQL clauses like TOP or LIMIT
e.g.
SELECT {c.name}
FROM {Customer as c}
ORDER BY {c.name} DESC
LIMIT 3
or
SELECT TOP 3 {c.name}
FROM {Customer as c}
ORDER BY {c.name} DESC
Regards, Pawel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
An other not database specific solution would be:
private List<Object> searchObject(final String typeCode, final int limit) {
final FlexibleSearchQuery query = new FlexibleSearchQuery("SELECT {PK} FROM {" + typeCode + "}");
query.setDisableCaching(DISABLE_CACHING);
query.setDisableSearchRestrictions(DISABLE_SEARCH_RESTRICTIONS);
query.setCount(limit); // <== limit
return emptyIfNull(getFlexibleSearchService().search(query).getResult());
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.