0

I am working with azure search and I have been facing a weird issue since few days.

I am azure search nuget package 3.0.4 to query the azure search service, I have one field called filename in my index and one of the document contains this unicode characters in its file name "건국화원".

Now when I do

SearchServiceClient searchServiceClient = new SearchServiceClient("mysearchservice", new SearchCredentials("mykey"));

ISearchIndexClient indexClient = searchServiceClient.Indexes.GetClient("index-myindex");

SearchParameters parameters = new SearchParameters() {
      QueryType = QueryType.Full,
      IncludeTotalResultCount = true
};

parameters.HighlightFields = new[] { "content" };
parameters.HighlightPreTag = "<mytag>";
parameters.HighlightPostTag = "</mytag>";
parameters.Top = 10;
parameters.Skip = 0;

var result = indexClient.Documents.SearchAsync("filename:'*건국화원*'", parameters).Result;

it returns no results. But using QueryType = QueryType.Simple it works

Am I doing something wrong here? What is the issue here?

  • If possible, please trace your request/response through a tool like Fiddler. This will give you the details of what is being sent to the service. – Gaurav Mantri Jun 28 '17 at 06:54
  • @GauravMantri, thanks for replying, I have tried fiddler but I am not able to find the my request in fiddler. I mean I can see bunch of calls to manangement.azure.com but not any of then related to my request. – kartik ghodasara Jun 28 '17 at 07:27
  • What kind of application is this? I would suggest you create a simple console app and try your request there. The request should be for `https://yoursearchservicename.search.windows.net` domain. – Gaurav Mantri Jun 28 '17 at 07:36
  • My application is service fabric app. And I am using nuget package to consume azure search functionality. if I try my query in azure search explorer from azure portal it works (which internally uses azure search api's only) but from nuget package it is not working. So basically this is working **https://mysearch.search.windows.net/indexes/index-apttusdev2/docs?api-version=2016-09-01&search=filename%3A'*%EA%B1%B4%EA%B5%AD%ED%99%94%EC%9B%90*'** but this is not **blobResults = await indexClient.Documents.SearchAsync("filename%3A'*%EA%B1%B4%EA%B5%AD%ED%99%94%EC%9B%90*'");** – kartik ghodasara Jun 28 '17 at 07:44
  • I was able to get the results successfully. Please see the code I used here: https://gist.github.com/gmantri/417b8527d5350f5b2cdd6119f1b2f387. – Gaurav Mantri Jun 28 '17 at 09:12
  • Hi Gaurav, thanks for putting efforts. I just found that it works with QueryType=Simple but not with QueryType.Full. I am not sure why it isn't working with query type full. i had set query type full because I am expecting lucene based queries – kartik ghodasara Jun 28 '17 at 09:18
  • It worked for QueryType.Full as well for me :). It wouldn't hurt if you update your question with complete code that you're using. – Gaurav Mantri Jun 28 '17 at 09:35
  • sure done. question updated. – kartik ghodasara Jun 28 '17 at 11:38
  • 1
    @kartikghodasara . Note that prefix wildcarding is not supported. Try removing the `*`'s from your search term: `indexClient.Documents.SearchAsync("filename:'*건국화원*'", parameters).Result;` Also, which analyzer are you using for the filename field? – Bruce Johnston Jun 28 '17 at 22:30
  • @BruceJohnston Would you mind putting your comment as an answer please? Thanks! – Gaurav Mantri Jun 29 '17 at 03:18
  • @BruceJohnston if I do "filename:'건국화원*'" then also it is not returning any result until and unless I do QueryType.Full. I am not using any analyzer for this field. – kartik ghodasara Jun 29 '17 at 03:31
  • @kartikghodasara Are the single quotes part of the file name? If not, try removing them from the search text. – Bruce Johnston Jul 19 '17 at 18:59

0 Answers0