superduper
superduper copied to clipboard
[BUG]: OperationFailure: $listSearchIndexes is not allowed or the syntax is incorrect
Contact Details [Optional]
System Information
OperationFailure: $listSearchIndexes is not allowed or the syntax is incorrect, see the Atlas documentation for more information, full error: {'ok': 0, 'errmsg': '$listSearchIndexes is not allowed or the syntax is incorrect, see the Atlas documentation for more information', 'code': 8000, 'codeName': 'AtlasError'}
What happened?
Running below code database - mongodb + atlas
from superduperdb.backends.mongodb import Collection
from superduperdb import Document as D
from IPython.display import *
# Define the query for the search
# query = 'Code snippet how to create a `VectorIndex` with a torchvision model'
query = 'can you explain vector-indexes with `superduperdb`?'
# Execute a search using SuperDuperDB to find documents containing the specified query
result = db.execute(
collection
.like(D({'txt': query}), vector_index='my-index', n=5)
.find()
)
# Display a horizontal rule to separate results
display(Markdown('---'))
# Display each document's 'txt' field and separate them with a horizontal rule
for r in result:
display(Markdown(r['txt']))
display(r['link'])
display(Markdown('---'))
It's not creating atlas search index
Steps to reproduce
...
Relevant log output
No response
@makkarss929 did you set up the index with db.add(VectorIndex(...))
?
Please provide information about your system.
system : Mac m1 pro 14 inch, 16 GB RAM python : 3.11
# Import the Listener class from the superduperdb module
from superduperdb import Listener
# Create a Listener instance with the specified model, key, and selection criteria
listener = Listener(
model=model, # The model to be used for listening
key='txt', # The key field in the documents to be processed by the model
select=collection.find() # The selection criteria for the documents
)
# Import the VectorIndex class from the superduperdb module
from superduperdb import VectorIndex
# Add a VectorIndex to the SuperDuperDB database with the specified identifier and indexing listener
_ = db.add(
VectorIndex(
identifier='my-index', # Unique identifier for the VectorIndex
indexing_listener=listener # Listener to be used for indexing documents
)
)