Message Boards

Read lucene index

Francesco Laquintana, modified 4 Years ago.

Read lucene index

Junior Member Posts: 44 Join Date: 5/16/19 Recent Posts
How to read from lucene index the content of journal article (in a hook)
thumbnail
Olaf Kock, modified 4 Years ago.

RE: Read lucene index

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
Francesco Laquintana:

How to read from lucene index the content of journal article (in a hook)
Does it make a difference where you read it from? i.e. why not read it from the database? You'd get a "Hit" back from the search engine, but not a "JournalArticle".
Francesco Laquintana, modified 4 Years ago.

RE: Read lucene index

Junior Member Posts: 44 Join Date: 5/16/19 Recent Posts
For reason of speed. How to read from lucene index the content of journal article (in a hook)?
thumbnail
Olaf Kock, modified 4 Years ago.

RE: Read lucene index

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
Francesco Laquintana:

For reason of speed. How to read from lucene index the content of journal article (in a hook)?
Those are different beasts, each with its distinct purpose: Search Engines are quick in searching, but they're not required to store everything, especially not all of the formatting if they don't care. But they'll reveal a result set (of Hits, with ids) quicker (based on full text search) than another storage engine. However, the fully formatted content comes from database, based on the id found in the hit you get from the search engine.
So: Search first, then use the search engine's hits to load the article from database. It might already be in the cache, and in that case you won't even go to the database.
Careful not to suffer from preliminary optimization. So far, this sounds like a good case of it.
Francesco Laquintana, modified 4 Years ago.

RE: Read lucene index

Junior Member Posts: 44 Join Date: 5/16/19 Recent Posts
So, if i use liferay search engine, it returns hits. This hits contain only id of  content or all infomation of the content?  If hits contain only id of the content must get I all data of the content from db using Liferay SDK?
thumbnail
Olaf Kock, modified 4 Years ago.

RE: Read lucene index

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
Francesco Laquintana:

So, if i use liferay search engine, it returns hits. This hits contain only id of  content or all infomation of the content?  If hits contain only id of the content must get I all data of the content from db using Liferay SDK?

Correct. And I'd be very surprised if the hits contain everything. There's nothing in Liferay that would create a fully initialized JournalArticle object from a hit.