OK. 1st step was to place hook on [b]html/taglib/search/start.jsp[/b]. I passed an extra id parameter to define on which private page i gonna search.
<input name="<%= namespace %>keywords" size="30" title="<liferay-ui:message key="search" />" type="text" value="<%= HtmlUtil.escapeAttribute(keywords) %>" />
<input name="<%= namespace %>groupid" value="0" type="hidden" />
<select name="<%= namespace %>scopeId" title="<liferay-ui:message key="scope" /> ">
<option value="0" <%= selected == 0 ? "selected" : ""%>><liferay-ui:message key="everything" /></option>
<option value="1" <%= selected == 1 ? "selected" : ""%>>Новости</option>
<option value="2" <%= selected == 2 ? "selected" : ""%>>Сотрудники</option>
<option value="3" <%= selected == 3 ? "selected" : ""%>>Новому сотруднику</option>
<option value="4" <%= selected == 4 ? "selected" : ""%>>Корпоративные правила</option>
<option value="5" <%= selected == 5 ? "selected" : ""%>>Продукты</option>
<option value="6" <%= selected == 6 ? "selected" : ""%>>Wiki</option>
<option value="7" <%= selected == 7 ? "selected" : ""%>>События</option>
<option value="8" <%= selected == 8 ? "selected" : ""%>>Форум</option>
</select>
2nd step was to hook on [b]html/portlet/search/main_search.jsp[/b]. There i was going to filter [b]ALL[/b] search results and display only those which needed by request from [b]select field[/b]. It's OK for non instanceble custom portlets with have different id, i just filter by portletId and display result.
Hits hits = indexer.search(searchContext);
List<Document> documents = new ArrayList<Document>();
documents = hits.toList();
...
if (documents.size() != 0) {
List<Document> toDelete = new ArrayList<Document>();
for (Document document : documents) {
String id = document.getPortletId();
id = document.get(Field.PORTLET_ID);
switch (scopeId) {
case 0:
break;
case 1:
if (!id.equals(NEWS_PORTLET_ID)) {
toDelete.add(document);
}
break;
....
if (toDelete.size() != 0) {
documents.removeAll(toDelete);
hits.setDocs(documents.toArray(new Document[documents.size()]));
if (documents.size() == 0) {
hits.setLength(0);
}
}
All fine. But 3 of my pages all have asset publisher portlet (portletId = 15), so if i filter by portlet id - i will get results from all 3 pages. Maybe i can get instance id of portlet which document belongs to. Or maybe there is some other way to do search.
Atm i try to implement my CustomJournalArticleIndexer. The idea is Indexer adds field containing portlet's instance id. So later in main_search.jsp i can do something like document.getPortletInstanceId and compare it with a constant paired with scopeId of my request.
Any suggestions here? Thanks and... from Russia with love!