代码之家  ›  专栏  ›  技术社区  ›  Enrico

使用Azure搜索在特定字段中搜索特定值

  •  0
  • Enrico  · 技术社区  · 6 年前

    我有我的资料 Azure Search . 在我的结构中有很多字段,我必须使用其中两个字段进行筛选或搜索。

    一个是 Type 定义为 Edm.String 另一个是 memberOf 定义为 Collection(Edm.String) .

    类型 具有类似的价值 private:Text , 成员 具有类似的价值 my.com/field/F001 .

    我要应用筛选器:

    filter=Type:'private:Text' AND memberOf:'my.com/field/F001'
    

    结果我收到了所有的记录。我阅读了微软的文档,但找不到解决方案。

    在我的代码里我有

    SearchParameters sp = new SearchParameters()
    {
        SearchMode = SearchMode.Any,
        Skip = currentPage - 1,
        IncludeTotalResultCount = true
    };
    
    if (!string.IsNullOrEmpty(searchQuery))
        sp.Filter = searchQuery;
    
    DocumentSearchResult<VuSearchData> result = 
             await client.Documents.SearchAsync<VuSearchData>(searchText, sp);
    

    谢谢。

    1 回复  |  直到 6 年前
        1
  •  1
  •   Bruce Johnston    6 年前

    here

    Type eq 'private:Text' and memberOf/any(m: m eq 'my.com/field/F001')

    any memberOf

    推荐文章