Menu

#968 Segment keys cannot be searched, even when "in Comment" is checked.

5.2
open
nobody
search (6)
5
2019-12-10
2019-12-10
No

When a segment has a key that appears in the Comment area (like the key of a property in a .properties file), this segment cannot be found using the key. This occurs regardless even if the checkbox In Comments is checked in the Search dialog.

Discussion

  • Aaron Madlon-Kay

    There are two concepts of "comment" that are not in sync:

    1. Segment info parsed from the source file, accessible from SourceTextEntry.getComment()
    2. The content shown in the Comments pane, which is not #1 but rather a handful of things determined in CommentsTextArea.ENTRY_COMMENT_PROVIDER

    The searcher only looks at #1, not #2.

     
  • Briac Pilpré

    Briac Pilpré - 2019-12-10

    You are correct, the ENTRY_COMMENT_PROVIDER add the Id, file path, source translation and comment to the panel Area.
    I think it would make sense to append the segment Id to the comment during searching -- I'm not sure the path and translation are useful.

    Here's a proposed patch for this issue, it should be good and not incur too much performance penalties (or do you prefer I make a Pull request on Github?)

     
  • Aaron Madlon-Kay

    The Comments pane is weirdly overloaded to show non-comment metadata in addition to actual comments. That's a historical problem caused by a lack of a better place to show metadata (now we have the Segment Properties pane, but that's relatively recent). But let's agree that user expectations are that "anything in the Comments pane is a comment and should be searchable".

    The searcher currently looks at SourceTextEntry.getComment(), but it's pretty hacky to search against a \n-concatenated string of property values. The search should be done against each value separately to avoid false positives.

    Thus I would prefer a solution that added a SourceTextEntry.searchableMetadata() method that returned a list or array of property values that should be searchable. The contents should probably be the values in props plus what is exposed by CommentsTextArea.ENTRY_COMMENT_PROVIDER. Searcher.checkEntry() should accept a list or array instead of the current comment string, and match against each entry.

     

Log in to post a comment.

MongoDB Logo MongoDB