1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.directory.util;
16  
17  import com.liferay.portal.kernel.search.Document;
18  import com.liferay.portal.kernel.search.HitsOpenSearchImpl;
19  import com.liferay.portal.kernel.search.Indexer;
20  import com.liferay.portal.kernel.search.Summary;
21  import com.liferay.portlet.enterpriseadmin.util.UserIndexer;
22  
23  import javax.portlet.PortletURL;
24  
25  /**
26   * <a href="DirectoryOpenSearchImpl.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   */
30  public class DirectoryOpenSearchImpl extends HitsOpenSearchImpl {
31  
32      public static final String SEARCH_PATH = "/c/directory/open_search";
33  
34      public static final String TITLE = "Liferay Directory Search: ";
35  
36      public String getPortletId() {
37          return UserIndexer.PORTLET_ID;
38      }
39  
40      public String getSearchPath() {
41          return SEARCH_PATH;
42      }
43  
44      public Summary getSummary(
45          Indexer indexer, Document document, String snippet,
46          PortletURL portletURL) {
47  
48          Summary summary = super.getSummary(
49              indexer, document, snippet, portletURL);
50  
51          portletURL = summary.getPortletURL();
52  
53          portletURL.setParameter("struts_action", "/directory/view_user");
54  
55          return summary;
56      }
57  
58      public String getTitle(String keywords) {
59          return TITLE + keywords;
60      }
61  
62  }