2

I am using the Azure index for an index search.

I have created custom SWMLuceneAlongWithCustomHyphenAnalyser analyzer for escaping - (special characters), which looks like below

 "analyzers":[
    {
       "name":"SWMLuceneAlongWithCustomHyphenAnalyser",
       "@odata.type":"#Microsoft.Azure.Search.CustomAnalyzer",
       "tokenizer": "keyword_v2",
       "tokenFilters": [
                        "lowercase"
                       ]
    }
 ]

E.g. for escaping - my index search query is.

&search=lowerSystemID:/.*ryan\-yeti\-win10.*/lowerMachineTag:/.*ryan\-yeti\-win10.*/&$select=lowerProductKey,lowerSystemID,lowerMachineTag&$filter=(lowerSystemID ne null)&$count=true&$top=999&queryType=full&$skip=0

This query responds back with expected results.

But we are running into issues with query value of !@#$%^&*()*^w

It should return back data if it exists else show zero results. Right now it returns all the records. Below is the query after escaping all the special characters. Not sure what am I doing wrong here, or maybe the analyzer is not the correct one:

&search=lowerSystemID:/.*\!\@\#\$\%\^\&\*\(\)\*\^w.*/lowerMachineTag:/.*\!\@\#\$\%\^\&\*\(\)\*\^w.*/&$select=lowerProductKey,lowerSystemID,lowerMachineTag&$filter=(lowerSystemID ne null)&$count=true&$top=999&queryType=full&$skip=0

Any suggestions will help!

Santosh
  • 325
  • 5
  • 19
  • 2
    Could you share the exact query you're using and the documents that it should match? For example, the query you provided is invalid because # is a reserved character and needs to be encoded if you're using GET as explained here: https://learn.microsoft.com/en-us/rest/api/searchservice/lucene-query-syntax-in-azure-search#encoding-unsafe-and-reserved-characters-in-urls. It would help if you could narrow down what character you're not escaping/encoding correctly. – Yahnoosh Jun 27 '18 at 16:30
  • This might be of help for you: https://stackoverflow.com/a/54479351/3407539 – Farrukh Normuradov Feb 01 '19 at 12:17

0 Answers0