Guru Mongo e Giava. Il nostro team ha deciso di utilizzare l'API di ricerca full text, introdotta di recente in MongoDB. Tuttavia, abbiamo riscontrato alcune difficoltà nell'esecuzione del comando utilizzando il driver Java MongoDB.Come eseguire il comando di ricerca full text in MongoDB con Java Driver?
Qui è il mio codice che sto usando:
public BasicDBObject find(String search) {
BasicDBObject searchCommand = new BasicDBObject();
searchCommand.put("text", new BasicDBObject().append("search", search));
CommandResult commandResult = db.command(searchCommand);
}
Questo è ciò che ottengo quando stampo
System.out.println(commandResult)
{ "serverUsed" : "/127.0.0.1:27017" , "errmsg" : "exception: wrong type for field (text) 3 != 2" , "code" : 13111 , "ok" : 0.0 }
Grazie, penso che questo sia il comando :) – Adelin
come posso aggiungere il parametro di query in db.command? – rajeshpanwar