Last active
September 20, 2022 13:21
-
-
Save jkariscodes/64206a0e43137b2ee7455a36ff95e529 to your computer and use it in GitHub Desktop.
Indexing and searching using marqo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import marqo | |
mq = marqo.Client(url='http://localhost:8882') | |
documents = [ | |
{ | |
"Title": "The Gods Must Be Crazy", | |
"Description": "An African narrative based on a South African native community.", | |
"ISBN": "9781234567897" | |
}, | |
{ | |
"Title": "Enchanted Forest", | |
"Description": "A fiction story of forest that is enchanted.", | |
"ISBN": "9479234567897" | |
}, | |
{ | |
"Title": "Power of Now", | |
"Description": "Stoic and religious inspiational teching.", | |
"ISBN": "9479229063871" | |
} | |
] | |
mq.index('book-index').add_documents(documents) | |
result = mq.index("book-index").search(q="A fiction story of forest that is enchanted.") | |
print(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment