Bug 831056

Summary: RFE: [Translation Memory] Option for highlight only the search terms
Product: [Retired] Zanata Reporter: Ding-Yi Chen <dchen>
Component: Component-UIAssignee: Patrick Huang <pahuang>
Status: CLOSED CURRENTRELEASE QA Contact: Ding-Yi Chen <dchen>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.6-SNAPSHOTCC: mkim, pahuang, sflaniga, zanata-bugs
Target Milestone: ---   
Target Release: 2.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 2.1-SNAPSHOT (20121206-1113) Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-26 04:06:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Screenshot that demonstrates the issue
none
Current diff can not cope with fuzzy search none

Description Ding-Yi Chen 2012-06-12 06:06:40 UTC
Description of problem:
User story: As a casual translator I want my search terms highlighted in Suggestions from the Translation Memory.

Current view show the diff between the search terms and translation memory. 

However this view:
1. Does not provide an easy view where the search terms located in translation memory suggestions.

2. Does not match the usual behaviour of "search result", which only highlights exact search terms.

3. Does not look good for long source messages and translation memory suggestion. Scrolling is needed to see whole sentences. See attachment for how it looks like for long strings.


Version-Release number of selected component (if applicable):
Zanata version 1.6.1-SNAPSHOT (20120608-0019). 

How reproducible:
Always

Steps to Reproduce:
1. Ensure the translation memory has something to show. (Translated messages exists)
2. Visit any document
3. Search on any string that the translation memory is likly to contain, such as "Enable" or "Ok"
  
Actual results:
Only diff view is presented.

Expected results:
An option is available for highlight only the search terms.

Comment 1 Ding-Yi Chen 2012-06-12 06:08:24 UTC
Created attachment 591099 [details]
Screenshot that demonstrates the issue

Comment 2 Runa Bhattacharjee 2012-07-30 13:07:00 UTC
The attachment does not seem to have a search item in the search box. However the error can be replicated.

Requesting for technical evaluation.

Comment 3 Sean Flanigan 2012-07-31 02:17:30 UTC
The screenshot is demonstrating the automatic TM search you get when clicking on any text flow.

I think we need to provide an alternative mode for the highlighter, so that non-matching/missing text is hidden, matching text is highlighted, and added text is shown plain.  It should just require a bit of CSS class tweaking, and a checkbox to turn it on and off.

Comment 4 Patrick Huang 2012-11-30 03:33:46 UTC
highlighting search term only make sense when there is 100% match. If it's not, i.e. fuzzy search, how do we want to highlight? Picking out matching words?

Comment 5 Patrick Huang 2012-11-30 03:35:52 UTC
Ok got the meaning. Basically we just use diff result.

Comment 6 Patrick Huang 2012-11-30 04:48:27 UTC
Created attachment 654812 [details]
Current diff can not cope with fuzzy search

See attachment. 
Search term: 
Fedora is an open

Item number three: 
Visit the Fedora community Wiki at <ulink url="http://fedoraproject.org/wiki/" />.

Entire string is showing as missing(diff delete) and added(diff insert). There is no diff equal. Back to the question I asked in Comment 4

Comment 7 Sean Flanigan 2012-11-30 07:32:14 UTC
I don't think we want to make a big thing of this RFE.  Just highlight the matching bits, according to diffmatchpatch, hide the missing bits, and show the added bits unhighlighted.  Some edge cases may not highlight well, but they may not be worth worrying about.

If we really wanted to, we could tell diffmatchpatch not to do "semantic cleanup" (see org.zanata.webtrans.client.ui.Highlighting.diff(String, String)), but this will probably make the highlighting uglier in most cases.

I suppose it could be useful to turn off semantic cleanup only in the cases where it makes a complete mess (eg one big deletion, and one big insertion).  But it's probably not worth the effort.

Or you could try turning off semantic cleanup whenever term highlighting is active, and we could see if we like the results.

Comment 8 Patrick Huang 2012-12-02 23:53:22 UTC
Turning semantic cleanup off when doing match term highlight. Semantic cleanup is on in normal diff mode.

committed into master:
https://github.com/zanata/zanata/commit/4b1d06485090490c8bd297f1d67ffbd8db5601ad

Comment 9 Patrick Huang 2012-12-04 06:29:17 UTC
According to Hedda adding a user option that can be persisted is helpful

Comment 10 Patrick Huang 2012-12-04 07:00:21 UTC
committed again into master:
https://github.com/zanata/zanata/commit/83974ebe0a822173bd6d464df691a08a74e7ce09

Comment 11 Ding-Yi Chen 2012-12-07 05:55:38 UTC
VERIFIED with Zanata version 2.1-SNAPSHOT (20121206-1113)