Skip to content

Make non Liferay Index Documents Findable

Petteri Karttunen edited this page Aug 9, 2018 · 1 revision

To get this portlet to find "external" assets in the Liferay index, you have to index those assets to that portal company's index, you want them to be findable at. It's possible to spread the search across multiple indexes but that would require some more customization of the search adapter.

There's a sample non Liferay result item builder in gsearch-core-impl and here's how you can test it. Add a sample document into your index having the following fields:

  • title
  • content
  • description

The fields above are the fields which are targeted for search. There can also be localized versions of those

  • modified: modification date. See syntax from other Liferay documents
  • entryClassName: this should match the type you configured in GSearch configuration
  • treePath: this is just a random field existing in the type mapping we use for the link. That can be any other of the mapping, as long as you implement the getLink() method of the result item builder.
  • companyId: your portal instance's id
  • stagingGroup: this just tell's that this is a "live" content
  • status: 0 = published
  • roleId: roles allowed to view this content
  • groupRoleId: group roles allowed to view the content
  • entryClassPK: any long value. Doesn't really matter here.

Here's a cURL script for adding an example document:

curl -XPOST 'localhost:9200/liferay-20116/LiferayDocumentType/?pretty' -H 'Content-Type: application/json' -d'
{
   "title": "Non Liferay Asset In Elasticsearch Index Hey",
   "description": "This is definitely not a Liferay Asset. Check it out by yourself.",
   "content":  "Still trying this out...",
   "modified":  "20171028095357",
   "entryClassName": "non-liferay-type",
   "treePath": "http://www.google.fi",
   "companyId": "20116",
   "stagingGroup": "false",
   "status": "0",
   "roleId": "20123",
   "groupRoleId": "20143-20131",
   "entryClassPK": "0"
}
'

Now search for the document through the user interface.

Clone this wiki locally