Forum Discussion

ntlam0099's avatar
ntlam0099
Copper Contributor
Feb 16, 2024

Query returns incorrect result when using clause Steps - Contain Words - "#"

My test cases are using hash tag (#) in steps for query, for example "#login #search". I created a query as below and expected it return only test cases have steps contain "#SearchABC". However it return the ones with no hash either.

My Query:

The below "Not Match Test Case" does not have "#" in steps so it should not be return.

Is it an issue? If no, is there anyway to query exactly a word contains "#"?

  • Seems might occurred by:

     

    • Special Character Handling: The # symbol may not be treated as part of the word in your query syntax. Many query systems treat certain special characters like # as delimiters or ignore them unless specifically escaped.
    • Partial Matching: If the query engine performs partial matching or tokenization, it might return results containing the word without # because it's interpreting the query loosely.

    Would suggest:


    1. Escape the # Symbol:

    • Try escaping the # symbol in your query. For example, use \#SearchABC instead of #SearchABC if your query language supports escape sequences.
    • Some systems may require double quotes, like "#SearchABC", to treat it as an exact match.

    2. Use Exact Matching:

    • Check if your query language supports exact phrase matching or a specific operator to enforce it. For instance, wrapping the term in brackets or quotes might work: ["#SearchABC"].

    3. Modify Query Logic:

    • Use advanced filters if available in your query engine. For instance, you can try explicitly searching for fields where the # appears.

Resources