A sample for a module and rest-service for enabling auto-tagging to Liferay DXP.
Watch this youtube video about auto-tagging first
- Liferay IDE
- Liferay DXP
- Elasticsearch (not embedded)
- First create a war file of the tagger-service
- Install the war file in your application-server (this example uses Tomcat)
- Configure the rest-service (see also externalized properties)
com.liferay.tagger.elasticservice.port=9300
com.liferay.tagger.elasticservice.host=127.0.0.1
com.liferay.tagger.elasticservice.clustername=liferay-cluster
You can also configure the rest-service using a context xml file like
tagger-service.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context logEffectiveXml="true" docBase="/data/webapps/tagger-service.war">
<Parameter name="com.liferay.tagger.elasticservice.port" value="9300" override="true"/>
<Parameter name="com.liferay.tagger.elasticservice.host" value="127.0.0.1" override="true"/>
<Parameter name="com.liferay.tagger.elasticservice.clustername" value="liferay-cluster" override="true"/>
</Context>
- To test the rest-service try
curl http://127.0.0.1:8080/tagger-service/rest/test
- To initialize the rest-service run
curl http://127.0.0.1:8080/tagger-service/rest/init
- Now run
curl -X POST -F text="I love the little tree" http://127.0.0.1:8080/tagger-service/rest/tags
and it should come back withbonsai
- First build a jar in the ElasticTagger project using gradle
- Deploy the jar into the Liferay deploy folder
- Configure the new module by adding the following parameters in your portal-ext.properties
com.liferay.tagger.service.url=http://127.0.0.1:8080/tagger-service/rest/tags
com.liferay.tagger.has-tag=autotag
- If you don't specify
com.liferay.tagger.has-tag
it will auto-tag on each and every webcontent item