An example on how to build a configurable widget to trigger external searches along with Liferay search to Elasticsearch.

Overview

Liferay External Searches

An example on how to build a configurable widget to trigger external searches along with Liferay search to Elasticsearch.

preview

Getting Started

You can either:

  • Clone this repo
  • Run ./gradlew initBundle deploy

Or:

  • Download the modules from the release page
  • Unzip the Java 8 or 11 version.
  • Move the JARs to the deploy folder under your Liferay home.

Once the 3 modules (external-search-api, external-search-service and external-search-results-web) are deployed:

  • Go to the Liferay page where search results are displayed (default: /search)
  • Add the widget External Search Results (under the Search category)
  • Click on Configure an external search engine to be used.
  • Select an External Search Engine from the dropdown list (default options: Reddit, Stack Overflow, Wikipedia)
  • Click Save
  • If the search page is a Content Page, click Publish.

Now when you run a search in Liferay, you should see results from the search engine selected in its own widget.

You can repeat this process and add more instances of the widget External Search Results with different configurations.

Going Further

Search Options

In the configuration, you can find a textarea for Search Options. This is a list of search options to fill as a key-value pairs (one per line). The supported options are search engine dependents, so you need to refer to each external search documentation (e.g. Stack Exchange Search API).

Display Template

This widget supports Application Display Templates (ADT), also called Widget Templates.

By default, you'll find 3 templates:

If you take a look at them, you'll notice that you can have more information than the name and URL of each search result. A map of metadata can be associated with each type of search result. For example to retrieve and display the tags associated with a Stack Overflow topic.

More Searches

If you clone this repo, you can try to add more external search sources in the external-search-service module.

The process is pretty simple and straightforward:

  • Create a new class
  • Annotate with @Component
  • Add a service attribute to the @Component with the value ExternalSearch.class
  • Add a property attribute to the @Component with the value engine= followed by the same of the source
  • Extends BaseExternalSearch and implements required methods

Checkout the RedditService class as an example.

In some cases, you might want to override the search methods. For example, the WikipediaService supports localization and overriding the search methods is needed to pass the right domain prefix depending on the language.

Feedback & Contribution

Feel free to open issues if you have any question/suggestion or pull requests if you want to contribute.

License

MIT

You might also like...

DatasetCreator is a lightweight RESTFul client implementation of the Salesforce CRM Analytics External Data API.

DatasetCreator is a lightweight RESTFul client implementation of the Salesforce CRM Analytics External Data API. It has been deliberately developed with no 3rd party jars with the goal of being a lean, reliable and scalable solution.

Dec 16, 2022

A lightweight and extensible library to resolve application properties from various external sources.

Externalized Properties A lightweight and extensible library to resolve application properties from various external sources. Twelve Factor Methodolog

Nov 29, 2022

Spring Boot Login and Registration example with MySQL, JWT, Rest Api - Spring Boot Spring Security Login example

Spring Boot Login and Registration example with MySQL, JWT, Rest Api - Spring Boot Spring Security Login example

Spring Boot Login example with Spring Security, MySQL and JWT Appropriate Flow for User Login and Registration with JWT Spring Boot Rest Api Architect

Jan 5, 2023

Spring Boot Security Login example with JWT and H2 example

 Spring Boot Security Login example with JWT and H2 example

Spring Boot Security Login example with JWT and H2 example Appropriate Flow for User Login and Registration with JWT and HttpOnly Cookie Spring Boot R

Dec 21, 2022

This module explains about the example of Spring MVC + Database Integration with MySQL using Hibernate ORM with practical coding example and required JAR dependencies

SpringMVC-Database-Integration This module explains about the example of Spring MVC + Database Integration with MySQL using Hibernate ORM with practic

Nov 2, 2021

mall学习教程,架构、业务、技术要点全方位解析。mall项目(40k+star)是一套电商系统,使用现阶段主流技术实现。涵盖了SpringBoot 2.3.0、MyBatis 3.4.6、Elasticsearch 7.6.2、RabbitMQ 3.7.15、Redis 5.0、MongoDB 4.2.5、Mysql5.7等技术,采用Docker容器化部署。

mall学习教程,架构、业务、技术要点全方位解析。mall项目(40k+star)是一套电商系统,使用现阶段主流技术实现。涵盖了SpringBoot 2.3.0、MyBatis 3.4.6、Elasticsearch 7.6.2、RabbitMQ 3.7.15、Redis 5.0、MongoDB 4.2.5、Mysql5.7等技术,采用Docker容器化部署。

mall学习教程 简介 mall学习教程,架构、业务、技术要点全方位解析。mall项目(40k+star)是一套电商系统,使用现阶段主流技术实现。涵盖了SpringBoot 2.3.0、MyBatis 3.4.6、Elasticsearch 7.6.2、RabbitMQ 3.7.15、Redis 5

Jan 8, 2023

mall-swarm是一套微服务商城系统,采用了 Spring Cloud Hoxton & Alibaba、Spring Boot 2.3、Oauth2、MyBatis、Docker、Elasticsearch、Kubernetes等核心技术,同时提供了基于Vue的管理后台方便快速搭建系统。mall-swarm在电商业务的基础集成了注册中心、配置中心、监控中心、网关等系统功能。文档齐全,附带全套Spring Cloud教程。

mall-swarm是一套微服务商城系统,采用了 Spring Cloud Hoxton & Alibaba、Spring Boot 2.3、Oauth2、MyBatis、Docker、Elasticsearch、Kubernetes等核心技术,同时提供了基于Vue的管理后台方便快速搭建系统。mall-swarm在电商业务的基础集成了注册中心、配置中心、监控中心、网关等系统功能。文档齐全,附带全套Spring Cloud教程。

mall-swarm 友情提示 快速体验项目:在线访问地址。 全套学习教程:《mall学习教程》。 Spring Cloud全套教程:《SpringCloud学习教程》。 专属学习路线:学习不走弯路,整理了套非常不错的《mall专属学习路线》。 项目交流:想要加群交流项目的朋友,可以加入mall项目

Jan 3, 2023

【咕泡学院实战项目】-基于SpringBoot+Dubbo构建的电商平台-微服务架构、商城、电商、微服务、高并发、kafka、Elasticsearch

【咕泡学院实战项目】-基于SpringBoot+Dubbo构建的电商平台-微服务架构、商城、电商、微服务、高并发、kafka、Elasticsearch

咕泡商城- 微服务架构实战 咕泡商城是咕泡学院 Java架构课程中,帮助学员对于技术更好落地的一个实战项目,项目基于springboot2.1.6.RELEASE+Dubbo2.7.3 来构建微服务。 业务模块划分,尽量贴合互联网公司的架构体系。所以,除了业务本身的复杂度不是很高之外,整体的架构基本

Dec 26, 2022

🦄 开源社区系统:基于 SpringBoot + MyBatis + MySQL + Redis + Kafka + Elasticsearch + Spring Security + ... 并提供详细的开发文档和配套教程。包含帖子、评论、私信、系统通知、点赞、关注、搜索、用户设置、数据统计等模块。

🦄 开源社区系统:基于 SpringBoot + MyBatis + MySQL + Redis + Kafka + Elasticsearch + Spring Security + ... 并提供详细的开发文档和配套教程。包含帖子、评论、私信、系统通知、点赞、关注、搜索、用户设置、数据统计等模块。

Echo — 开源社区系统 项目上线到服务器之后可能会出现各种各样的 BUG,比如 Elasticsearch 服务启动失败导致搜索模块不可用,但是在本地运行是完全没问题的,所以各位小伙伴可以放心下载部署。 📚 项目简介 Echo 是一套前后端不分离的开源社区系统,基于目前主流 Java Web

Jan 7, 2023
Owner
Louis-Guillaume Durand
Louis-Guillaume Durand
This app/widget is based on the work of Anthony (tonesto7), which is in turn based on the earlier work of David Schablowsky

Mustang Mach-E Widget for Android Intro This app/widget is based on the work of Anthony (tonesto7), which is in turn based on the earlier work of Davi

null 25 Nov 15, 2022
A beautiful Clock Widget for your Desktop! (tested on Windows)

ClockWidget A beautiful Clock Widget for your Desktop! (tested on Windows) This is a clock widget that I programmed in the first year of Computer Scie

Hasan Tuna 7 Dec 15, 2022
Search API with spelling correction using ngram-index algorithm: implementation using Java Spring-boot and MySQL ngram full text search index

Search API to handle Spelling-Corrections Based on N-gram index algorithm: using MySQL Ngram Full-Text Parser Sample Screen-Recording Screen.Recording

Hardik Singh Behl 5 Dec 4, 2021
Minecraft configurable plugin , which sends messages the first time a player logs into the server or the next time they log in.

JoinMessages Minecraft configurable plugin , which sends messages the first time a player logs into the server or the next time they log in or leave.

ᴠᴀʟᴇɴᴛɪɴ ᴢʜᴇʟᴇᴠ 6 Aug 30, 2022
A plugin that adds Qualities to Items, along with the ability for the user to create their own.

ItemQualities ItemQualities is a Minecraft Plugin for 1.18+ Servers that adds a special functionality to Damagable items. Inspired by the Quality Tool

Abraxas 7 Jul 1, 2022
Application for creating blog posts, developed with Java using Spring Framework for backend and Angular along with PrimeNG Library for frontend development.

Application for creating blog posts, developed with Java using Spring Framework for backend and Angular along with PrimeNG Library for frontend development.

Áureo Carmelino 10 Nov 27, 2022
Example how to reduce React Native iOS build times drastically

Reduce React Native iOS build times Introduction Amount of code in pods can be huge. Pods don’t change often. On CI, all pods are compiled over and ov

Dirk Postma 28 Dec 15, 2022
A lightweight and extensible library to resolve application properties from various external sources.

Externalized Properties A lightweight and extensible library to resolve application properties from various external sources. Twelve Factor Methodolog

Joel Jeremy Marquez 20 Nov 29, 2022
Docker-compose-integration-tstst - An exploration of how to run integration tests against an application that has inconvenient external dependencies (e.g. a SQL database).

Tstst? it was supposed to be docker-compose-integration-tests but i was too lazy to fix it at the outset, and now im trying to convince myself its fun

null 1 Jan 4, 2022
Java library to launch external processes

ch.vorburger.exec If you like/use this project, a Star / Watch / Follow me on GitHub is appreciated! This project is a small library allowing to launc

Michael Vorburger ⛑️ 25 Sep 7, 2022