Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Indexing Entity without storing to DB
Yes, of course you can. The framework does not care where you get the data (that you display) from.
I am looking for solution for DXP 7.0
I have used liferay
sample guestbook entry entity for POC.
I want to save entity to
search index but not store in database.
So in the
EntrylocalServiceImpl ,I have removed the line
entryPersistence.update(entry);
I have replace it with following code:
Indexer<Entry> indexer =
IndexerRegistryUtil.nullSafeGetIndexer(Entry.class);
indexer.reindex(entry);
but it doesnt trigger index and the doReindex method of the
EntryIndexer class is not getting invoked.
Any alternative to
achieve this?
Nishith, did you test the sample? Is search and indexing working before you change anything?
@Russel
Yes. If I add the
entryPersistence.update(entry);
The entry gets indexed. Once I remove that line. It does not index.
Okay, your indexing code looks fine to me, and search and indexing is working as expected using the usual mechanism. I think one easy thing you should try is removing the @Indexable annotation from the method. I don't know all that this does, but it's probably kicking off an indexing action (delete or reindex) whenever a persistence call is made. I don't know why it would get in the way of your manual indexing code, but it might be a feature of the annotation (sanitize any other indexing calls that might interfere, or something). I'm on a limb with these guesses, but removing teh annotation is probably worth a shot, if you haven't already.
@Russel
I have already tried removing the annotation. It
DOES NOT help.
Now that I come back to this Nishith, I'm going to conclude that you cannot do this on Liferay 7.0. I believe it was Liferay 7.2 that introduced the idea of applications using their own index as their primary storage. But you would not be doing this in a SB app.
Some of the DXP apps that use it are Synonym Sets and Result Rankings.
This ticket for documentation has some code snipopets (they look like they're for 7.2).
Powered by Liferay™