opengrok
opengrok copied to clipboard
Feature/search uhighlighter
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.)
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 | |
|---|---|
| Change from base Build 5462: | -0.1% |
| Covered Lines: | 41358 |
| Relevant Lines: | 54731 |
💛 - 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.
Rebased with no conflicts
Rebased with just a conflict in a SearchEngineTest.java import due to #2983.
Rebased with just conflicts in copyright text.
@tarzanek , please would you take a look at this one if you get some time?
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
@ahornace will you have time to have a quick look at this too?
Just rebased on master to resolve conflicts from #3130, which had been extracted from this patch.