Search for question mark (?) in Azure Search - azure

I have a filed in an Azure Search index that contains URL's. I'm and trying to search the field for any URL's that contain a question mark (?). When I use just the question mark for the search text, no results are returned. Is it possible to search for just the question mark?

Did you read the following documentations?
Wildcard search
Simple query
Both states that you must excape special characters with backslash. When you do wildcard search
You cannot use a * or ? symbol as the first character of a search. No
text analysis is performed on wildcard search queries.
I think this will not apply if you escape them.

Related

Azure cognitive search unsafe/reserved characters

I would like to ask if anyone has a problem with searching for unsafe/reserved characters? More specificaly if the string starts with, or contains only special characters, in this case #. I know it is edge case, but it seems like weird behavior. Search string is encoded in query, so it will get to the search, I know the name containing only these characters is edge case, but i am curious if it is intended behaviour or i am doing something wrong
this is the part of url containing search query ?searchMode=all&search=%23%23%23

Need regex to search string containing '+'

i need to search a string containing + like 'abc+xyz' or 'test+1234',
currently I am using 'abc.*' but not able to search 'abc+xyz'
Basic regex docs will explain that you can reference a special character by escaping it. The following pattern matches on abc+xyz.
abc\+xyz
A tutorial explaining the above.
for finding regex which contains special character like above situation, just add "\" (back slash)

Jira Query for hyphenated words

There are many words which can have a hyphen, a space or be a full word. For example:
Wifi
Wi-fi
Wi fi
I am attempting to figure out if there is some kind of wildcard search that will allow me to capture all three as a result when I do a search in Jira. Using * search (for example, searching "wi*fi" returns either Wi-fi or Wi fi but wont return the full version Wifi
Is there a simple way I can get all three variants of Wifi to return using a simple wildcard search?
From reading the Performing Text Searches documentation it says:
JIRA does NOT support leading wildcards or Wildcards in phrases currently
However it later says:
To perform a single character wildcard search use the "?" symbol.
To perform a multiple character wildcard search use the "*" symbol.
So as to why your search is not working I am unsure.
However they do recommend installing the ScriptRunner plugin which beefs up the JQL and allows you to use a regex:
issueFunction in issueFieldMatch("project = JRA", "description", "ABC\\d{4}")
Which may be of interest to you.
The simplest option is to combine multiple searches here:
(fieldname ~ "wi*fi" or fieldname ~ "wifi") will return the desired results.

How to search on GitHub to get exact string matches, including special characters

I can search exact matches from Google by using quotes like "system <<-".
How can I do the same thing for GitHub?
You couldn't (before 2022). The official GitHub searching rules:
Due to the complexity of searching code, there are a few restrictions
on how searches are performed:
Only the default branch is considered. In most cases, this will be the master branch.
Only files smaller than 384 KB are searchable.
Only repositories with fewer than 500,000 files are searchable.
You must always include at least one search term when searching source code. For example, searching for language:go is not valid, while amazing language:go is.
At most, search results can show two fragments from the same file, but there may be more results within the file.
You can't use the following wildcard characters as part of your search query:
. , : ; / \ ` ' " = * ! ? # $ & + ^ | ~ < > ( ) { } [ ]
The search will simply ignore these symbols.
Update: GitHub supports literal strings now, but you can also try some more powerful ways below.
Try Sourcegraph
For complex search with regex support try Sourcegraph.
Clone and use git-grep:
git support searching in sources with git-grep command. Just clone a repository and use the command in the folder:
git grep "text-to-search"
Alternatives:
I recommend you to try ripgrep tool, it's fast and simple. Works like git-grep but looks nicer:
rg "text-to-search"
And you can use the standard grep to search any text in files:
grep -r "text-to-search" /repository
You can use Google directly.
How about this?
"your_string_to_search" site::https://github.com
"your_string_to_search" site::https://gist.github.com
Today I was trying to look for an exact match of filter class in files named logback.xml in any repo on Github. And I came up with the following query which did the job.
"filter class" in:file filename:logback.xml
To enable exact matches with quotes you need to follow your search with the "in:file" modifier. The matches are not quite exact, the word "class" will have to follow the word "filter", but it seems there can be 0 or more spaces or symbols characters between the two words.
Open a repository on GitHub, for example microsoft/fluentui
Press dot "." to open VS Code web interface
Go to search in the left panel
Enable indexing via the prompt below search bar
Huraaay! 🎉 exact search works
UPDATE: As of November 2022, the solution above only works if you are signed in on GitHub.
You can enable preview of new search experience on this link:
https://github.com/features/code-search-code-view/signup.
Then do exact match just by using quotes: "system <<-"
You can: Since Dec. 2021, your search, done from cs.github.com, can include special characters
Improving GitHub code search
(from Pavel Avgustinov)
Search for an exact string, with support for substring matches and special characters, or use regular expressions (enclosed in / separators).
So "system <<-" should work, on that new search site.
Adding to #mrgloom's answer, if you're looking for code in a specific programming language in Github using Google you could do something like this in Google's search bar:
state the specific string you're looking for using the "intext:" search operator
add the programming language you're interested in, using the "ext:" operator (i.e. "ext:py", "ext:R", "ext:rb", etc.)
search in all public repos in Github using the "site:" operator mrgloom mentioned.
Example:
intext:"%% 2 == 0" ext:R site:github.com
As of 11/2/2021, this is possible by putting quotation marks around your search string
Without quotes:
With quotes:
While it's now possible to search exact strings, the functionality doesn't yet support searching on special characters. Example:
If your package is in debian, you can use their code search, which supports regular expressions: https://codesearch.debian.net/
If your search term is a filename or other substring which contains punctuation characters, a partial workaround to get GitHub's code search to return instances of that substring is to (1) replace the punctuation characters in your search term with spaces, and (2) enclose the search term in quotes.
For example, instead of using the search term:
repo:my_repo my_image_asset_1.svg
Try:
repo:my_repo "my image asset 1 svg"
This might not be a perfect solution in all cases; I imagine it might also match filenames like my-image-asset-1.svg. But depending on your use case, it might be "good enough"?
If you quickly want to search inside a specific repo, try that:
Press . while viewing the repo to open it inside a browser-based VS Code window
Enter your search term into the menu on the left
Enable indexing

Use % sign in search query?

How to search for percentage (%) sing through Google, Twitter Search etc.?
The search engines use it as a special character of just completely ignore it. I've tried to search for an HTML code of %, which is %, but it did not work either.
You can not do what you want with Google as it works today.
You cannot search for special characters in Google Web Search nor Gmail.
Google doesn't recognize special search characters like square brackets, parentheses, currency symbols, the ampersand, the pound sign, and asterisks.
These are the only symbols that return any results.
& (ampersand)
_ (underscore)
Check out the link below, an interesting article, it is 2005, but the same applies today, you still cannot search for special chars:
link text
AFAIK, there is no special entity for percent char, but You could provide its decimal code %

Resources