Confused about creating text indexes in mgo

19 views
Skip to first unread message

Attila SATAN

unread,
Jan 4, 2018, 7:52:38 AM1/4/18
to mgo-users
I'm trying to create text indexes with weights but I couldn't figure out how to do by reading API docs.

How can I build indexes as below in mgo.

db.products.createIndex({
 
"primaryCategoryIndexes": "text",
 
"secondaryCategoryIndexes": "text",
 
"brandIndex": "text",
 
"primaryTitleIndexes": "text",
 
"secondaryTitleIndexes": "text",
 
"indexCycleId": "text"
 
}, {
   
"weights": {
     
"primaryCategoryIndexes":10,
     
"secondaryCategoryIndexes": 5,
     
"brandIndex": 5,
     
"primaryTitleIndexes": 5,
     
"secondaryTitleIndexes": 5,
     
"indexCycleId": 5
 
})

Reply all
Reply to author
Forward
0 new messages