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 a JournalArticle after creating it programmatically
David Yari Podio Casares, modified 8 Years ago.
Junior Member
Posts: 36
Join Date: 3/24/11
Recent Posts
Hi,
I have developed some code that creates a new JournalArticle and populates it succesfully with data according to its structure.
I'm using Liferay 7.
To create the Article I use the method
The article is succesfully created, it's state is approved, and I can see all the values correctly if I edit the article with the Liferay interface.
The problem is that I have another portlet which searchs for that kind of articles using :
..., and the new article doesn't appear as a result.
If I re-publish the article using the Liferay interface (without changing anything), then it appears correctly. So, I suspect the new article is not getting indexed.
I tried to add this just after the call to "addArticle(...)" but it doesn't seems to do anything:
Does someone know what I can do to re-index the article just after adding it or updating its contents?
Or at least point me to where is the code Liferay uses to publish and index the articles created with its interface?
Thank you!
I have developed some code that creates a new JournalArticle and populates it succesfully with data according to its structure.
I'm using Liferay 7.
To create the Article I use the method
com.liferay.journal.service.JournalArticleLocalService.addArticle()The article is succesfully created, it's state is approved, and I can see all the values correctly if I edit the article with the Liferay interface.
The problem is that I have another portlet which searchs for that kind of articles using :
Indexer<journalarticle> indexer = IndexerRegistryUtil.getIndexer(JournalArticle.class);
indexer.search(...)
</journalarticle>..., and the new article doesn't appear as a result.
If I re-publish the article using the Liferay interface (without changing anything), then it appears correctly. So, I suspect the new article is not getting indexed.
I tried to add this just after the call to "addArticle(...)" but it doesn't seems to do anything:
Indexer<journalarticle> indexer = IndexerRegistryUtil.getIndexer(JournalArticle.class);
indexer.reindex(article);
</journalarticle>Does someone know what I can do to re-index the article just after adding it or updating its contents?
Or at least point me to where is the code Liferay uses to publish and index the articles created with its interface?
Thank you!
David Yari Podio Casares, modified 8 Years ago.
Junior Member
Posts: 36
Join Date: 3/24/11
Recent Posts
The problem is solved.
I was just re-indexing before adding some categories to the article that were necessary for it to appear in the search.
If I do the re-indexing after adding the categories it works fine.
Sorry to bother you and thank you!
I was just re-indexing before adding some categories to the article that were necessary for it to appear in the search.
If I do the re-indexing after adding the categories it works fine.
Sorry to bother you and thank you!
| Indexer<JournalArticle> indexer = IndexerRegistryUtil.getIndexer(JournalArticle.class); indexer.reindex(article); | |
can we do same as for Documents (with document's content)?
|
Hi Ronak,
Yes, you should be able to do that, it is the same pattern for all Liferay entities.
Regards
Yes, you should be able to do that, it is the same pattern for all Liferay entities.
Regards
Hi Jorge Diaz,
Thanks for Reply and tested but it seems didn't worked and can't search DLFileEntry (File content at all) and need to ReIndex 10,000+ documents
- When tries with using control panel(Control Panel > Server Administration > Resources > "Reindex Search" button)
1. Takes too much time.
2. Stops server at all.
If there is any other solution for ReIndexing Programatically for Uploaded Document.
Thanks In advance
Thanks for Reply and tested but it seems didn't worked and can't search DLFileEntry (File content at all) and need to ReIndex 10,000+ documents
- When tries with using control panel(Control Panel > Server Administration > Resources > "Reindex Search" button)
1. Takes too much time.
2. Stops server at all.
If there is any other solution for ReIndexing Programatically for Uploaded Document.
Thanks In advance
Hi Ronak,
Do you have any kind of error in your log files when you try to reindex from control panel?
If you have problems reindexing, you can also try my Index Checker app, see:
- https://web.liferay.com/marketplace/-/mp/application/70121999
That tool allows you to check which documents are missing and reindex only them.
You can also execute a partial reindex, for example, reindex only one site.
Regards,
Jorge
Do you have any kind of error in your log files when you try to reindex from control panel?
If you have problems reindexing, you can also try my Index Checker app, see:
- https://web.liferay.com/marketplace/-/mp/application/70121999
That tool allows you to check which documents are missing and reindex only them.
You can also execute a partial reindex, for example, reindex only one site.
Regards,
Jorge