1 创建是加入metadata属性
2创建 过滤器
3 使用过滤器(检索器内使用 或者如下简单使用)
documents = SimpleDirectoryReader("data").load_data()
documents.metadata['department']="ABC"
#添加元数据 department为ABC
#之后就是节点化
#过滤模块 ExactMatchFilter 和MetadataFilters
#filters过滤,下面创建了ABC部门的过滤器
filtersABC=MetadataFilters(
filters=[ExactMatchFilter(key="department",value="ABC")]
)
实际使用最简单的查询 index对象
xxx=index.as_query_engine(filters=filtersABC)