Search results returns empty hits

%3CLINGO-SUB%20id%3D%22%5C%26quot%3Blingo-sub-3173070%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3ESearch%20results%20returns%20empty%20hits%26lt%3B%5C%2Flingo-sub%26gt%3B%3CLINGO-BODY%20id%3D%22%5C%26quot%3Blingo-body-3173070%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3E%3CP%3EHello%2C%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EI'm%20using%20microsoft%20graph%20to%20query%20document%20libraries%20on%20my%20SharePoint%20Online%20site.%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EI'm%20querying%20managed%20property.%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EWhen%20I%20tested%20it%20on%20Graph%20explorer%20-%20I%20got%20result%20with%20hits%20that%20contained%20the%20actual%20file%20that%20has%20this%20managed%20property.%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EWhen%20I%20tried%20to%20develop%20it%20-%20I%20got%20result%20that%20matched%20the%20graph%20explorer%20-%20but%20the%20hit%20section%20was%20empty%20%5B%5B%7B%7D%2C%20%7B%7D%5D%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EHere's%20the%20data%20I'm%20using%20in%20Graph%20explorer%3A%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3E%7B%26lt%3B%5C%2FSPAN%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%22requests%22%26lt%3B%5C%2FSPAN%26gt%3B%3CSPAN%3E%3A%20%5B%26lt%3B%5C%2FSPAN%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%7B%26lt%3B%5C%2FSPAN%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22entityTypes%22%26lt%3B%5C%2FSPAN%26gt%3B%3CSPAN%3E%3A%20%5B%26lt%3B%5C%2FSPAN%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22driveItem%22%26lt%3B%5C%2FSPAN%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%5D%2C%26lt%3B%5C%2FSPAN%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22query%22%26lt%3B%5C%2FSPAN%26gt%3B%3CSPAN%3E%3A%20%7B%26lt%3B%5C%2FSPAN%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%22queryString%22%26lt%3B%5C%2FSPAN%26gt%3B%3CSPAN%3E%3A%20%26lt%3B%5C%2FSPAN%26gt%3B%3CSPAN%3E%22RefinableString01%3A'555555'%22%26lt%3B%5C%2FSPAN%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%7D%26lt%3B%5C%2FSPAN%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%7D%26lt%3B%5C%2FSPAN%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%3CSPAN%3E%26nbsp%3B%5D%26lt%3B%5C%2FSPAN%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%3CSPAN%3E%7D%26lt%3B%5C%2FSPAN%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%26nbsp%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%3CSPAN%3Eand%20here's%20the%20code%20I'm%20using%3A%26lt%3B%5C%2FSPAN%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%3CSPAN%3EGraphServiceClient%20client%20%3D%20GetAuthenticatedGraphClient(userName%2C%20userPassword)%3B%3CBR%20%2F%3Evar%20searchRequest%20%3D%20new%3CBR%20%2F%3E%7B%3CBR%20%2F%3Erequests%20%3D%20new%5B%5D%3CBR%20%2F%3E%7B%3CBR%20%2F%3Enew%3CBR%20%2F%3E%7B%3CBR%20%2F%3EentityTypes%20%3D%20new%5B%5D%20%7B%22microsoft.graph.driveItem%22%7D%2C%3CBR%20%2F%3Equery%20%3D%20new%3CBR%20%2F%3E%7B%3CBR%20%2F%3Equery_string%20%3D%20new%3CBR%20%2F%3E%7B%3CBR%20%2F%3Equery%20%3D%20%22RefinableString01%3A'555555%22%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3B%3CBR%20%2F%3E%2F%2Fconstruct%20a%20request%3CBR%20%2F%3E%3CBR%20%2F%3Evar%20message%20%3D%20new%20HttpRequestMessage(HttpMethod.Post%2C%20%22%3CA%20href%3D%22%5C%26quot%3Bhttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fsearch%2Fquery%5C%26quot%3B%22%20target%3D%22%5C%26quot%3B_blank%5C%26quot%3B%22%20rel%3D%22%5C%26quot%3Bnoopener%20nofollow%20noopener%20noreferrer%22%20noreferrer%3D%22%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fsearch%2Fquery%26lt%3B%5C%2FA%26gt%3B%22)%3B%3CBR%20%2F%3Evar%20jsonPayload%20%3D%20client.HttpProvider.Serializer.SerializeObject(searchRequest)%3B%3CBR%20%2F%3Emessage.Content%20%3D%20new%20StringContent(jsonPayload%2C%20Encoding.UTF8%2C%20%22application%2Fjson%22)%3B%3CBR%20%2F%3Eawait%20client.AuthenticationProvider.AuthenticateRequestAsync(message)%3B%3CBR%20%2F%3Evar%20response%20%3D%20await%20client.HttpProvider.SendAsync(message)%3B%3CBR%20%2F%3E%2F%2Fprocess%20response%3CBR%20%2F%3Evar%20content%20%3D%20await%20response.Content.ReadAsStringAsync()%3B%3CBR%20%2F%3Evar%20result%20%3D%20JObject.Parse(content)%3B%26lt%3B%5C%2FSPAN%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%26nbsp%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%26nbsp%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%3CSPAN%3EThis%20is%20the%20result%20I'm%20getting%3A%26lt%3B%5C%2FSPAN%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%26nbsp%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%3CSPAN%3E%7B%22%40odata.context%22%3A%22%3CA%20href%3D%22%5C%26quot%3Bhttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2F%24metadata%23Collection(microsoft.graph.searchResponse%5C%26quot%3B%22%20target%3D%22%5C%26quot%3B_blank%5C%26quot%3B%22%20rel%3D%22%5C%26quot%3Bnoopener%20nofollow%20noopener%20noreferrer%22%20noreferrer%3D%22%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2F%24metadata%23Collection(microsoft.graph.searchResponse%26lt%3B%5C%2FA%26gt%3B)%22%2C%22value%22%3A%5B%7B%22searchTerms%22%3A%5B%5D%2C%22hitsContainers%22%3A%5B%7B%22total%22%3A2%2C%22moreResultsAvailable%22%3Afalse%2C%22hits%22%3A%5B%7B%7D%5D%7D%5D%7D%5D%7D%26lt%3B%5C%2FSPAN%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%26nbsp%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3E%3CSPAN%3EDoes%20anybody%20have%20any%20idea%20why%20this%20is%20hapenning%3F%26nbsp%3B%26lt%3B%5C%2FSPAN%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3EThanks%2C%26lt%3B%5C%2FDIV%26gt%3B%3CDIV%3EBarak%26lt%3B%5C%2FDIV%26gt%3B%26lt%3B%5C%2FDIV%26gt%3B%26lt%3B%5C%2Flingo-body%26gt%3B%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FA%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FA%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3C%2FLINGO-SUB%3E
Occasional Visitor

Hello,

 

I'm using microsoft graph to query document libraries on my SharePoint Online site.

I'm querying managed property.

When I tested it on Graph explorer - I got result with hits that contained the actual file that has this managed property.

When I tried to develop it - I got result that matched the graph explorer - but the hit section was empty [[{}, {}]

 

Here's the data I'm using in Graph explorer:

 

{
   "requests": [
   {
     "entityTypes": [
         "driveItem"
     ],
     "query": {
         "queryString": "RefinableString01:'555555'"
    }
  }
 ]
}
 
and here's the code I'm using:
GraphServiceClient client = GetAuthenticatedGraphClient(userName, userPassword);
var searchRequest = new
{
requests = new[]
{
new
{
entityTypes = new[] {"microsoft.graph.driveItem"},
query = new
{
query_string = new
{
query = "RefinableString01:'555555"
}
}

}
}
};
//construct a request

var message = new HttpRequestMessage(HttpMethod.Post, "https://graph.microsoft.com/v1.0/search/query");
var jsonPayload = client.HttpProvider.Serializer.SerializeObject(searchRequest);
message.Content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");
await client.AuthenticationProvider.AuthenticateRequestAsync(message);
var response = await client.HttpProvider.SendAsync(message);
//process response
var content = await response.Content.ReadAsStringAsync();
var result = JObject.Parse(content);
 
 
This is the result I'm getting:
 
{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.searchResponse)","value":[{"searchTerms":[],"hitsContainers":[{"total":2,"moreResultsAvailable":false,"hits":[{}]}]}]}
 
Does anybody have any idea why this is hapenning? 
Thanks,
Barak
0 Replies