2015-06-25 61 views
0

我正在使用SharePoint休息搜索API。細化搜索結果

我要求它返回一組特定的結果。

它目前正在搜索名爲myfield的字段。 myfield是一個多選題字段。我正在尋找返回myfield等於的結果。如果它包含(myfield = a; b; c)並且它只等於(myfield = a),則返回結果。

但是,我希望它返回結果,它只等於a。所以如果它不等於a就返回結果,但也包括其他結果。

我目前使用的查詢是:

http://testurl.com/Sites/mysite/_api/search/query?querytext='(Country:FRA)(ContentType:mycontenttype)(myfield:a)'&rowlimit=50&SelectProperties='Title,LastModifiedTime,myfield'&trimduplicates=false&sortlist='LastModifiedTime:descending' 

我試圖選擇細化過濾器無濟於事:

http://testurl.com/Sites/mysite/_api/search/query?querytext='(Country:FRA)(ContentType:mycontenttype)(myfield:a)'&rowlimit=50&SelectProperties='Title,LastModifiedTime,myfield'&trimduplicates=false&sortlist='LastModifiedTime:descending'&refinementfilters='myfield:equals("AMER")' 

回答

1

您是否嘗試過使用KQL?看起來好像你可以使用「=」操作而不是「:」。

":" 
Returns results where the value specified in the property restriction is equal to the property value that is stored in the Property Store database, or matches individual terms in the property value that is stored in the full-text index. 


"=" 
Returns search results where the property value is equal to the value specified in the property restriction. 
Note 
We do not recommend combining the = operator together with asterisk (*) when you do exact matching. 

https://msdn.microsoft.com/en-us/library/office/ee558911.aspx