opengrok icon indicating copy to clipboard operation
opengrok copied to clipboard

Feature/search uhighlighter

Open idodeclare opened this issue 5 years ago • 9 comments

Hello,

Please consider for integration this patch to add HitFormatter to extend OGKUnifiedHighlighter for use by SearchEngine.

There are some known, pending migrations to uhighlight remaining in OpenGrok. Hit generation was one area, and HistoryContext continues to be a legacy highlighter.

@wy193777 requested in #2612 that search results not be HTML-ized. This patch mostly addresses the request by enhancing SearchEngine to return code-matching results for full|defs|refs and to add substring offsets to the Hit results in lieu of the former HTML-emphasis.

hist searches will still return legacy, HTML-fragment results via HistoryContext.

For testing, I uncommented SearchEngineTest.testSearch() but set it to @Ignore. The test is still useful even with its race condition bugs.

Thank you.

(@vladak, I see you're squash-merging again; please may I ask you don't subject my PRs to that.)

idodeclare avatar Mar 25 '19 01:03 idodeclare

Pull Request Test Coverage Report for Build 5465

  • 45 of 193 (23.32%) changed or added relevant lines in 9 files are covered.
  • 7 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.1%) to 75.566%

Changes Missing Coverage Covered Lines Changed/Added Lines %
opengrok-indexer/src/main/java/org/opengrok/indexer/search/Results.java 0 2 0.0%
opengrok-indexer/src/main/java/org/opengrok/indexer/search/Hit.java 8 13 61.54%
opengrok-web/src/main/java/org/opengrok/web/api/v1/controller/SearchController.java 0 7 0.0%
opengrok-indexer/src/main/java/org/opengrok/indexer/search/SearchFormatterBase.java 13 27 48.15%
opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/OGKUnifiedHighlighter.java 1 25 4.0%
opengrok-indexer/src/main/java/org/opengrok/indexer/search/SearchEngine.java 13 41 31.71%
opengrok-indexer/src/main/java/org/opengrok/indexer/search/HitFormatter.java 0 32 0.0%
opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/Context.java 7 43 16.28%
<!-- Total: 45 193
Files with Coverage Reduction New Missed Lines %
opengrok-indexer/src/main/java/org/opengrok/indexer/search/Hit.java 1 85.71%
opengrok-web/src/main/java/org/opengrok/web/api/v1/controller/SearchController.java 1 25.4%
opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/IndexTimestamp.java 2 42.86%
opengrok-indexer/src/main/java/org/opengrok/indexer/search/SearchEngine.java 3 52.02%
<!-- Total: 7
Totals Coverage Status
Change from base Build 5462: -0.1%
Covered Lines: 41358
Relevant Lines: 54731

💛 - Coveralls

coveralls avatar Mar 25 '19 01:03 coveralls

Don't worry about squashing the changesets. I am well aware you craft the csets carefully. In general I squash only csets that are not of value w.r.t. history like small code review induced changes.

vladak avatar Mar 25 '19 09:03 vladak

Rebased with no conflicts

idodeclare avatar Oct 22 '19 04:10 idodeclare

Rebased with just a conflict in a SearchEngineTest.java import due to #2983.

idodeclare avatar Nov 29 '19 22:11 idodeclare

Rebased with just conflicts in copyright text.

idodeclare avatar Mar 22 '20 18:03 idodeclare

@tarzanek , please would you take a look at this one if you get some time?

idodeclare avatar Apr 14 '20 20:04 idodeclare

I just merged https://github.com/oracle/opengrok/pull/3130 , thank you for that which means I broke this

I will try to review and sorry for delays

tarzanek avatar May 05 '20 07:05 tarzanek

@ahornace will you have time to have a quick look at this too?

tarzanek avatar May 05 '20 07:05 tarzanek

Just rebased on master to resolve conflicts from #3130, which had been extracted from this patch.

idodeclare avatar May 05 '20 17:05 idodeclare