Cover all the various ways we support searching from third party code, and when to use each. This is a necessary component to exposing the new 7.2 APIs: Queries, Filters, Aggregations, Sorts, etc.
New in 7.2:
- APIs moved to com.liferay.portal.search.api module
- some are now duplicated: also preserved in the Portal Core (com.liferay.portal.kernel) for backward compatibility reasons)
- "Legacy APIs":
- APIs provided by "com.liferay.portal.kernel" artifact are considered legacy in terms of no development, additions are made, only kept for backward compatibility and will be removed in a future release.
- New Query Types
- To be collected
- New Aggregation Types
- https://github.com/liferay/liferay-portal/tree/7.2.x/modules/apps/portal-search/portal-search-api/src/main/java/com/liferay/portal/search/aggregation. These Liferay counterparts of Elasticsearch aggregations: https://www.elastic.co/guide/en/elasticsearch/reference/6.5/search-aggregations.html
- Script Query, Function Score Query, Percolate Query, Regex Query, Ids Query, Exists Query, Constant Score Query, Common Terms Query. Boosting Query, Geo Bounding Box Query, Geo Distance Range Query, Geo Polygon Query
- New Highlight Subsystem
- https://github.com/liferay/liferay-portal/tree/7.2.x/modules/apps/portal-search/portal-search-api/src/main/java/com/liferay/portal/search/highlight. Interfaces: [Highlight, FieldConfig] x [Builder, BuilderFactory]
- New Significance Subsystem
- New Sort Subsystem
- Contribute Search permission fields and filters via extension points (
- In addition to standard permission support in Search, a developer may need to implement supplemental visibility: return extra results to current user, in addition to VIEW permissions, according to some special criteria.
- To achieve this effect, new extension points were added for developers to implement:
- Contribute extra fields when indexing permissions : SearchPermissionFieldContributor - Indexes new permission checking fields in a search document. These fields can be matched when returning search results via a corresponding SearchPermissionFilterContributor. Register implementations of this interface as OSGi components using the service SearchPermissionFieldContributor.
- Contribute extra filters when building permission clauses, to match the extra fields indexed: SearchPermissionFilterContributor - Contributes new filters for checking permissions on search results. Matches are based on the fields indexed by the corresponding SearchPermissionFieldContributor. Register implementations of this interface as OSGi components using the service SearchPermissionFilterContributor.
- Usage example: (
LPS-83563) Ensure that Document Library Search considers sharing permissions. Search results are filtered based on the permissions of the user viewing the results. We need to extend the permission check behaviour in search so the user can also see documents that have been shared with him even if he doesn't have VIEW permission on the document using the regular role/permission mechanism.
LPS-96199: As a Developer, I can intercept search requests and add query parts by implementing an extension point
- Cover ModelIndexerWriterContributor.getIndexerWriterMode and modelIndexed