优化搜索结果

时间:2015-06-25 10:30:06

标签: xml rest sharepoint

我正在使用SharePoint rest search API。

我要求它给我一些特定的结果。

它目前搜索名为myfield的字段。 myfield是一个多选领域。我正在寻找返回myfield等于a的结果。如果它包含(myfield = a; b; c)并且它仅等于a(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 个答案:

答案 0 :(得分:1)

您是否尝试过使用KQL?好像你可以使用" =" opeartion而不是":"。

":"
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