
com.liferay.search.experiences.internal.search.SXPElementSearchRegistrar Maven / Gradle / Ivy
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of the Liferay Enterprise
* Subscription License ("License"). You may not use this file except in
* compliance with the License. You can obtain a copy of the License by
* contacting Liferay, Inc. See the License for the specific language governing
* permissions and limitations under the License, including but not limited to
* distribution rights of the Software.
*
*
*
*/
package com.liferay.search.experiences.internal.search;
import com.liferay.portal.kernel.search.Field;
import com.liferay.portal.search.spi.model.index.contributor.ModelIndexerWriterContributor;
import com.liferay.portal.search.spi.model.registrar.ModelSearchRegistrarHelper;
import com.liferay.portal.search.spi.model.result.contributor.ModelSummaryContributor;
import com.liferay.search.experiences.model.SXPElement;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;
/**
* @author Petteri Karttunen
*/
@Component(
enabled = false, immediate = true, service = SXPElementSearchRegistrar.class
)
public class SXPElementSearchRegistrar {
@Activate
protected void activate(BundleContext bundleContext) {
_serviceRegistration = modelSearchRegistrarHelper.register(
SXPElement.class, bundleContext,
modelSearchDefinition -> {
modelSearchDefinition.setDefaultSelectedFieldNames(
Field.COMPANY_ID, Field.ENTRY_CLASS_NAME,
Field.ENTRY_CLASS_PK, Field.GROUP_ID, Field.HIDDEN,
Field.MODIFIED_DATE, Field.SCOPE_GROUP_ID, Field.UID,
"readOnly");
modelSearchDefinition.setDefaultSelectedLocalizedFieldNames(
Field.DESCRIPTION, Field.TITLE);
modelSearchDefinition.setModelIndexWriteContributor(
modelIndexWriterContributor);
modelSearchDefinition.setModelSummaryContributor(
modelSummaryContributor);
});
}
@Deactivate
protected void deactivate() {
_serviceRegistration.unregister();
}
@Reference(
target = "(indexer.class.name=com.liferay.search.experiences.model.SXPElement)"
)
protected ModelIndexerWriterContributor
modelIndexWriterContributor;
@Reference
protected ModelSearchRegistrarHelper modelSearchRegistrarHelper;
@Reference(
target = "(indexer.class.name=com.liferay.search.experiences.model.SXPElement)"
)
protected ModelSummaryContributor modelSummaryContributor;
private ServiceRegistration> _serviceRegistration;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy