mongodb - Full text search form with multiple inputs -


i try create search form has 3 text inputs:

  • item description;
  • model name;
  • ctg name.

user can fill inputs , search through collection has next document structure:

{ "id" : 123, "description" : "ricoh aficio cl-4000 type 245 toner yellow", "pnbrs" : [      "888281",      "k174/g",      "k174g" ], "model" : [      {         "id" : "1625",         "name" : "ricoh aficio cl4000dn"     },  ], "ctg" : [      {         "id" : "1472",         "name" : "ricoh type 245 toner"     } ], "brand" : "ricoh" 

}

also created text index:

    db.products.ensureindex({          description: "text",         "model.name" : "text",          "ctg.name" : "text"     }); 

how organize relevant full text search 3 text inputs , have on top items maximum score?

for example, user want search "model.name":"xxx", how leave in search result items has "xxx" string in "model.name" , exclude have "xxx" in "description" or "ctg.name" fields?


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -