Search multiple indexes in Lucene (sleep search)

Lucene Feautures' official website states that lucene supports "multiple index search with combined results."

Is it possible to do this by searching in sleep mode?

My usecase: Aricle with comments. I want to have two separate indexes: one for articles and one for comments. I want to find the article also in the match in one of the comments. From the user's point of view, I want the search to look like “text,” as well as his comments and a list of articles. (I know that I can implement this by saving all the comments as fields inside the article document, but I want to apply filters to search in the comments.)

Is it even possible if the native Lucene or I / m is completely missing a point?

+3
source share
2 answers

Your whole explanation seems vague. Searching in sleep mode seems appropriate for your use case, provided that you have the proper domain model, which means an article that is somehow related to comments, for example, using the OneToMany association. If there is no connection between the article and the comment, how do you still know which article the Comment belongs to?

The presence of such a domain model will be decided by your use case - the ability to search in articles and comments, but return the list of articles.

, Lucene . , @Indexed , . .

@Indexed , @IndexedEmbedded .

, /.

- Hardy

+3

. , , , . ( , "" "" ), . , .

+2

Source: https://habr.com/ru/post/1712108/


All Articles