In the course of #2253237: Add proper classes for indexed items and search results, I have revamped the highlighting processor to use extra data on the result set object for passing the highlighted field data instead of overwriting the field values directly. View should be updated to (optionally) use this data when displaying fields of search results. (Doing the same when rendering whole entities/result objects would probably be a lot more difficult.)
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 2278433-9--views_highlighted_fields.patch | 37.88 KB | drunken monkey |
Comments
Comment #1
drunken monkeyComment #2
drunken monkeyI finally have an implementation that looks like it might be working, plus some test coverage. Haven't actually tested it yet, though, since I'm on my laptop without an installation running. (Could probably also use an integration test, too.)
Probably the largest unknown: Whether this correctly bypasses Views sanitization for the highlighted field values (which, of course, contain HTML).
Anyways, please test/review!
Since I also noticed that we actually specified two ways to add the highlighted fields data, only one of which makes sense (and our Highlighting processor was actually using the other one), we should probably also add a change record for this.
Oh, and the tests build on those for #2911734: Passing processor-generated field values from search results to Views is broken – that's what the interdiff is for.
Comment #4
drunken monkeyComment #5
borisson_The code flows very clearly and I really like how it looks. Not sure about the part where we merge both arrays but looking at the comments you're not very confident about that either. No idea how to improve it though.
Nits:
I don't think we need to say "if available" in both the title and description, just in the description is enough I think.
/s/fiale//?
Comment #7
drunken monkeyAS always, thanks a lot for your review!
Yeah, that part is pure mindfuck. I'm pretty sure it works as it should, though, and I don't think we can do without it either, so nothing for it. I hope at least the comments help understand why it's there and what it does.
I agree, thanks.
Comment #9
drunken monkeyOK, I now tested this and, as feared, Views escaped our highlighting HTML. This should be fixed with this revision, which also fixes the tests and provides a new browser test for this functionality (making sure all components play together correctly).
Also: here's the change record.
Comment #10
drunken monkeyAnyone want to test/review? Otherwise I'll just commit it.
Comment #11
borisson_I've reviewed the interdiffs and those look solid. Great work @drunken monkey!
Comment #13
drunken monkeyGreat to hear, thanks a lot for reviewing!
Committed. (And even remembered to publish the release note!)