How to add repository contents to be searchable via search portlet. I have integrated Google drive with Liferay. All documents which are in google drive can be viewed and edited. Can anyone please tell any step by step guidelines of how to integrate any external repository to be indexed and integrated with search portlet in liferay?.
1 Answers
You can create an indexer for the documents from google drive.
Liferay’s search and indexing functionality is provided by Apache Lucene, a Java-based search library. To implement search and indexing functionality for an entity, you need to follow these three steps:
Create an *Indexer class in your portlet project and register this class in your project’s liferay-portlet.xml file.
Update your entity’s service layer so that the index is updated upon the creation, modification, or deletion of an entity.
Provide a mechanism to perform a search. For example, you could create one JSP in your portlet project for entering search queries and another JSP for displaying the search results. Or you could simply configure Liferay’s Search portlet to search for your entities.
for more info see the docs https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/implementing-search-and-indexing

- 901
- 5
- 7
-
Thanks Romeo. I have gone through the docs. For integrating google drive I have downloaded gdrive hook in liferay marketplace (Please refer this link: https://web.liferay.com/marketplace/-/mp/application/46040385). I have taken BlogsIndexer class as a sample to build my own GoogleDriveIndexer class, but in BlogsIndexer to build a document object they are setting fields like content, description etc. I can't find this fields in google drive hook source code.I'm a newbie in liferay, can you please help or suggest any alternative for this problem?. – proGhost07 Feb 01 '17 at 09:59
-
the document is like an map key-value so in this case `document.addText(Field.CONTENT, content)` is the same of doing `document.addText("content", content)` . there are other method like `document.addFile(name,bytes,extensions);` – Romeo Sheshi Feb 01 '17 at 10:38
-
Thanks again, will try and post the code if there are any issues. – proGhost07 Feb 02 '17 at 10:32