Azure cognitive search unsafe/reserved characters - azure

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

Related

Vim regex to search and highlight words with hyphens in it

I have a JSON file, and it has double quotes around keys and values. I want to remove double quotes from the keys(I know it would be invalid JSON, but still trying something). to do so I used this regex
:%s/"\(\w*\)":/\1:
But now the issue is that some of the keys have hyphen(maybe multiple) in them. The aforementioned solution won't work anymore. It only selects the keys that don't have hyphens. I tried to find a solution for this, but couldn't find anything concrete. Would be very helpful if you could help a little.

What is the "^I" (carat capital-i) character in Python?

I pasted some text from a text editor (Atom) into IPython and it was rendered as I saw it on the editor, but some special characters appeared, too. These are light-blue carat capital-i's (^I). They seem to represent indentations. Indeed, when I search through the string by index slices, they show tab characters (\t).
What is this symbol's name? I tried to find it using unicodedata.name('^I'), but it returned a ValueError: no such name error.
If anyone knows where I can find a table of characters by their string representation that will save me a lot of time. The unicode.org source cited in the SO post above does not allow that. Something like this, but with ^I.

Exact strings do not match in Jupyter Notebook

What did I want to do?
I was reading file names with various organ names in their file endings and there are many such files using glob.glob('filename/**/blabla')
Later, I tried to match a particular string if present inside the filename using IN operator. like
"ADRENALGLAND(LEFT).NRRD" IN "blabla/blabla/blabla/blablabla_ADRENALGLAND(LEFT).NRRD"
It worked for other filenames with the same ending whereas it did not work for a few.
To debug, I was trying to match if visually the same filename endings from two files are the same programmatically, but they are not!!! why?
For debug, I tried to match string to string. Like below. But I saw a peculiar thing while comparing strings in python.
Can anyone tell me what is the difference here?
**
'ADRENALGLAND(LEFT).NRRD' == 'АDRENALGLAND(LEFT).NRRD' => False !!!
**
I bring it down to this part where 'A's do not match whereas others matched properly.
As mentioned by #canbax, I checked the underline ASCII value for both the character and found that they are different. One gave 65 (Normal ASCII Code for English Alphabet 'A') whereas the other one gave 1040.
You can use ord() to get the ASCII int value of a character.
Although the int values are different, visually they look the same, which might be an issue from the jupyter notebook side.
Final Solution: Replaced the fancy A with the normal A in the file.

Search for question mark (?) in Azure Search

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.

String compare : Comparing 'zürich' and 'zurich' results in -1

I'm trying to do a string compare for 'zürich' and 'zurich'
Something like this:
int compareResult = String.Compare(zürich, zurich);
So what happens is that it returns -1, which causes a problem as I'm using compareResult for an if-else later.
Can someone point me to the right direction on why does this happen. Do I need to clean this first before comparing "zürich" or is it something else?
you use the method just fine, but the strings are actually different.
so, in order to make this comparison in your way, you need:
decide if this you want every comparison that uses ü and other "special" latin characters to look at them as they were the simple characters.
i.e. in every time you see ü, it will treat it as a "u"
if so, you need to do pre-processing of both the strings, and replace all special chars with regular ones.
there is another thread about it here:
How can I remove accents on a string?
hope it helped.

Resources