Guys,
Nothing seems to be working!!
I still get "ALL" the results on the first page no matter what delta value I set... I'm in a dire need of a solution within next two days.

Attaching my entire search.jsp code.. Hope someone has any idea as to what I'm missing here!
1
2
3<%
4 String redirect = ParamUtil.getString(request, "redirect");
5 String keywords0 = ParamUtil.getString(request, "keywords0");
6 String searchType = ParamUtil.getString(request, "searchType");
7 System.out.println("KEYWORDS : " + keywords0);
8 int total = 0;
9 String description;
10%>
11<liferay-portlet:renderURL varImpl="searchURL">
12 <portlet:param name="jspPage" value="/html/search.jsp" />
13</liferay-portlet:renderURL>
14
15<liferay-ui:header backURL="<%= redirect %>" title="Search Results" />
16
17<div class="grid_12 spanning-search marginbottom20"
18 style="clear: left; margin-bottom: 0">
19 <form action="<%=searchURL%>" method="get" name="fm0" id="fm0">
20 <input name="redirect" type="hidden" value="<%= redirect %>" />
21 <liferay-portlet:renderURLParams varImpl="searchURL" />
22 <%
23 PortletURL portletURL = renderResponse.createRenderURL();
24 portletURL.setParameter("jspPage", "/html/search.jsp");
25 portletURL.setParameter("redirect", redirect);
26 portletURL.setParameter("keywords0", keywords0);
27 portletURL.setParameter("searchType", searchType);
28 List<String> headerNames = new ArrayList<String>();
29 headerNames.add("#");
30 headerNames.add("file");
31 headerNames.add("description");
32 SearchContainer<DLFileEntry> searchContainer = new SearchContainer<DLFileEntry>(
33 renderRequest,
34 null,
35 null,
36 SearchContainer.DEFAULT_CUR_PARAM,
37 5,
38 portletURL,
39 headerNames,
40 LanguageUtil
41 .format(pageContext,
42 "no-entries-were-found-that-matched-the-keywords-x",
43 "<strong>" + HtmlUtil.escape(keywords0)
44 + "</strong>"));
45
46 DLFileEntry dlFileEntry = null;
47 long folderId = 0L;
48 List<DLFolder> childFolders = null;
49 List<Object> files = null;
50 String folderName = null;
51 long[] folderIds = new long[10];
52 int i = 0;
53 try {
54
55 folderName = searchType;
56
57 // get theme-display object to retrieve groupId
58 themeDisplay = (ThemeDisplay) request
59 .getAttribute(WebKeys.THEME_DISPLAY);
60
61 System.out.println(themeDisplay.getParentGroupId());
62
63 // get folder-id from group-id and using folder-name
64 try {
65 folderId = DLFolderServiceUtil.getFolderId(
66 themeDisplay.getParentGroupId(), 0, folderName);
67 } catch (Exception e) {
68 if (e instanceof SystemException
69 || e instanceof PortalException) {
70 folderId = (-1);
71 } else
72 throw e;
73 }
74
75 System.out.println(folderId);
76
77 folderIds[i++] = folderId;
78 // get all the child folders
79 childFolders = DLFolderServiceUtil.getFolders(
80 themeDisplay.getParentGroupId(), folderId);
81
82 // get all folder-ids of child-folder
83 if (!childFolders.isEmpty()) {
84 for (DLFolder dlFolder : childFolders) {
85 System.out.println(dlFolder.getFolderId());
86 folderIds[i++] = dlFolder.getFolderId();
87 }
88 }
89
90 Indexer indexer = IndexerRegistryUtil
91 .getIndexer(DLFileEntry.class);
92 SearchContext searchContext = SearchContextFactory
93 .getInstance(request);
94 searchContext.setEnd(searchContainer.getEnd());
95 if (!keywords0.trim().equals("")) {
96 searchContext.setKeywords(keywords0);
97 }
98 searchContext.setStart(searchContainer.getStart());
99
100 //Add folder-ids and group-ids
101 searchContext.setCompanyId(themeDisplay.getCompanyId());
102 searchContext.setFolderIds(folderIds);
103 searchContext.setEnd(100);
104 long[] groupIds = { themeDisplay.getParentGroupId() };
105 searchContext.setGroupIds(groupIds);
106 Hits results = indexer.search(searchContext);
107 total = results.getLength();
108 searchContainer.setTotal(total);
109 List<ResultRow> resultRows = searchContainer.getResultRows();
110 for (i = 0; i < results.getDocs().length; i++) {
111 Document doc = results.doc(i);
112 ResultRow row = new ResultRow(doc, i, i);
113 // Position
114 row.addText(searchContainer.getStart() + i + 1
115 + StringPool.PERIOD);
116 // Slogan
117 long fileId = GetterUtil.getLong(doc
118 .get(Field.ENTRY_CLASS_PK));
119 dlFileEntry = DLFileEntryLocalServiceUtil
120 .getDLFileEntry(fileId);
121 String fileDownloadURL = "/documents/"
122 + themeDisplay.getParentGroupId() + "/"
123 + dlFileEntry.getUuid();
124 row.addText(dlFileEntry.getTitle(), fileDownloadURL);
125 // description
126
127 if (dlFileEntry.getDescription() != null
128 && !dlFileEntry.getDescription().trim().equals("")) {
129 description = dlFileEntry.getDescription();
130 } else
131 description = StringUtil.shorten(
132 doc.get(Field.CONTENT), 200);
133
134 row.addText(description);
135 // Add result row
136 resultRows.add(row);
137 }
138 } catch (Exception e) {
139 e.printStackTrace();
140 }
141 %>
142
143 <input type="text" name="keywords0" size="30" title="search-entries"
144 value="<%=keywords0%>" onfocus="clearField(this)"
145 onblur="fillField(this)" class="search-short"> <input
146 type="hidden" name="searchType" value="Code"> <a
147 href="javascript:submitForm()" class="blue-button">Search</a>
148 </form>
149</div>
150<br />
151<br />
152<%
153 if (total <= 0) {
154%>
155<br />
156<br />
157<%
158 }
159%>
160<liferay-ui:search-iterator searchContainer="<%= searchContainer %>" paginate="true"/>
Firmi prego dentro per inbandierare questo come inadeguato.