linagora / james-project

Mirror of Apache James Project
Apache License 2.0
72 stars 62 forks source link

[SearchSnippet] Highlight memory implementation #5255

Closed hungphan227 closed 1 month ago

hungphan227 commented 2 months ago

DoD: Integration test

vttranlina commented 2 months ago

For each Message, find text that specified in SearchQuery and add highlight tag around them

In the epic topic Benoit mentioned:

Locate part of their text (exact match) and show 100 chars before and 100 chars after. Ideally find a library for that.

hungphan227 commented 2 months ago

I think we can use java regular expression

vttranlina commented 2 months ago

What do you think about using lucene-highlighter for it? The @quantranhong1999 poc at https://github.com/linagora/james-project/issues/5256

IMO it quiet fine!

// Initialize an in-memory index using ByteBuffersDirectory
        Directory directory = new ByteBuffersDirectory();

Lucene "memory" for SearchSnippet memory implement Lucene "prod" for SearchSnippet Lucene implement

chibenwa commented 2 months ago

What do you think about using lucene-highlighter for it?

...

I LOVE THE IDEA

A LOT

(and I would go further)

How about removing scanning search and replacing it with a memory based Lucene?

Of course we can trigger a mailing list discussion...

Arsnael commented 2 months ago

Use searchHilighter interface instead

vttranlina commented 1 month ago

How about removing scanning search and replacing it with a memory based Lucene?

mailing-list: https://www.mail-archive.com/server-dev@james.apache.org/msg74520.html

vttranlina commented 1 month ago

WIP pr https://github.com/apache/james-project/pull/2429