Fórum

Search Indexing In Liferay 7.

Thirumal Reddy, modificado 7 Anos atrás.

Search Indexing In Liferay 7.

Regular Member Postagens: 216 Data de Entrada: 03/12/15 Postagens Recentes
Hi All,
I created a Site Template of 25 pages, and I created an organization from control panel by choosing that SiteTemplate, now there is no problem
and i now want create an organization based on choosen site template by the code. i did that.
but the problem is , when i try to create an organization by the code, the organization details are storing database but the organzation is not displaying in control panel.

if i do the reindex, then the organization is showing in control panel.

for every time reindex is not good approach right?

and if keep below properties in portal-ext.prop file and create an organization, then newly created organization is showing in control panel.

index.on.startup=true
users.search.with.index=false
organizations.search.with.index=false


Is it a sol'n? or is there any other alternative approach?

Thanks,
Thirumal.
thumbnail
Jorge Díaz, modificado 7 Anos atrás.

RE: Search Indexing In Liferay 7.

Liferay Master Postagens: 753 Data de Entrada: 09/01/14 Postagens Recentes
Organizations are searched in index unless you deactive it using organizations.search.with.index=false

So I think your problem is you are not indexing the new organization in your custom code.

In your custom code, after creating the organization from site template, you have to call the indexer.

Another option is an error during indexation process, check log file for errors.

Regards
Thirumal Reddy, modificado 7 Anos atrás.

RE: Search Indexing In Liferay 7.

Regular Member Postagens: 216 Data de Entrada: 03/12/15 Postagens Recentes
Hi Jorge,
i didn't writen any custom logic, just called addOrganization(long userId, long parentOrganizationId, String name, String type,long regionId, long countryId, long statusId, String comments,boolean site, ServiceContext serviceContext)
internally it automatically calls indexing. so no need to call the indexer

and it is happening for only one site template which contains 25 pages with 20mb size.

and for other site templates it's working fine. and after reindexing, 25 pages site template organizarion also showing in control panel.

so at this situation what to do resolve this issue?
is there any problem with size and no. of pages of site template?
Thanks,
Thirumal.
thumbnail
Jorge Díaz, modificado 7 Anos atrás.

RE: Search Indexing In Liferay 7.

Liferay Master Postagens: 753 Data de Entrada: 09/01/14 Postagens Recentes
About:
Thirumal Reddy:
i didn't writen any custom logic, just called addOrganization(long userId, long parentOrganizationId, String name, String type,long regionId, long countryId, long statusId, String comments,boolean site, ServiceContext serviceContext)
internally it automatically calls indexing. so no need to call the indexer

How are you calling addOrganization?

Is there any exception or error in log?
Thirumal Reddy, modificado 7 Anos atrás.

RE: Search Indexing In Liferay 7.

Regular Member Postagens: 216 Data de Entrada: 03/12/15 Postagens Recentes
Hi Jorge,
How are you calling addOrganization?


OrganizationLocalServiceUtil.addOrganization(-,-,-,..);

Is there any exception or error in log?

No there are no errors

To resolve this what i did is,written below logic,

			Indexer<organization> indexer =
			IndexerRegistryUtil.nullSafeGetIndexer(Organization.class);
			indexer.reindex(organization);
</organization>


after applying site template to organization,
	SitesUtil.updateLayoutSetPrototypesLinks(organization.getGroup(), publicLayoutSetPrototypeId,privateLayoutSetPrototypeId,publicLayoutSetPrototypeLinkEnabled,privateLayoutSetPrototypeLinkEnabled);


this time it's working fine,
can i do this thing..?

Thanks,
Thirumal
thumbnail
Jorge Díaz, modificado 7 Anos atrás.

RE: Search Indexing In Liferay 7.

Liferay Master Postagens: 753 Data de Entrada: 09/01/14 Postagens Recentes
Hi Thirumal,

Seems that method public Organization addOrganization(...) only calls indexer in case of having serviceContext == null or serviceContext.isIndexingEnabled() == true
See:
if ((serviceContext == null) || serviceContext.isIndexingEnabled()) {
	Indexer<organization> indexer =
		IndexerRegistryUtil.nullSafeGetIndexer(Organization.class);

	indexer.reindex(organization);
}</organization>
Check the serviceContext parameter.

You can also try activating debug traces for indexing logic (categories with 'search' word)