Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SearchSnippet] Implement Lucene SearchHighlighter #5256

Closed
quantranhong1999 opened this issue Aug 28, 2024 · 2 comments
Closed

[SearchSnippet] Implement Lucene SearchHighlighter #5256

quantranhong1999 opened this issue Aug 28, 2024 · 2 comments
Assignees
Labels
Milestone

Comments

@quantranhong1999
Copy link
Member

Why

As we plan to really use Lucene as a search option, we need to back JMAP SearchSnippet extension by implementing a Lucene Search Highlight APIs.

How

  • Add Maven dependency in apache-james-mailbox-lucene:
  <dependency>
      <groupId>org.apache.lucene</groupId>
      <artifactId>lucene-highlighter</artifactId>
      <version>${lucene.version}</version>
  </dependency>
  • Implement LuceneSearchHighlighter in apache-james-mailbox-lucene.
class LuceneSearchHighlighter implements SearchHighlighter {
  Publisher<SearchSnippet> highlightSearch(MultimailboxesSearchQuery expression, MailboxSession session, long limit) {
    ...
  }
}

Using the Lucene highlight APIs: https://lucene.apache.org/core/9_0_0/highlighter/org/apache/lucene/search/highlight/package-summary.html
From what I see, with Lucene, highlight works on search result - which mean we need to search again.

POC: quantranhong1999@a8ddbe5

DoD

Pass contract tests

@vttranlina
Copy link
Member

We can reuse class LuceneMemorySearchHighlighter (In pr Lucene memory impl ) for Lucene FS impl.
The fact LuceneMemorySearchHighlighter only use lucene highlight api, it's nothing special just for memory.

  • Consider extract LuceneMemorySearchHighLightTest to contract class -> and new one Lucene FS impl test

@vttranlina
Copy link
Member

Pr: apache#2438

@Arsnael Arsnael closed this as completed Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants