Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -55,13 +55,13 @@ def search(query):
|
|
55 |
xc = index.query(
|
56 |
vector=dense,
|
57 |
sparse_vector=sparse,
|
58 |
-
top_k=
|
59 |
include_metadata=True
|
60 |
)
|
61 |
match_ids = [match['id'].split('-')[0] for match in xc['matches']]
|
62 |
# Query the existing DataFrame based on 'id'
|
63 |
filtered_df = df[df['_id'].isin(match_ids)]
|
64 |
-
attributes_to_extract = ['
|
65 |
extracted_data = filtered_df[attributes_to_extract]
|
66 |
result_json = extracted_data.to_json(orient='records')
|
67 |
return result_json
|
|
|
55 |
xc = index.query(
|
56 |
vector=dense,
|
57 |
sparse_vector=sparse,
|
58 |
+
top_k=5, # how many results to return
|
59 |
include_metadata=True
|
60 |
)
|
61 |
match_ids = [match['id'].split('-')[0] for match in xc['matches']]
|
62 |
# Query the existing DataFrame based on 'id'
|
63 |
filtered_df = df[df['_id'].isin(match_ids)]
|
64 |
+
attributes_to_extract = ['_id', 'postedBy.accountName', 'images', 'title', 'location', 'price']
|
65 |
extracted_data = filtered_df[attributes_to_extract]
|
66 |
result_json = extracted_data.to_json(orient='records')
|
67 |
return result_json
|