Skip to content

[Question]: 为什么查询不到数据 #43

@kyle0418

Description

@kyle0418

Your Question

我将一段文本导入到resource中,导入是成功的:

Image

为什么用find方法找不到任何结果,我搜索的Webapp关键字在导入的文本中是大量出现的。

而且我指定了target_uriviking://resources/docs/chunk_OV2-50254,为什么结果中反而会出现viking://agent/instructions目录的结果:

(Test) PS D:\Research\OpenViking> python example.py
Resource added at: viking://resources/docs/chunk_OV2-50254

Wait for semantic processing...
Search results:
  viking://agent/instructions (score: 0.1150)

Context

No response

Code Example (Optional)

import openviking as ov

# Initialize OpenViking client with data directory
client = ov.SyncOpenViking(path="./data")

try:
    # Initialize the client
    client.initialize()

    # Add resource (supports URL, file, or directory)
    # add_result = client.add_resource(
    #     path="https://raw.githubusercontent.com/volcengine/OpenViking/refs/heads/main/README.md"
    # )

    scope = "viking://resources/docs/"

    add_result = client.add_resource(
        "D:\\Research\\OpenViking\\chunk_OV2-50254.txt",
        reason="项目技术文档",
        target=scope
    )

    root_uri = add_result['root_uri']
    print(f"Resource added at: {root_uri}\n")

    # # Wait for semantic processing to complete
    print("Wait for semantic processing...")
    client.wait_processed()

    # Perform semantic search
    results = client.find("Webapp", target_uri=root_uri)
    print("Search results:")
    for r in results.resources:
        print(f"  {r.uri} (score: {r.score:.4f})")

    # Close the client
    client.close()

except Exception as e:
    print(f"Error: {e}")

Related Area

None

Before Asking

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions