-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
I am using parse server with mlab on heroku, I have two table linked 1. Artist 2. Offer
Each offer have an pointer column artist.
I have created a text index, here is the view:
"v": 2,
"key": {
"_fts": "text",
"_ftsx": 1
},
"name": "OfferSearchIndex",
"ns": "heroku_46tdsp6m.Offer",
"weights": {
"artist.firstname": 1,
"artist.lastname": 1,
"category": 1,
"drscription": 1,
"drscription_de": 1,
"drscription_fr": 1,
"drscription_it": 1,
"drscription_ru": 1,
"medium": 1,
"movement": 1,
"title": 1,
"title_de": 1,
"title_fr": 1,
"title_it": 1,
"title_ru": 1
},
"default_language": "english",
"language_override": "language",
"textIndexVersion": 3
}
Now I have below cloud query to search offer:
var offerQuery = new Parse.Query("Offer");
offerQuery.include('artist');
offerQuery.fullText('artist.firstname', request.params.wildcard);
return offerQuery.find({
useMasterKey: true
}, function(error) {
console.log('#getOfferForAdmin error 1', error);
return error;
})
But this query not searching offer based on artist firstname and lastname. It is returning only those records that match offer title, offer description.
I used below command to create a index:
db.Offer.createIndex( { "artist.firstname": "text", "artist.lastname": "text", title: "text", title_de: "text", title_fr: "text", title_it: "text", title_ru: "text", drscription: "text", drscription_de: "text", drscription_fr: "text", drscription_it: "text", drscription_ru: "text", category: "text", medium: "text", movement: "text" }, {name:"OfferSearchIndex"}, { default_language:"none" } )