Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ERROR]: pymilvus.exceptions.MilvusException: <MilvusException: (code=1100, message=only IP is the supported metric type for sparse index: invalid parameter[expected=valid index params][actual=invalid index params])> #2956

Open
1 task done
ubairnisar opened this issue Dec 30, 2024 · 1 comment

Comments

@ubairnisar
Copy link

ubairnisar commented Dec 30, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Issue

from pymilvus import MilvusClient, DataType, Function, FunctionType

client = MilvusClient(uri="http://192.168.50.69:19530" , db_name="MonteurAIDevAI")

schema = client.create_schema()
analyzer_params={
    "type": "standard",
    "filter" : ["lowercase"]
}

schema.add_field(field_name="id", datatype=DataType.INT64, is_primary=True, auto_id=True)
schema.add_field(field_name="text", datatype=DataType.VARCHAR, max_length=1000, enable_analyzer=True , analyzer_params=analyzer_params,)
schema.add_field(field_name="sparse", datatype=DataType.SPARSE_FLOAT_VECTOR)


bm25_function = Function(
    name="text_bm25_emb", # Function name
    input_field_names=["text"], # Name of the VARCHAR field containing raw text data
    output_field_names=["sparse"], # Name of the SPARSE_FLOAT_VECTOR field reserved to store generated embeddings
    function_type=FunctionType.BM25,
)

schema.add_function(bm25_function)
index_params = client.prepare_index_params()

index_params.add_index(
    field_name="sparse",
    index_type="SPARSE_INVERTED_INDEX", 
    metric_type="IP"
)

client.create_collection(
    collection_name='table_search', 
    schema=schema, 
    index_params=index_params
)
client.insert('table_search', [
    {'text': 'information retrieval is a field of study.'},
    {'text': 'information retrieval focuses on finding relevant information in large datasets.'},
    {'text': 'data mining and information retrieval overlap in research.'},
])


search_params = {
    'params': {'drop_ratio_search': 0.2},
}

client.search(
    collection_name='table_search', 
    data=['whats the focus of information retrieval?'],
    anns_field='sparse',
    limit=3,
    search_params=search_params
)

I am trying to do full text search using the tutorial here docs, but i am encountering this error.

Suggestion

No response

Anything else?

No response

@Galaxy0505
Copy link

Oh,I also have this problem.There is no option for BM25.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants