howdoi icon indicating copy to clipboard operation
howdoi copied to clipboard

Add method to detect symbols like +, /, etc. in the queries

Open SudhakarKuma opened this issue 1 year ago • 7 comments

Description

Add some method to detect symbols in the query. Let us say, we want to know how to use + sign to concatenate two strings. To know this, one can pass queries, like

  • howdoi use + concat strings
  • howdoi use plus concat strings
  • etc.

At present, the outputs for these two are as shown below:

> howdoi use + concat strings
+
> howdoi use plus concat strings
public class Concat {
    String cat(String a, String b) {
        a += b;
        return a;
    }
}

Additional Comments (if any)

Similarly, the results vary significantly for queries like howdoi a divide b, howdoi a / b, etc.

Have you read the Contributing Guidelines on Pull Requests on mkdocs?

Yes

SudhakarKuma avatar May 26 '23 15:05 SudhakarKuma

I can take this up and submit a PR, if the developers feel that this issue has some merit. @gleitz

SudhakarKuma avatar May 30 '23 15:05 SudhakarKuma

This is interesting. It looks like the search engine gives different results.

~ » howdoi use + concat strings --link
https://stackoverflow.com/questions/30154541/how-do-i-concatenate-strings
~ » howdoi use plus concat strings --link
https://stackoverflow.com/questions/47605/string-concatenation-concat-vs-operator

How are you thinking of solving the issue?

gleitz avatar May 30 '23 15:05 gleitz

Hi @gleitz , Thank you for your response! From the results, it seems that use plus concat strings fetches better results as compared to use + concat strings. So, I was thinking whether we should replace the symbols by their suitable meanings (in words) at the back end and then, we run the query.

I would be happy to know your take on this.

SudhakarKuma avatar May 30 '23 15:05 SudhakarKuma

This would be the first time we're rewriting queries. I don't know if the impact will be worth the risk of "tampering" with the request.

gleitz avatar May 30 '23 16:05 gleitz

Oh, I see! Any other suggestions by which we can detect symbols in the queries?

SudhakarKuma avatar May 30 '23 16:05 SudhakarKuma

Try playing around with the Google query and see if you can use quotes or something like that to handle it?

gleitz avatar May 30 '23 16:05 gleitz

Sure, I will give it a try and share the findings here.

SudhakarKuma avatar May 30 '23 16:05 SudhakarKuma