【问题标题】:Is Weaviate compatible with fielded search?Weaviate 与现场搜索兼容吗?
【发布时间】:2022-02-03 00:47:21
【问题描述】:

我正在处理一个包含多个字段的数据集。我需要同时对多个字段进行搜索。 Weaviate 与现场搜索兼容吗?如果是这种情况,如果您能指导我如何组合多个搜索查询,我将不胜感激。

这是一个方案:

  schema = {
        "classes": [{
                "class": "Post",
                "vectorizer": "none", # explicitly tell Weaviate not to vectorize anything, we are providing the vectors ourselves through our BERT model
                "properties": [{
                    "name":"pmid",
                    "dataType": ["int"],
                },
                {
                    "name":"title",
                    "dataType": ["text"],
                },
                {
                     "name": "body",
                    "dataType": ["text"],
                }, 
                {
                    "name":"summary",
                    "dataType": ["text"],
                }]
        }]
    }

我想同时搜索正文和摘要。例如,它标识在正文和摘要中包含“HIV”一词的出版物。

【问题讨论】:

  • 你可能有更多的上下文吗?你能分享你当前的架构吗?
  • 当然,我用更多上下文编辑了这个问题。非常感谢!

标签: graphql weaviate


【解决方案1】:

这当然是可能的。查看 Weaviate 文档中的 where-filter :-)

基于您的示例架构的示例。

{
  Get {
    Post(
      nearVector: {
        vector: [0, 0, 0] # <== your custom vector
      }
      where: { # <== searching for a pmid > 12
        operator: GreaterThan
        valueInt: 12
        path: ["pmid"]
      }
    ) {
      pmid
      title
    }
  }
}

【讨论】:

  • 感谢您的回复。据我所知, where 是标量搜索。我需要对两个字段的搜索进行矢量化。
  • @SaeedehKhoshgoftar ooo 但这很有趣。您能否分享一个伪代码示例来说明您希望如何做到这一点?
  • 找到 'pmid',其中 'title' 是 nearVector 到 'cancer' 并且 'body' 是 nearVector 到 'lung cancer'
  • 啊哈,明白了!在这种情况下,您需要创建 2 个类,一个将 pmid 向量化,另一个将 title 向量化。
  • 您能否提供一个简单的例子来说明该方案和矢量化搜索如何工作?我不知道如何在 Weaviate 中将两个矢量化搜索组合在一起。
猜你喜欢
  • 2021-04-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-08-09
  • 2018-08-27
  • 2011-12-31
  • 2020-03-19
  • 2018-05-18
相关资源
最近更新 更多