Skip to content

get_entry_matching_value does not handle ignore-case properly. #648

@haiqi96

Description

@haiqi96

Bughttps://github.com/y-scope/clp/issues/new/choose

Our current implementation of get_entry_matching_value() assumes only 1 value in the dictionary will match the input string.

This assumption is correct when match is case_sensitive (since the the input value won't contain wildcard).
However, when ignore_case is switched on, it's possible more than one dictioanry variables will match the input value. (for example, all of "VAR1", "var1" and "vAr1") matches input "var1", but only one of them will be returned.
As a result, CLP won't return matching messages with the other variables.

I believe the proper fix to this issue is to ether:

  1. update the return type of the method, so it returns a vector of entry. For case-sensitive case, the vector will always contain only one entry (or 0 if no matches). For ignore-case, the vector could have more than one elements.
  2. Create two different methods, one for case-senstive match, one for non-case sensitive match so they can have their dedicated interface.

CLP version

329edf6

Environment

unrelated to OS version.

Reproduction steps

  1. Compress the attached log.
  2. run clg search with ./cmake-build-release/clg -i output/ "My custom log two var1 num"

test.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions