0

I was trying to do a query search for some data in milvus, however, the return result does not satisfy the condition we offer. For example, I would like to search for a book in a time range and select a university, but milvus is still giving me the wrong results. I am using Milvus Version 2.1.x and working on the jupyter notebook on the server. Below is the function

def filter_search(k:int, start_year: int, end_year: int, selected_univ: str):
    hello_milvus.load()
    temp = "year >= " + str(start_year) + " and year <= " + str(end_year) + " and university == \"" + str(selected_univ)+"\""
#     filter query based on the results of topic_search
    print(temp)
    
    results = hello_milvus.query(
    expr = temp, 
    consistency_level="Strong",
    output_fields = ["doc_id"],
    limit=None
    )
    print(results)
    for x in results: 
        print(x['doc_id'])
        get_doc_info(x['doc_id'], dataset)
        print("-------------------------")

After executing the function with filter_search(15, 2019.0, 2020, "ucb"), I got the results below, most of which are irrelevant to the expression.

year >= 2019.0 and year <= 2020 and university == "ucb"

8004
Found doc :8004 at 182893
id : 184583

title : Molecular Mechanisms by which Salvinorin A Binds to and Activates the κ-Opioid Receptor

URI : http://rave.ohiolink.edu/etdc/view?acc_num=case1207342013

year : 2008.0

university : Case Western Reserve University School of Graduate Studies
...
  • I suggest also return the `year` field, and print it out to check if the problem in in milvus, or just data misalign between milvus and the `dataset`. – Ji Bin Oct 18 '22 at 02:09

0 Answers0