Docs 菜单
Docs 主页
/
Atlas
/ /

如何执行混合搜索

您可以将MongoDB Vector Search 和MongoDB Search 查询组合成混合搜索,以获得统一结果。

本教程演示如何对 sample_mflix.embedded_movies 集合运行混合搜索,其中包含有关电影的详细信息。具体来说,本教程将指导您完成以下步骤:

  1. plot_embedding_voyage_3_large字段上创建MongoDB Vector Search索引。该字段包含表示电影情节摘要的向量嵌入。

  2. sample_mflix.embedded_movies集合上创建MongoDB Search索引。

  3. 使用以下技术运行查询以合并 $vectorSearch 查询和 $search 查询的结果:

    • 语义提升

    • 倒数秩融合

混合搜索是针对相同查询条件的不同搜索方法(如全文搜索和语义搜索)的聚合。虽然全文搜索对于查询词的精确匹配很有效,但语义搜索还提供了一个额外好处,即使文档不包含精确的查询词,也能识别语义相似的文档。这确保了同义匹配和上下文相似的匹配项也包含在两种搜索方法的组合结果中。

相反,如果数据集中有专有名词或特定关键词的词元,这些词元在数据集中使用的上下文相同,您不希望在培训嵌入模型时考虑这些词元,则向量搜索可能会受益于与全文搜索相结合。

您还可以为每个查询的每种搜索方法设立权重。根据全文或语义搜索结果是否与查询最相关且最合适,您可以增加每个查询的搜索方法的权重。

您可以应用以下技术来实现混合搜索:

技术

语义提升

倒数排名融合

用途

通过提升与向量搜索匹配的文档来提高全文搜索结果的准确性。在检索非常大的结果集时很有用。

通过计算结果中文档的倒数排名,将不同搜索方法的结果合并到单个排名结果设立。

排序方法

  • 检索 $vectorSearch$search 结果。

  • 使用每个文档在各自结果集中的排名来合并两组结果。

评分方法

通过加权向量搜索搜索分数来提高与向量搜索结果匹配的文档的全文结果分数。

使用以下公式计算分数:

1.0/{document position in the results + constant value}

然后,对于每种搜索方法应用不同的权重 (w) 以赋予该搜索方法更高的重要性。对于每个文档,将权重乘以文档的排名倒数即可计算出加权排名倒数。

weighted_reciprocal_rank = w x reciprocal_rank

搜索功能

  • 支持分面以将数据群组。

  • 支持使用 searchAftersearchBefore 对结果进行分页。

支持在后续聚合阶段(例如 $group)中进一步处理结果。

输出

单个结果设立,其中包含以下文档: $search

包含来自两种搜索方法的文档的单个结果设立。

在开始之前,您必须具备以下条件:

  • MongoDB版本为 v8.0 或更高版本的Atlas 集群。

    注意

    确保您的Atlas 集群有足够的内存来存储MongoDB Search 和MongoDB Vector Search 索引并运行高性能查询。

  • sample_mflix 数据加载到Atlas 集群。

  • mongosh 对Atlas 集群运行查询:

  • Project Data Access Admin 访问权限用于创建MongoDB Vector Search 和MongoDB Search 索引的项目。

本部分演示如何在sample_mflix.embedded_moviescollection中的字段上创建以下索引:

  • plot_embedding_voyage_3_large字段上的MongoDB Vector Search索引,用于针对该字段运行向量查询。

  • title字段上的MongoDB Search索引,用于对该字段运行全文搜索。

1

要学习;了解更多信息,请参阅通过mongosh连接到集群。

2
use sample_mflix
switched to db sample_mflix
3

运行以下命令。查询集合时,此索引定义将 plot_embedding_voyage_3_large字段作为MongoDB Vector Search字段进行索引。

1db.embedded_movies.createSearchIndex(
2 "hybrid-vector-search",
3 "vectorSearch",
4 {
5 "fields": [
6 {
7 "type": "vector",
8 "path": "plot_embedding_voyage_3_large",
9 "numDimensions": 2048,
10 "similarity": "dotProduct"
11 }
12 ]
13 }
14);
4

以下索引定义自动为集合中的所有动态可索引字段编制索引。

1db.embedded_movies.createSearchIndex(
2 "hybrid-full-text-search",
3 "search",
4 {
5 "mappings": {
6 "dynamic": true
7 }
8 }
9);

本部分演示如何分别使用sample_mflix.embedded_movies plot_embedding_voyage_3_largeplot$vectorSearch$search 管道阶段查询 集合中 和 字段中 星球大战 的数据。该查询通过使用相同文档的 分数来提高全文分数,从而增强$search $vectorSearch查询的相关性。

1
  1. 创建一个名为 query-embeddings.js 的文件。

    touch query-embeddings.js
  2. 将以下嵌入复制并粘贴到该文件中。

    STAR_WARS_EMBEDDING = [-0.025189938,0.014741838,-0.013024342,-0.0197512,0.011235285,0.004651551,0.043509893,0.003112961,0.013310592,-0.033348043,0.037212405,-0.021039322,-0.026048684,0.012809656,0.029483676,0.003578116,-0.044654887,0.032632418,0.014312465,-0.058967352,0.025333062,-0.055246111,0.02189807,-0.017604331,-0.002880384,0.045227386,0.004794675,0.017604331,0.023186192,-0.054673612,-0.011306847,-0.012523406,-0.012380281,0.002540462,0.015958399,-0.042364895,-0.001467028,-0.020180576,-0.058108605,-0.035065539,0.010090288,-0.033348043,0.058394853,-0.013883091,0.002048471,-0.020753073,-0.029769925,0.031916797,-0.014741838,-0.040933646,-0.004096943,0.020753073,-0.002540462,0.028052431,-0.02404494,0.006547953,-0.003578116,0.003757022,0.019178702,-0.037784904,-0.02833868,0.01753277,0.029769925,0.017747456,-0.031344298,0.022899942,0.006333265,0.010376536,-0.024474313,-0.012094032,-0.004651551,0.007764512,0.017962143,0.013811528,0.037212405,-0.03148742,0.000666424,0.024474313,-0.021325571,0.041219898,0.011235285,0.046658635,0.019035578,0.020753073,0.010662786,-0.001726441,-0.012738093,-0.027193682,-0.014598713,-0.013167467,0.013596841,0.001932183,-0.010304974,-0.007478263,0.005689205,0.002987727,0.005724986,0.002325775,0.002415228,-0.003828584,-0.029340552,-0.017318081,-0.070417322,0.003810694,-0.013453716,-0.001628043,-0.027909305,0.014026215,0.009589351,0.004902019,0.028768053,-0.005259831,-0.010448099,0.025189938,0.038357403,0.048662379,0.039788652,0.010448099,0.001574371,0.020323699,0.005510299,0.026907433,0.043223642,-0.001153942,-0.010233412,0.048376128,-0.056104861,0.006691077,0.015672149,-0.015028087,0.036210533,-0.009231539,0.010519661,0.022899942,0.025762435,-0.009052633,-0.0301993,0.032203045,-0.00522405,0.029626802,-0.02433119,-0.025619311,0.016674021,0.02404494,-0.009589351,-0.026334934,-0.04436864,-0.014455589,0.02619181,0.017604331,0.02189807,-0.007728731,-0.021611821,-0.03363429,0.008480135,-0.027479932,0.025046812,-0.006047016,0.020753073,0.01016185,-0.034063663,0.029483676,-0.019035578,0.041506145,0.013453716,-0.009159978,0.007549825,0.025189938,0.005152487,-0.009446226,-0.009016853,0.021325571,0.030771798,-0.046944883,0.001314958,0.021182448,0.047231134,-0.007048889,-0.030771798,-0.025905561,-0.000612752,-0.023186192,0.011378409,0.035065539,0.007979199,0.023901815,-0.004973582,0.005188268,-0.046944883,0.009374664,0.047231134,0.058967352,0.043509893,0.011449971,0.017174957,-0.024188064,-0.025476186,-0.02833868,0.033061791,0.015314337,-0.018749328,0.013382155,0.007048889,0.005975454,0.005295612,-0.013310592,-0.022756819,-0.012523406,-0.03363429,-0.014527151,0.011449971,0.01202247,0.044941138,-0.012594969,0.002862493,0.000572499,0.030628674,-0.0098756,0.020466823,0.059539851,-0.00370335,0.007335138,0.023901815,0.023758691,-0.005903892,0.003918037,0.013310592,0.010090288,-0.012809656,-0.010376536,-0.01109216,-0.008086543,0.012809656,-0.019894326,0.012738093,0.056391109,0.029340552,-0.04436864,-0.001619098,0.042364895,-0.027623056,0.011593096,-0.031916797,-0.0301993,0.032203045,-0.003757022,0.017174957,0.033491168,0.003900147,0.002325775,0.006726858,0.020180576,0.017389644,0.009088415,0.018319955,-0.003631788,0.00586811,-0.006691077,-0.014240902,-0.009052633,0.031630546,0.04436864,-0.022899942,-0.003327648,-0.006691077,0.013310592,-0.035924286,-0.008158104,-0.005116706,-0.040647399,0.002397338,0.014455589,-0.030342424,0.028624929,-0.031773672,0.043509893,-0.001833785,-0.025619311,0.032775544,-0.046944883,0.013739966,-0.030485548,0.018319955,0.016745584,-0.020323699,-0.015815273,-0.020896198,-0.015171212,0.026334934,0.035638034,0.008873728,0.003291867,-0.02647806,0.003649678,0.003613897,0.009804038,-0.013525278,0.005367174,0.007657168,-0.017103394,-0.015815273,-0.000398065,0.013310592,0.014240902,0.003935928,0.001735386,-0.018606203,0.008265448,-0.068127327,0.012165595,-0.007836075,0.02189807,-0.000983982,0.019178702,-0.009589351,-0.013739966,-0.007800293,0.040361151,0.027623056,-0.002540462,-0.03663991,0.011163722,-0.016316209,-0.006333265,-0.010877473,-0.023329318,-0.021468697,0.013596841,0.032059919,0.007442481,0.02433119,-0.003613897,-0.013596841,0.010448099,0.010877473,-0.0098756,0.033920541,-0.006691077,-0.039502401,-0.010877473,-0.016960271,0.014097777,-0.008122323,0.007478263,0.010018725,-0.030485548,-0.011020597,0.000317558,0.00461577,0.020466823,0.070703574,-0.024617439,0.002111088,-0.024617439,-0.004204286,-0.048662379,-0.006834202,0.027766181,-0.002504681,0.025189938,0.033920541,-0.02833868,-0.000773768,-0.03578116,0.015958399,0.006369046,0.033204917,-0.006762639,0.02003745,-0.020180576,0.015886836,-0.015385899,-0.029340552,-0.009446226,0.015529023,-0.010376536,-0.012881218,-0.000715623,0.014312465,-0.029197427,-0.000684315,0.000360048,0.015815273,-0.027050557,0.006655296,0.018892452,-0.021182448,0.031201173,0.014240902,-0.022756819,0.004365302,-0.020609949,0.008515916,-0.016244646,0.001162888,0.000084421,0.003273976,-0.017819017,0.000576971,0.020753073,-0.004794675,0.018105267,-0.013095905,-0.028052431,0.004114834,0.02833868,-0.027193682,-0.010877473,-0.002576244,0.011879345,-0.017819017,0.006726858,-0.021754947,-0.031773672,-0.013382155,0.024903689,0.013167467,0.000033964,0.034063663,0.022613693,-0.038357403,-0.010018725,-0.017174957,-0.004418973,0.02189807,-0.003166633,-0.009589351,0.009303101,-0.036496785,-0.005760767,-0.006583733,-0.003596007,0.014026215,-0.003828584,-0.02833868,-0.020896198,0.001449137,0.039502401,0.012881218,0.025476186,0.000961619,-0.025762435,0.002808821,0.034922414,0.004687332,-0.046658635,0.030914923,-0.036067411,0.008659041,-0.004025381,-0.0301993,-0.026048684,0.024760563,0.036496785,-0.029913051,0.015672149,0.007764512,0.01509965,0.010304974,-0.004490536,-0.007585606,-0.019464951,0.016602458,-0.007048889,-0.005510299,0.011163722,0.013739966,-0.034636162,0.020609949,-0.004418973,0.034636162,0.040933646,0.031773672,0.023758691,0.031344298,-0.006798421,0.026048684,-0.011521534,0.020753073,0.014384027,0.026334934,-0.034206789,-0.036067411,0.014598713,0.023758691,-0.039216153,0.003363429,0.002880384,-0.006726858,-0.000916892,-0.001395465,-0.009660914,0.032059919,0.008086543,0.029054303,-0.011593096,0.065551087,0.031058047,-0.041219898,-0.014097777,-0.017103394,0.016244646,-0.028911177,0.044654887,-0.030771798,0.024760563,0.02833868,0.018248392,0.026907433,-0.002227377,0.034063663,0.000167724,0.021039322,-0.018892452,0.012738093,-0.001395465,0.005760767,-0.024760563,-0.002683587,0.000230341,-0.0197512,0.009088415,-0.00400749,-0.026764309,-0.012881218,0.016101522,-0.009303101,0.015529023,-0.016817145,0.014312465,-0.030914923,-0.018463079,0.020323699,-0.023472441,-0.023758691,-0.005009362,0.018176829,0.012738093,0.009374664,-0.031916797,0.016387772,0.027479932,0.015529023,-0.021325571,0.020323699,-0.025476186,0.008515916,-0.039788652,-0.007979199,-0.009947163,-0.006869983,0.004758894,0.022613693,-0.013668403,-0.015171212,0.035351787,-0.022327444,0.019178702,0.000404774,-0.003524444,-0.012094032,0.023901815,-0.0400749,-0.004579989,0.00245101,0.013024342,0.015958399,0.009517789,0.034779288,0.021468697,0.00062617,0.007728731,-0.028195554,0.0301993,-0.002504681,0.008909509,0.004651551,-0.007013108,0.03148742,0.019608077,0.002540462,0.043509893,-0.006190141,0.024903689,0.010519661,0.018319955,0.010519661,0.009660914,0.000966091,-0.004454754,0.000299667,0.007907636,-0.018463079,0.004758894,-0.001851675,-0.002415228,0.010233412,-0.024617439,-0.030771798,0.018749328,0.003023508,0.005474518,-0.011521534,-0.008551697,0.007979199,0.03363429,0.000275068,0.007800293,0.0039896,0.00522405,-0.035924286,-0.01416934,0.02619181,-0.025476186,-0.033777416,0.021325571,-0.02218432,0.001833785,0.027766181,-0.006118578,0.032059919,0.038929902,0.003613897,0.031344298,-0.002737259,0.057536107,0.009732476,0.020753073,0.005402955,-0.047803629,-0.040933646,0.009052633,-0.030485548,0.018319955,0.025046812,-0.002361557,0.045513637,0.008766385,-0.031058047,0.014312465,0.002737259,-0.004186396,0.032059919,0.024617439,-0.012666531,0.006798421,0.02619181,-0.012523406,0.009947163,0.005617642,0.039216153,0.008766385,0.009517789,0.042651143,-0.012881218,0.007263576,-0.000514354,0.016817145,-0.048948627,0.018176829,0.034922414,0.005331393,0.000391356,-0.017604331,0.026048684,-0.011807784,0.017461207,0.012809656,0.029483676,-0.017174957,0.023472441,0.005188268,0.007585606,-0.034922414,0.069558576,0.023472441,-0.010304974,0.020180576,0.025046812,0.016459335,0.000317558,-0.018606203,0.066696085,0.011664659,0.025762435,-0.016888708,0.015314337,-0.009231539,0.016459335,-0.021325571,0.009303101,0.000840857,-0.014455589,0.00170855,0.014741838,-0.004168505,-0.009088415,-0.0074067,-0.004472645,0.002665696,0.023615567,0.038929902,-0.016960271,-0.027193682,0.03663991,-0.016530896,0.003256086,0.015171212,0.036926158,0.02433119,0.047231134,-0.049234878,0.009947163,-0.01109216,-0.014097777,-0.007585606,0.00338132,-0.008086543,0.018176829,-0.014527151,-0.000205742,-0.041219898,0.012666531,0.046086136,0.004025381,-0.0074067,0.033348043,-0.020896198,-0.000514354,0.033491168,0.004257958,0.02404494,-0.008372792,-0.021754947,0.037784904,0.013453716,0.013024342,-0.026334934,0.023758691,0.012094032,0.006297485,0.045227386,0.021039322,-0.020323699,0.005975454,0.008802165,0.00370335,0.006941545,-0.029340552,-0.008551697,-0.004454754,0.003488663,0.010662786,0.00801498,0.010090288,0.015600586,0.018105267,-0.020180576,-0.00307718,0.031630546,0.000644061,0.011950907,-0.023472441,0.01509965,-0.035924286,0.016459335,-0.027766181,-0.014598713,-0.021611821,-0.013310592,-0.021039322,-0.02189807,0.018606203,-0.007979199,0.018176829,0.022041194,-0.002916165,0.009088415,-0.00522405,-0.018176829,-0.031916797,-0.017318081,-0.025476186,-0.014527151,-0.017675893,-0.026621183,0.000362284,0.02619181,0.016101522,-0.013310592,0.021325571,0.027909305,0.016316209,0.006011235,0.008551697,0.030914923,-0.070703574,0.004794675,-0.019321827,-0.011163722,-0.014598713,-0.0197512,-0.005438737,-0.025189938,-0.037212405,0.004168505,-0.021754947,0.018033706,0.035065539,0.022756819,0.005581861,-0.007764512,-0.003005618,-0.003524444,0.006655296,-0.00170855,-0.046086136,-0.009374664,0.001744332,0.030056175,0.016674021,0.014312465,0.029054303,-0.009052633,0.005832329,-0.029197427,-0.004723113,0.032489292,0.022899942,-0.044941138,0.014026215,-0.007227794,-0.035494912,0.001261286,0.079004802,0.008122323,0.022041194,0.016602458,0.046658635,-0.016888708,-0.006547953,-0.016316209,0.002021636,-0.016745584,0.003792803,0.005116706,-0.037784904,-0.028481804,-0.014670276,-0.005259831,0.018892452,0.001252341,-0.068699829,-0.021611821,-0.015242774,-0.027050557,-0.032059919,0.026048684,-0.014240902,-0.007013108,0.014598713,-0.005474518,-0.007192013,-0.016817145,0.00400749,0.010519661,0.007657168,0.005295612,0.009124196,0.024474313,-0.019894326,-0.044941138,-0.022756819,-0.022327444,-0.041792396,0.027479932,-0.013668403,-0.036210533,0.001225505,0.009947163,-0.044654887,-0.02003745,0.031344298,-0.004186396,-0.009517789,0.000720096,-0.023901815,0.000670897,0.022899942,0.006619515,0.006512171,0.022327444,0.021468697,0.021611821,0.039216153,-0.019608077,0.028052431,-0.020466823,-0.0197512,0.004454754,0.026048684,-0.024617439,-0.000333212,0.002200541,-0.002629915,0.021611821,0.009374664,0.00894529,-0.057822354,-0.009660914,-0.002844602,0.020323699,0.000603807,0.018033706,-0.027050557,-0.004186396,-0.019608077,-0.021754947,0.009732476,0.01602996,-0.016960271,-0.001520699,-0.023615567,0.004383192,0.000925838,0.023043068,0.032775544,0.006404828,-0.010304974,0.019321827,0.017604331,-0.01230872,0.007657168,0.005402955,-0.03148742,-0.000550135,-0.002111088,-0.029626802,0.01323903,-0.033777416,0.006655296,0.035065539,-0.003256086,0.000907947,0.004025381,0.011020597,-0.04808988,0.02619181,0.015171212,0.023758691,0.014741838,-0.001359684,-0.041506145,-0.009088415,-0.012738093,0.000176669,0.033777416,0.024188064,-0.002307885,0.023901815,0.00034663,-0.024474313,-0.031773672,-0.023758691,-0.024474313,-0.011163722,0.000447265,0.005080925,-0.00123445,0.006297485,-0.031058047,-0.012738093,-0.003059289,-0.026907433,-0.015672149,-0.005760767,0.023043068,0.023043068,-0.015028087,0.017747456,0.013883091,-0.011807784,0.038357403,-0.016817145,0.014884963,0.017389644,-0.000599334,0.016602458,0.008086543,-0.039502401,0.050379876,-0.024474313,0.035351787,-0.023758691,0.002039526,0.004061162,-0.012165595,-0.020180576,0.001636988,-0.013883091,0.017389644,0.006225922,-0.03578116,-0.016817145,-0.001332848,-0.005617642,-0.008730603,-0.039216153,0.02433119,0.028052431,0.02833868,0.039502401,0.010233412,-0.006869983,0.021468697,0.002039526,-0.0197512,0.020753073,0.027050557,0.009517789,0.011449971,0.038929902,0.008873728,0.009374664,0.007871855,-0.006082797,-0.007156232,-0.014670276,-0.000447265,0.046944883,-0.015242774,-0.019894326,0.008158104,0.016173085,-0.018463079,0.034922414,-0.005009362,-0.000092248,0.005760767,0.006190141,-0.022613693,0.034206789,0.012523406,0.000992927,0.038071156,-0.048376128,-0.017747456,0.014384027,0.000751404,0.015314337,-0.010519661,0.058681104,0.013954652,0.022899942,-0.003757022,0.01416934,-0.000469628,-0.008337011,-0.001153942,0.02189807,-0.024760563,0.01416934,-0.012738093,-0.025046812,0.030771798,-0.046658635,-0.002137924,0.053242367,0.010090288,-0.046086136,0.016316209,-0.005295612,0.023043068,-0.023043068,0.010233412,-0.018319955,-0.017389644,0.030485548,0.009660914,0.017174957,0.050379876,-0.010304974,0.017819017,-0.000364521,0.011163722,0.001753277,0.010448099,0.013095905,0.008372792,-0.01109216,0.036926158,-0.015672149,-0.014598713,0.008981071,-0.011879345,-0.036926158,-0.01789058,-0.008694822,-0.028911177,-0.017103394,-0.028768053,-0.030914923,0.001033181,0.00431163,-0.024474313,-0.031058047,0.010018725,0.00647639,-0.027336806,0.025046812,0.003148742,-0.010018725,0.03663991,0.033348043,-0.001162888,-0.01016185,0.010376536,0.010519661,0.019178702,0.016101522,0.007943418,-0.013739966,-0.013525278,-0.027193682,0.006655296,0.027050557,-0.017389644,-0.027479932,0.041792396,0.045513637,-0.014741838,0.012451844,0.018319955,-0.00153859,0.010519661,0.017962143,-0.012594969,0.018606203,0.023472441,-0.034063663,-0.004061162,0.015600586,0.019178702,0.002361557,-0.025619311,-0.00586811,-0.02003745,0.013739966,0.017675893,-0.025189938,-0.002415228,0.001547535,0.019608077,0.039502401,-0.00184273,0.025189938,0.00277304,0.020323699,0.007227794,0.012165595,-0.00370335,0.02433119,-0.00586811,0.016459335,0.034206789,0.001051072,-0.010519661,-0.004096943,0.00153859,0.01574371,0.01230872,-0.007692949,-0.019464951,0.005116706,0.017389644,0.024903689,0.046658635,-0.010519661,0.020609949,0.060684849,-0.045227386,-0.008551697,-0.004293739,-0.001502809,-0.015815273,-0.005975454,0.000290722,0.027050557,-0.002245268,-0.016888708,-0.027193682,-0.001288122,-0.021182448,-0.041219898,0.031916797,0.030628674,-0.03234617,0.006655296,0.008372792,-0.009016853,-0.033348043,0.010877473,-0.05238362,-0.004490536,-0.028911177,0.006905764,-0.003506554,0.039788652,-0.036496785,-0.015886836,0.015314337,-0.015672149,0.006225922,-0.021182448,-0.034349915,-0.043223642,-0.025476186,0.002558353,0.007048889,-0.037784904,-0.014026215,-0.044654887,-0.036926158,0.008229667,0.007728731,0.039216153,-0.00027954,0.026907433,0.027193682,-0.017174957,-0.011378409,0.017174957,-0.015815273,0.009446226,0.033777416,-0.014384027,0.003721241,-0.024760563,-0.000229223,0.008802165,-0.000377939,-0.007692949,0.016173085,0.018248392,-0.02218432,-0.003202414,-0.033204917,-0.002969836,-0.023186192,0.030056175,-0.015457462,-0.015314337,-0.008981071,0.022613693,-0.014026215,-0.025476186,0.025333062,0.034206789,0.010662786,0.016387772,0.030342424,-0.008086543,0.007120451,0.000221396,0.025619311,0.01789058,-0.008086543,0.011807784,-0.016101522,0.002719368,0.005653423,0.017962143,-0.001941128,0.06297484,0.016244646,0.003524444,0.018749328,-0.001815894,0.006082797,0.069558576,-0.011020597,0.018033706,0.026621183,0.007692949,-0.008694822,0.035924286,-0.001878511,-0.005975454,-0.028911177,-0.007871855,0.014741838,0.008587479,0.026621183,0.005259831,-0.023186192,0.000368993,-0.01323903,0.002683587,-0.011306847,0.007478263,-0.000621698,0.022756819,-0.018892452,-0.013167467,0.007764512,-0.010877473,-0.017461207,-0.013525278,0.014240902,-0.019464951,-0.009016853,0.016173085,-0.027479932,0.002934055,0.042937394,-0.004830457,-0.031201173,-0.024188064,0.00245101,0.017318081,0.001824839,-0.022756819,0.021325571,-0.027479932,-0.008659041,0.008337011,-0.016674021,-0.003452882,0.000711151,-0.045799885,0.013739966,-0.029340552,-0.035208661,0.000554608,-0.007800293,0.018892452,0.028481804,-0.011593096,-0.00894529,0.024474313,-0.008050761,0.025476186,-0.001306012,-0.00214687,-0.008050761,-0.018606203,-0.006047016,-0.028768053,0.029197427,-0.021468697,0.005402955,-0.021039322,-0.014312465,-0.002325775,-0.020896198,0.000706678,0.035638034,-0.008480135,-0.035351787,0.014312465,0.012523406,0.011807784,0.003041399,-0.010018725,-0.022613693,-0.021182448,-0.005474518,-0.007120451,0.025476186,0.036926158,-0.007907636,-0.014097777,0.010519661,0.005617642,0.014670276,-0.011664659,0.011879345,-0.012738093,-0.007871855,-0.012666531,0.032918669,-0.010018725,0.007943418,0.024188064,0.005760767,-0.003918037,0.022613693,0.017318081,0.036496785,0.037784904,0.008694822,0.016674021,0.000106225,0.003685459,-0.031201173,-0.01016185,-0.02404494,-0.019035578,0.031773672,0.000975037,-0.032489292,-0.033920541,0.015385899,-0.023186192,0.012523406,-0.011163722,-0.005116706,0.015314337,-0.006834202,-0.038357403,-0.023472441,0.015529023,0.017747456,0.005653423,-0.002325775,0.009088415,-0.022899942,0.02433119,0.000849803,-0.042078644,-0.004257958,0.018176829,-0.0049378,-0.002415228,-0.016173085,0.012594969,0.013596841,-0.017031832,-0.001806949,-0.003810694,0.003005618,0.046944883,-0.025476186,0.012738093,0.009016853,-0.009660914,0.012666531,0.014026215,-0.010519661,0.022327444,0.00400749,-0.007478263,-0.03578116,0.009804038,-0.028911177,-0.018248392,0.004758894,0.005939673,0.033920541,-0.011378409,-0.005474518,0.012451844,0.018176829,0.033920541,0.025905561,-0.014670276,0.001798003,0.031344298,0.00431163,0.027193682,-0.006798421,0.011449971,0.00894529,0.013883091,0.023758691,-0.007692949,0.031344298,-0.014384027,-0.007514044,-0.026621183,-0.001645933,-0.010090288,-0.009589351,0.008193886,-0.007871855,-0.031773672,0.013525278,0.006583733,0.010949035,-0.004794675,-0.004061162,-0.021468697,0.011020597,-0.020609949,0.010018725,0.010662786,0.008158104,0.00370335,0.007800293,-0.029626802,0.029197427,-0.017174957,-0.00586811,-0.003112961,-0.018749328,-0.042364895,0.027050557,0.028624929,0.008837947,0.026334934,0.018248392,-0.004758894,0.009446226,-0.033061791,-0.022041194,-0.021039322,0.008086543,-0.009088415,-0.031630546,0.020896198,-0.018749328,0.022613693,-0.014097777,0.004347411,0.014813401,-0.013525278,-0.001726441,0.010448099,0.036067411,-0.026048684,-0.020753073,-0.005045144,0.033348043,-0.002576244,0.02404494,0.022041194,0.017031832,-0.000297431,-0.003184523,-0.012738093,0.022756819,-0.016888708,0.021039322,-0.000313085,0.032203045,-0.011235285,0.001583316,-0.00461577,-0.026334934,-0.002934055,-0.005939673,0.001458082,0.007156232,-0.005689205,-0.042937394,0.011378409,0.007156232,0.00554608,0.026621183,-0.014455589,-0.017604331,-0.02647806,-0.03578116,-0.009804038,0.006905764,-0.0197512,-0.035494912,-0.027623056,-0.00461577,0.011521534,0.006905764,0.009517789,0.003112961,0.033920541,-0.004687332,-0.005045144,-0.009231539,0.000126911,0.008694822,-0.029340552,0.011163722,0.047517382,-0.039788652,-0.033348043,-0.003041399,-0.007657168,-0.035065539,-0.012165595,-0.024617439,0.0049378,0.017461207,0.029626802,-0.004723113,-0.000366757,-0.041792396,0.041219898,-0.009446226,0.016960271,-0.017747456,-0.036067411,0.025046812,0.027336806,0.025905561,0.049234878,0.016602458,-0.005796548,0.021325571,-0.003524444,-0.000872166,0.014670276,0.020323699,0.002737259,0.009660914,-0.006440609,-0.062402345,-0.062688597,-0.008158104,-0.018749328,0.005438737,-0.002066362,0.000205742,-0.018749328,0.017103394,-0.03578116,0.000265004,-0.03663991,-0.024760563,0.054101113,-0.00647639,-0.026334934,0.034779288,0.022756819,-0.033348043,-0.02433119,-0.041792396,-0.014455589,-0.023329318,-0.004687332,-0.013453716,-0.018319955,-0.014455589,0.043509893,0.013453716,-0.014813401,0.009052633,-0.034349915,0.052097369,-0.003774913,0.016316209,-0.027050557,0.028195554,-0.007549825,-0.020466823,0.014598713,-0.005939673,0.003273976,-0.052097369,0.002701478,-0.02404494,-0.005903892,0.009947163,-0.00043161,0.02189807,0.042078644,-0.020609949,0.007836075,0.018892452,0.001207614,0.009159978,-0.029197427,-0.023329318,0.004347411,-0.019464951,0.020180576,0.019894326,0.00615436,0.021468697,-0.017461207,-0.011879345,-0.002307885,0.016101522,-0.029626802,-0.014455589,0.020323699,0.020753073,0.018176829,-0.006082797,0.027766181,0.016530896,-0.008444354,0.001806949,0.029626802,-0.012451844,0.023186192,0.006869983,-0.034063663,-0.012094032,-0.021611821,-0.008050761,0.05581861,-0.004257958,-0.025333062,-0.004526317,0.018033706,0.027479932,0.025476186,0.008802165,-0.009589351,0.012809656,0.012523406,0.0400749,0.018033706,0.011020597,0.014956526,0.013883091,-0.006655296,0.019608077,-0.03234617,0.007585606,-0.036067411,-0.024617439,-0.001628043,0.022041194,0.026764309,-0.038643654,-0.009124196,-0.020323699,-0.013883091,0.02404494,0.002361557,-0.03234617,-0.0049378,0.018606203,0.022327444,0.043509893,-0.030485548,-0.003560225,0.007442481,0.00370335,0.011449971,0.023472441,0.000197915,-0.011950907,0.023329318,-0.009804038,-0.025619311,0.0074067,-0.003953818,0.014312465,0.048662379,-0.027193682,0.019894326,-0.042364895,0.003327648,0.042937394,-0.040933646,-0.020466823,0.056104861,0.020896198,-0.014527151,-0.036210533,-0.022470569,0.035924286,-0.013167467,-0.055532362,-0.006190141,-0.027909305,0.012881218,0.003005618,0.005689205,0.01109216,-0.016387772,-0.021468697,0.018176829,-0.021611821,0.032918669,0.002951946,-0.008837947,-0.031773672,-0.029913051,0.017318081,0.017461207,-0.02833868,-0.027479932,-0.023615567,0.037212405,-0.023615567,-0.02404494,0.029626802,0.002951946,0.004043271,-0.001377575,0.007800293,0.024188064,-0.027336806,-0.002361557,-0.00307718,-0.025189938,0.007192013,-0.000207978,0.040933646,0.010877473,-0.000720096,-0.006941545,0.003059289,0.032775544,-0.007657168,0.019321827,-0.012094032,0.042078644,-0.010591224,0.011807784,-0.016173085,-0.015529023,-0.023615567,0.016173085,-0.018606203,0.007192013,-0.008587479,0.000257177,0.002245268,-0.011879345,0.044082388,-0.005939673,-0.003059289,-0.013954652,-0.026621183,0.039502401,-0.006440609,0.014384027,0.012094032,-0.034779288,-0.002379447,0.023329318,0.029483676,-0.002325775,-0.001565426,0.025619311,0.018606203,-0.016101522,-0.0301993,0.002576244,0.035208661,0.002325775,-0.011664659,-0.022470569,-0.047231134,-0.016888708,-0.017747456,0.05152487,0.009374664,-0.010591224,0.009303101,-0.005009362,-0.029197427,0.001726441,-0.023758691,-0.002934055,-0.017461207,0.018606203,-0.002665696,-0.003578116,-0.018606203,-0.004651551,-0.021325571,0.005367174,-0.009124196,0.016888708,-0.01295278,0.002048471,-0.011593096,0.017604331,-0.008515916,0.006082797,-0.036067411,-0.027336806,-0.010018725,-0.001306012,0.026334934,-0.019321827,-0.030914923,-0.026764309,-0.0024689,-0.005581861,-0.002755149,0.019464951,-0.01295278,0.011163722,0.000639588,0.025476186,0.029483676,0.042651143,-0.011306847,0.002737259,0.010090288,-0.015600586,0.038357403,0.029197427,-0.008193886,0.044082388,0.032489292,-0.00123445,-0.008372792,0.009124196,-0.00309507,-0.041792396,0.007764512,-0.009947163,0.044941138,0.030056175,-0.013024342,-0.019321827,0.019321827,0.008551697,-0.053814866,0.038071156,-0.037784904,0.012165595,-0.008444354,-0.029626802,-0.006905764,-0.028195554,-0.01080591,-0.0098756,-0.032203045,0.040361151,-0.033920541,0.004454754,-0.036067411,0.011879345,-0.011235285,0.020609949,-0.004579989,0.0074067,-0.017103394,0.01789058,0.011449971,-0.007836075,0.000427138,-0.007120451,0.008337011,0.00123445,-0.003273976,-0.007263576,-0.011449971,0.022756819,0.002576244,-0.013310592,-0.013382155,-0.011664659,-0.013453716,-0.005152487,-0.050379876,-0.034636162,-0.011306847,0.015028087,0.008480135,-0.047517382,-0.00586811,-0.008301229,-0.01416934,0.000876638,0.000326503,0.01080591,0.004150615,0.005259831,-0.008837947,0.017031832,-0.016316209,-0.036210533,-0.013883091,-0.000295195,0.014240902,0.020753073,-0.022899942,-0.038929902,0.00586811,-0.008050761,0.00016437,-0.001932183,0.001789058,0.017031832,0.045227386,-0.016745584,-0.005689205,0.008372792,0.008301229,-0.016674021,-0.004222177,0.005832329,0.016173085,-0.009374664,-0.006869983,-0.052669868,0.035065539,0.000123557,0.007478263,0.033491168,0.054387365,0.002254213,-0.007836075,-0.020323699,-0.019178702,-0.010376536,-0.039788652,-0.032632418,-0.012380281,-0.002540462,-0.016602458,-0.022756819,0.019608077,0.001887456,0.032918669,0.008050761,-0.013739966,0.006547953,-0.016674021,0.001574371,0.019321827,-0.016960271,-0.031201173,0.027766181,0.006655296,0.020753073,0.009804038,0.024903689,-0.043509893,0.015815273,-0.017962143,-0.043223642,0.033920541,-0.007764512,-0.006762639,0.017819017,-0.026621183,0.046658635,-0.004490536,0.024188064,-0.010304974,0.004651551,0.047231134,-0.038071156,0.009589351,-0.033920541,-0.027050557,0.050093625,0.008515916,-0.025189938,-0.008050761,0.011950907,0.004973582,0.014527151,-0.009374664,-0.003721241,0.019608077,0.049807377,0.016602458,0.02404494];
  3. 保存并关闭文件。

2

在终端窗口中打开 mongosh 并连接到您的集群。有关连接的详细说明,请参阅通过mongosh连接到集群。

3

mongosh 提示符下运行以下命令:

use sample_mflix
switched to db sample_mflix
4

query-embeddings.js文件加载到 mongosh 中。

load('<path-to-file>/query-embeddings.js');
5
1vectorWeight = 1;
2vectorCutoff = 0.7;
3numResults = 20;
4numCandidates = numResults * 10;
5
6// Execute the vector search
7vectorResults = db.embedded_movies.aggregate([
8 {
9 $vectorSearch: {
10 index: "hybrid-vector-search",
11 path: "plot_embedding_voyage_3_large",
12 queryVector: STAR_WARS_EMBEDDING,
13 numCandidates: numCandidates,
14 limit: numResults
15 }
16 },
17 {
18 $project: {
19 _id: 1,
20 title: 1,
21 plot: 1,
22 vectorScore: { $meta: "vectorSearchScore" }
23 }
24 },
25 {
26 $match: {
27 vectorScore: { $gte: vectorCutoff }
28 }
29 }
30]).toArray();
31
32// Create a map for fast lookup
33vectorScoresMap = {};
34vectorResults.forEach(result => {
35 vectorScoresMap[result._id] = result.vectorScore * vectorWeight;
36});
37
38// Execute the text search with boosting based just on ID
39textResults = db.embedded_movies.aggregate([
40 {
41 $search: {
42 index: "hybrid-full-text-search",
43 compound: {
44 should: [
45 {
46 text: {
47 query: "star wars",
48 path: "plot"
49 }
50 },
51 ...Object.keys(vectorScoresMap).map(id => ({
52 equals: {
53 path: "_id",
54 value: id,
55 score: { boost: { value: vectorScoresMap[id] } }
56 }
57 }))
58 ]
59 }
60 }
61 },
62 {
63 $limit: 20
64 },
65 {
66 $project: {
67 _id: 1,
68 title: 1,
69 plot: 1,
70 score: { $meta: "searchScore" }
71 }
72 }
73]).toArray();
[
{
_id: ObjectId('573a1397f29313caabce6f53'),
plot: 'In this Star Wars take-off, the peaceful planet of Jillucia has been nearly wiped out by the Gavanas, whose leader takes orders from his mother (played a comic actor in drag) rather than ...',
title: 'Message from Space',
score: 4.386045455932617
},
{
_id: ObjectId('573a139df29313caabcfa90b'),
plot: 'In this Star Wars take-off, the peaceful planet of Jillucia has been nearly wiped out by the Gavanas, whose leader takes orders from his mother (played a comic actor in drag) rather than ...',
title: 'Message from Space',
score: 4.386045455932617
},
{
_id: ObjectId('573a1398f29313caabce9851'),
plot: 'Johnathan Cabot is a champion gymnast. In the tiny, yet savage, country of Parmistan, there is a perfect spot for a "star wars" site. For the US to get this site, they must compete in the ...',
title: 'Gymkata',
score: 4.269977569580078
},
{
_id: ObjectId('573a13a4f29313caabd1137f'),
plot: "A producer's film is endangered when his star walks off, so he decides to digitally create an actress to substitute for the star, becoming an overnight sensation that everyone thinks is a real person.",
title: 'S1m0ne',
score: 2.8472113609313965
},
{
_id: ObjectId('573a1394f29313caabcdf65b'),
plot: 'A fantastic tale of war, love, family and ambition set in the midst of the Japanese Civil Wars of the sixteenth century.',
title: 'Ugetsu',
score: 2.835911989212036
},
{
_id: ObjectId('573a13a3f29313caabd0c992'),
plot: 'The vampire Lestat becomes a rock star whose music wakes up the queen of all vampires.',
title: 'Queen of the Damned',
score: 2.664494037628174
},
{
_id: ObjectId('573a139af29313caabcefe79'),
plot: 'An all star baseball player becomes the unhealthy focus of a down on his luck salesman.',
title: 'The Fan',
score: 2.664494037628174
},
{
_id: ObjectId('573a13a8f29313caabd1da86'),
plot: 'During the Napoleonic Wars, a brash British captain pushes his ship and crew to their limits in pursuit of a formidable French war vessel around South America.',
title: 'Master and Commander: The Far Side of the World',
score: 2.6229333877563477
},
{
_id: ObjectId('573a139af29313caabcf0e7d'),
plot: 'A puppeteer discovers a portal that leads literally into the head of the movie star, John Malkovich.',
title: 'Being John Malkovich',
score: 2.6173996925354004
},
{
_id: ObjectId('573a13b6f29313caabd4614f'),
plot: 'A former pop star who now writes commercial jingles for a living experiences a mid-life crisis.',
title: 'The Good Night',
score: 2.6173996925354004
},
{
_id: ObjectId('573a13cbf29313caabd7fbc9'),
plot: 'Bertrand Tavernier is in top form with this gripping, superbly mounted drama set against the savage Catholic/Protestant wars that ripped France apart in the 16th century. Based on a novella...',
title: 'The Princess of Montpensier',
score: 2.4742777347564697
},
{
_id: ObjectId('573a139bf29313caabcf2d8e'),
plot: 'Updated version of the classic Rodgers and Hammerstein musical of the classic fairy-tale, with an all-star, multi-racial cast.',
title: 'Cinderella',
score: 2.4445695877075195
},
{
_id: ObjectId('573a1399f29313caabcec853'),
plot: 'An action movie star researching a role is allowed to tag along with a hardboiled New York policeman, who finds him superficial and irritating.',
title: 'The Hard Way',
score: 2.329218626022339
},
{
_id: ObjectId('573a13b4f29313caabd3f550'),
plot: 'A cop, a lawyer, and an assassin cross paths after the murder of a federal witness and the kidnapping of a famous pop star.',
title: 'Divergence',
score: 2.329218626022339
},
{
_id: ObjectId('573a13aff29313caabd2fe20'),
plot: 'An intimate story set during the 1860s in which a young Irish woman Sarah and her family find themselves on both sides of the turbulent wars between British and Maori during the British colonization of New Zealand.',
title: 'River Queen',
score: 2.2804131507873535
},
{
_id: ObjectId('573a13b8f29313caabd4d8e1'),
plot: "Thomas Michael, Paolo Mancini, Chris Klein and Joe Mantegna star in director Matthiew Klinck's holiday-themed comedy concerning two downsized Easter bunnies whose friendship starts to ...",
title: 'Hank and Mike',
score: 2.258181571960449
},
{
_id: ObjectId('573a13aef29313caabd2df95'),
plot: 'Story of two sisters that grew up in a small Serbian village in the beginning of the 1930s. The village is torn up by wars and years long blood oath. There are no men left in the village. ...',
title: 'Tears for Sale',
score: 2.2510178089141846
},
{
_id: ObjectId('573a139af29313caabcf124d'),
plot: 'As the Clone Wars near an end, the Sith Lord Darth Sidious steps out of the shadows, at which time Anakin succumbs to his emotions, becoming Darth Vader and putting his relationships with Obi-Wan and Padme at risk.',
title: 'Star Wars: Episode III - Revenge of the Sith',
score: 2.2223706245422363
},
{
_id: ObjectId('573a13dbf29313caabdaf598'),
plot: "Just as Clint Eastwood's star-making spaghetti Western A Fistful of Dollars was inspired by Akira Kurosawa's Yojimbo, Japanese-Korean filmmaker Sang-il Lee (Villain) has decided to ...",
title: 'Unforgiven',
score: 2.1913492679595947
},
{
_id: ObjectId('573a13c1f29313caabd633ac'),
plot: "Black Dynamite is the greatest African-American action star of the 1970s. When his only brother is killed by The Man it's up to him to find justice.",
title: 'Black Dynamite',
score: 2.1913492679595947
}
]

示例查询会根据$search 结果分数提升$vectorSearch 结果,以返回最相关的文档。对于语义提升,请执行以下步骤:

  1. 运行 $vectorSearch 查询。

    使用 over 请求值指定要考虑的候选数量超过指定限制。通过over请求,您可以完成以下操作:

    • 在初始搜索中考虑大量且广泛的文档。

    • 完善后续阶段的评分计算。

    该查询使用以下计算来确定向量搜索期间要考虑的候选数量:

    numCandidates = limit * over request

    结果根据最低分数阈值 (vectorCutoff) 进行筛选。

  2. 缩放向量搜索分数以调整向量搜索结果对文档评分和排名的影响。

    使用 vectorWeight 参数设立权重,并将向量搜索分数乘以 vectorWeight。这控制了向量搜索结果的重要性,并确保只考虑语义上最相关的文档。

  3. 运行 $search 查询并提高与向量搜索结果匹配的文档的分数。

本部分演示如何使用 $vectorSearch$search 管道阶段查询 sample_mflix.embedded_movies 集合中 plot_embedding_voyage_3_largetitle 字段中的 star wars 数据,并结合两个阶段中每个文档的分数,对结果中的文档进行重新排序。这可确保同时出现在两个搜索结果中的文件都出现在组合结果的顶部。

1
  1. 创建一个名为 query-embeddings.js 的文件。

  2. 将以下嵌入复制并粘贴到文件中。

    STAR_WARS_EMBEDDING=[-0.025189938,0.014741838,-0.013024342,-0.0197512,0.011235285,0.004651551,0.043509893,0.003112961,0.013310592,-0.033348043,0.037212405,-0.021039322,-0.026048684,0.012809656,0.029483676,0.003578116,-0.044654887,0.032632418,0.014312465,-0.058967352,0.025333062,-0.055246111,0.02189807,-0.017604331,-0.002880384,0.045227386,0.004794675,0.017604331,0.023186192,-0.054673612,-0.011306847,-0.012523406,-0.012380281,0.002540462,0.015958399,-0.042364895,-0.001467028,-0.020180576,-0.058108605,-0.035065539,0.010090288,-0.033348043,0.058394853,-0.013883091,0.002048471,-0.020753073,-0.029769925,0.031916797,-0.014741838,-0.040933646,-0.004096943,0.020753073,-0.002540462,0.028052431,-0.02404494,0.006547953,-0.003578116,0.003757022,0.019178702,-0.037784904,-0.02833868,0.01753277,0.029769925,0.017747456,-0.031344298,0.022899942,0.006333265,0.010376536,-0.024474313,-0.012094032,-0.004651551,0.007764512,0.017962143,0.013811528,0.037212405,-0.03148742,0.000666424,0.024474313,-0.021325571,0.041219898,0.011235285,0.046658635,0.019035578,0.020753073,0.010662786,-0.001726441,-0.012738093,-0.027193682,-0.014598713,-0.013167467,0.013596841,0.001932183,-0.010304974,-0.007478263,0.005689205,0.002987727,0.005724986,0.002325775,0.002415228,-0.003828584,-0.029340552,-0.017318081,-0.070417322,0.003810694,-0.013453716,-0.001628043,-0.027909305,0.014026215,0.009589351,0.004902019,0.028768053,-0.005259831,-0.010448099,0.025189938,0.038357403,0.048662379,0.039788652,0.010448099,0.001574371,0.020323699,0.005510299,0.026907433,0.043223642,-0.001153942,-0.010233412,0.048376128,-0.056104861,0.006691077,0.015672149,-0.015028087,0.036210533,-0.009231539,0.010519661,0.022899942,0.025762435,-0.009052633,-0.0301993,0.032203045,-0.00522405,0.029626802,-0.02433119,-0.025619311,0.016674021,0.02404494,-0.009589351,-0.026334934,-0.04436864,-0.014455589,0.02619181,0.017604331,0.02189807,-0.007728731,-0.021611821,-0.03363429,0.008480135,-0.027479932,0.025046812,-0.006047016,0.020753073,0.01016185,-0.034063663,0.029483676,-0.019035578,0.041506145,0.013453716,-0.009159978,0.007549825,0.025189938,0.005152487,-0.009446226,-0.009016853,0.021325571,0.030771798,-0.046944883,0.001314958,0.021182448,0.047231134,-0.007048889,-0.030771798,-0.025905561,-0.000612752,-0.023186192,0.011378409,0.035065539,0.007979199,0.023901815,-0.004973582,0.005188268,-0.046944883,0.009374664,0.047231134,0.058967352,0.043509893,0.011449971,0.017174957,-0.024188064,-0.025476186,-0.02833868,0.033061791,0.015314337,-0.018749328,0.013382155,0.007048889,0.005975454,0.005295612,-0.013310592,-0.022756819,-0.012523406,-0.03363429,-0.014527151,0.011449971,0.01202247,0.044941138,-0.012594969,0.002862493,0.000572499,0.030628674,-0.0098756,0.020466823,0.059539851,-0.00370335,0.007335138,0.023901815,0.023758691,-0.005903892,0.003918037,0.013310592,0.010090288,-0.012809656,-0.010376536,-0.01109216,-0.008086543,0.012809656,-0.019894326,0.012738093,0.056391109,0.029340552,-0.04436864,-0.001619098,0.042364895,-0.027623056,0.011593096,-0.031916797,-0.0301993,0.032203045,-0.003757022,0.017174957,0.033491168,0.003900147,0.002325775,0.006726858,0.020180576,0.017389644,0.009088415,0.018319955,-0.003631788,0.00586811,-0.006691077,-0.014240902,-0.009052633,0.031630546,0.04436864,-0.022899942,-0.003327648,-0.006691077,0.013310592,-0.035924286,-0.008158104,-0.005116706,-0.040647399,0.002397338,0.014455589,-0.030342424,0.028624929,-0.031773672,0.043509893,-0.001833785,-0.025619311,0.032775544,-0.046944883,0.013739966,-0.030485548,0.018319955,0.016745584,-0.020323699,-0.015815273,-0.020896198,-0.015171212,0.026334934,0.035638034,0.008873728,0.003291867,-0.02647806,0.003649678,0.003613897,0.009804038,-0.013525278,0.005367174,0.007657168,-0.017103394,-0.015815273,-0.000398065,0.013310592,0.014240902,0.003935928,0.001735386,-0.018606203,0.008265448,-0.068127327,0.012165595,-0.007836075,0.02189807,-0.000983982,0.019178702,-0.009589351,-0.013739966,-0.007800293,0.040361151,0.027623056,-0.002540462,-0.03663991,0.011163722,-0.016316209,-0.006333265,-0.010877473,-0.023329318,-0.021468697,0.013596841,0.032059919,0.007442481,0.02433119,-0.003613897,-0.013596841,0.010448099,0.010877473,-0.0098756,0.033920541,-0.006691077,-0.039502401,-0.010877473,-0.016960271,0.014097777,-0.008122323,0.007478263,0.010018725,-0.030485548,-0.011020597,0.000317558,0.00461577,0.020466823,0.070703574,-0.024617439,0.002111088,-0.024617439,-0.004204286,-0.048662379,-0.006834202,0.027766181,-0.002504681,0.025189938,0.033920541,-0.02833868,-0.000773768,-0.03578116,0.015958399,0.006369046,0.033204917,-0.006762639,0.02003745,-0.020180576,0.015886836,-0.015385899,-0.029340552,-0.009446226,0.015529023,-0.010376536,-0.012881218,-0.000715623,0.014312465,-0.029197427,-0.000684315,0.000360048,0.015815273,-0.027050557,0.006655296,0.018892452,-0.021182448,0.031201173,0.014240902,-0.022756819,0.004365302,-0.020609949,0.008515916,-0.016244646,0.001162888,0.000084421,0.003273976,-0.017819017,0.000576971,0.020753073,-0.004794675,0.018105267,-0.013095905,-0.028052431,0.004114834,0.02833868,-0.027193682,-0.010877473,-0.002576244,0.011879345,-0.017819017,0.006726858,-0.021754947,-0.031773672,-0.013382155,0.024903689,0.013167467,0.000033964,0.034063663,0.022613693,-0.038357403,-0.010018725,-0.017174957,-0.004418973,0.02189807,-0.003166633,-0.009589351,0.009303101,-0.036496785,-0.005760767,-0.006583733,-0.003596007,0.014026215,-0.003828584,-0.02833868,-0.020896198,0.001449137,0.039502401,0.012881218,0.025476186,0.000961619,-0.025762435,0.002808821,0.034922414,0.004687332,-0.046658635,0.030914923,-0.036067411,0.008659041,-0.004025381,-0.0301993,-0.026048684,0.024760563,0.036496785,-0.029913051,0.015672149,0.007764512,0.01509965,0.010304974,-0.004490536,-0.007585606,-0.019464951,0.016602458,-0.007048889,-0.005510299,0.011163722,0.013739966,-0.034636162,0.020609949,-0.004418973,0.034636162,0.040933646,0.031773672,0.023758691,0.031344298,-0.006798421,0.026048684,-0.011521534,0.020753073,0.014384027,0.026334934,-0.034206789,-0.036067411,0.014598713,0.023758691,-0.039216153,0.003363429,0.002880384,-0.006726858,-0.000916892,-0.001395465,-0.009660914,0.032059919,0.008086543,0.029054303,-0.011593096,0.065551087,0.031058047,-0.041219898,-0.014097777,-0.017103394,0.016244646,-0.028911177,0.044654887,-0.030771798,0.024760563,0.02833868,0.018248392,0.026907433,-0.002227377,0.034063663,0.000167724,0.021039322,-0.018892452,0.012738093,-0.001395465,0.005760767,-0.024760563,-0.002683587,0.000230341,-0.0197512,0.009088415,-0.00400749,-0.026764309,-0.012881218,0.016101522,-0.009303101,0.015529023,-0.016817145,0.014312465,-0.030914923,-0.018463079,0.020323699,-0.023472441,-0.023758691,-0.005009362,0.018176829,0.012738093,0.009374664,-0.031916797,0.016387772,0.027479932,0.015529023,-0.021325571,0.020323699,-0.025476186,0.008515916,-0.039788652,-0.007979199,-0.009947163,-0.006869983,0.004758894,0.022613693,-0.013668403,-0.015171212,0.035351787,-0.022327444,0.019178702,0.000404774,-0.003524444,-0.012094032,0.023901815,-0.0400749,-0.004579989,0.00245101,0.013024342,0.015958399,0.009517789,0.034779288,0.021468697,0.00062617,0.007728731,-0.028195554,0.0301993,-0.002504681,0.008909509,0.004651551,-0.007013108,0.03148742,0.019608077,0.002540462,0.043509893,-0.006190141,0.024903689,0.010519661,0.018319955,0.010519661,0.009660914,0.000966091,-0.004454754,0.000299667,0.007907636,-0.018463079,0.004758894,-0.001851675,-0.002415228,0.010233412,-0.024617439,-0.030771798,0.018749328,0.003023508,0.005474518,-0.011521534,-0.008551697,0.007979199,0.03363429,0.000275068,0.007800293,0.0039896,0.00522405,-0.035924286,-0.01416934,0.02619181,-0.025476186,-0.033777416,0.021325571,-0.02218432,0.001833785,0.027766181,-0.006118578,0.032059919,0.038929902,0.003613897,0.031344298,-0.002737259,0.057536107,0.009732476,0.020753073,0.005402955,-0.047803629,-0.040933646,0.009052633,-0.030485548,0.018319955,0.025046812,-0.002361557,0.045513637,0.008766385,-0.031058047,0.014312465,0.002737259,-0.004186396,0.032059919,0.024617439,-0.012666531,0.006798421,0.02619181,-0.012523406,0.009947163,0.005617642,0.039216153,0.008766385,0.009517789,0.042651143,-0.012881218,0.007263576,-0.000514354,0.016817145,-0.048948627,0.018176829,0.034922414,0.005331393,0.000391356,-0.017604331,0.026048684,-0.011807784,0.017461207,0.012809656,0.029483676,-0.017174957,0.023472441,0.005188268,0.007585606,-0.034922414,0.069558576,0.023472441,-0.010304974,0.020180576,0.025046812,0.016459335,0.000317558,-0.018606203,0.066696085,0.011664659,0.025762435,-0.016888708,0.015314337,-0.009231539,0.016459335,-0.021325571,0.009303101,0.000840857,-0.014455589,0.00170855,0.014741838,-0.004168505,-0.009088415,-0.0074067,-0.004472645,0.002665696,0.023615567,0.038929902,-0.016960271,-0.027193682,0.03663991,-0.016530896,0.003256086,0.015171212,0.036926158,0.02433119,0.047231134,-0.049234878,0.009947163,-0.01109216,-0.014097777,-0.007585606,0.00338132,-0.008086543,0.018176829,-0.014527151,-0.000205742,-0.041219898,0.012666531,0.046086136,0.004025381,-0.0074067,0.033348043,-0.020896198,-0.000514354,0.033491168,0.004257958,0.02404494,-0.008372792,-0.021754947,0.037784904,0.013453716,0.013024342,-0.026334934,0.023758691,0.012094032,0.006297485,0.045227386,0.021039322,-0.020323699,0.005975454,0.008802165,0.00370335,0.006941545,-0.029340552,-0.008551697,-0.004454754,0.003488663,0.010662786,0.00801498,0.010090288,0.015600586,0.018105267,-0.020180576,-0.00307718,0.031630546,0.000644061,0.011950907,-0.023472441,0.01509965,-0.035924286,0.016459335,-0.027766181,-0.014598713,-0.021611821,-0.013310592,-0.021039322,-0.02189807,0.018606203,-0.007979199,0.018176829,0.022041194,-0.002916165,0.009088415,-0.00522405,-0.018176829,-0.031916797,-0.017318081,-0.025476186,-0.014527151,-0.017675893,-0.026621183,0.000362284,0.02619181,0.016101522,-0.013310592,0.021325571,0.027909305,0.016316209,0.006011235,0.008551697,0.030914923,-0.070703574,0.004794675,-0.019321827,-0.011163722,-0.014598713,-0.0197512,-0.005438737,-0.025189938,-0.037212405,0.004168505,-0.021754947,0.018033706,0.035065539,0.022756819,0.005581861,-0.007764512,-0.003005618,-0.003524444,0.006655296,-0.00170855,-0.046086136,-0.009374664,0.001744332,0.030056175,0.016674021,0.014312465,0.029054303,-0.009052633,0.005832329,-0.029197427,-0.004723113,0.032489292,0.022899942,-0.044941138,0.014026215,-0.007227794,-0.035494912,0.001261286,0.079004802,0.008122323,0.022041194,0.016602458,0.046658635,-0.016888708,-0.006547953,-0.016316209,0.002021636,-0.016745584,0.003792803,0.005116706,-0.037784904,-0.028481804,-0.014670276,-0.005259831,0.018892452,0.001252341,-0.068699829,-0.021611821,-0.015242774,-0.027050557,-0.032059919,0.026048684,-0.014240902,-0.007013108,0.014598713,-0.005474518,-0.007192013,-0.016817145,0.00400749,0.010519661,0.007657168,0.005295612,0.009124196,0.024474313,-0.019894326,-0.044941138,-0.022756819,-0.022327444,-0.041792396,0.027479932,-0.013668403,-0.036210533,0.001225505,0.009947163,-0.044654887,-0.02003745,0.031344298,-0.004186396,-0.009517789,0.000720096,-0.023901815,0.000670897,0.022899942,0.006619515,0.006512171,0.022327444,0.021468697,0.021611821,0.039216153,-0.019608077,0.028052431,-0.020466823,-0.0197512,0.004454754,0.026048684,-0.024617439,-0.000333212,0.002200541,-0.002629915,0.021611821,0.009374664,0.00894529,-0.057822354,-0.009660914,-0.002844602,0.020323699,0.000603807,0.018033706,-0.027050557,-0.004186396,-0.019608077,-0.021754947,0.009732476,0.01602996,-0.016960271,-0.001520699,-0.023615567,0.004383192,0.000925838,0.023043068,0.032775544,0.006404828,-0.010304974,0.019321827,0.017604331,-0.01230872,0.007657168,0.005402955,-0.03148742,-0.000550135,-0.002111088,-0.029626802,0.01323903,-0.033777416,0.006655296,0.035065539,-0.003256086,0.000907947,0.004025381,0.011020597,-0.04808988,0.02619181,0.015171212,0.023758691,0.014741838,-0.001359684,-0.041506145,-0.009088415,-0.012738093,0.000176669,0.033777416,0.024188064,-0.002307885,0.023901815,0.00034663,-0.024474313,-0.031773672,-0.023758691,-0.024474313,-0.011163722,0.000447265,0.005080925,-0.00123445,0.006297485,-0.031058047,-0.012738093,-0.003059289,-0.026907433,-0.015672149,-0.005760767,0.023043068,0.023043068,-0.015028087,0.017747456,0.013883091,-0.011807784,0.038357403,-0.016817145,0.014884963,0.017389644,-0.000599334,0.016602458,0.008086543,-0.039502401,0.050379876,-0.024474313,0.035351787,-0.023758691,0.002039526,0.004061162,-0.012165595,-0.020180576,0.001636988,-0.013883091,0.017389644,0.006225922,-0.03578116,-0.016817145,-0.001332848,-0.005617642,-0.008730603,-0.039216153,0.02433119,0.028052431,0.02833868,0.039502401,0.010233412,-0.006869983,0.021468697,0.002039526,-0.0197512,0.020753073,0.027050557,0.009517789,0.011449971,0.038929902,0.008873728,0.009374664,0.007871855,-0.006082797,-0.007156232,-0.014670276,-0.000447265,0.046944883,-0.015242774,-0.019894326,0.008158104,0.016173085,-0.018463079,0.034922414,-0.005009362,-0.000092248,0.005760767,0.006190141,-0.022613693,0.034206789,0.012523406,0.000992927,0.038071156,-0.048376128,-0.017747456,0.014384027,0.000751404,0.015314337,-0.010519661,0.058681104,0.013954652,0.022899942,-0.003757022,0.01416934,-0.000469628,-0.008337011,-0.001153942,0.02189807,-0.024760563,0.01416934,-0.012738093,-0.025046812,0.030771798,-0.046658635,-0.002137924,0.053242367,0.010090288,-0.046086136,0.016316209,-0.005295612,0.023043068,-0.023043068,0.010233412,-0.018319955,-0.017389644,0.030485548,0.009660914,0.017174957,0.050379876,-0.010304974,0.017819017,-0.000364521,0.011163722,0.001753277,0.010448099,0.013095905,0.008372792,-0.01109216,0.036926158,-0.015672149,-0.014598713,0.008981071,-0.011879345,-0.036926158,-0.01789058,-0.008694822,-0.028911177,-0.017103394,-0.028768053,-0.030914923,0.001033181,0.00431163,-0.024474313,-0.031058047,0.010018725,0.00647639,-0.027336806,0.025046812,0.003148742,-0.010018725,0.03663991,0.033348043,-0.001162888,-0.01016185,0.010376536,0.010519661,0.019178702,0.016101522,0.007943418,-0.013739966,-0.013525278,-0.027193682,0.006655296,0.027050557,-0.017389644,-0.027479932,0.041792396,0.045513637,-0.014741838,0.012451844,0.018319955,-0.00153859,0.010519661,0.017962143,-0.012594969,0.018606203,0.023472441,-0.034063663,-0.004061162,0.015600586,0.019178702,0.002361557,-0.025619311,-0.00586811,-0.02003745,0.013739966,0.017675893,-0.025189938,-0.002415228,0.001547535,0.019608077,0.039502401,-0.00184273,0.025189938,0.00277304,0.020323699,0.007227794,0.012165595,-0.00370335,0.02433119,-0.00586811,0.016459335,0.034206789,0.001051072,-0.010519661,-0.004096943,0.00153859,0.01574371,0.01230872,-0.007692949,-0.019464951,0.005116706,0.017389644,0.024903689,0.046658635,-0.010519661,0.020609949,0.060684849,-0.045227386,-0.008551697,-0.004293739,-0.001502809,-0.015815273,-0.005975454,0.000290722,0.027050557,-0.002245268,-0.016888708,-0.027193682,-0.001288122,-0.021182448,-0.041219898,0.031916797,0.030628674,-0.03234617,0.006655296,0.008372792,-0.009016853,-0.033348043,0.010877473,-0.05238362,-0.004490536,-0.028911177,0.006905764,-0.003506554,0.039788652,-0.036496785,-0.015886836,0.015314337,-0.015672149,0.006225922,-0.021182448,-0.034349915,-0.043223642,-0.025476186,0.002558353,0.007048889,-0.037784904,-0.014026215,-0.044654887,-0.036926158,0.008229667,0.007728731,0.039216153,-0.00027954,0.026907433,0.027193682,-0.017174957,-0.011378409,0.017174957,-0.015815273,0.009446226,0.033777416,-0.014384027,0.003721241,-0.024760563,-0.000229223,0.008802165,-0.000377939,-0.007692949,0.016173085,0.018248392,-0.02218432,-0.003202414,-0.033204917,-0.002969836,-0.023186192,0.030056175,-0.015457462,-0.015314337,-0.008981071,0.022613693,-0.014026215,-0.025476186,0.025333062,0.034206789,0.010662786,0.016387772,0.030342424,-0.008086543,0.007120451,0.000221396,0.025619311,0.01789058,-0.008086543,0.011807784,-0.016101522,0.002719368,0.005653423,0.017962143,-0.001941128,0.06297484,0.016244646,0.003524444,0.018749328,-0.001815894,0.006082797,0.069558576,-0.011020597,0.018033706,0.026621183,0.007692949,-0.008694822,0.035924286,-0.001878511,-0.005975454,-0.028911177,-0.007871855,0.014741838,0.008587479,0.026621183,0.005259831,-0.023186192,0.000368993,-0.01323903,0.002683587,-0.011306847,0.007478263,-0.000621698,0.022756819,-0.018892452,-0.013167467,0.007764512,-0.010877473,-0.017461207,-0.013525278,0.014240902,-0.019464951,-0.009016853,0.016173085,-0.027479932,0.002934055,0.042937394,-0.004830457,-0.031201173,-0.024188064,0.00245101,0.017318081,0.001824839,-0.022756819,0.021325571,-0.027479932,-0.008659041,0.008337011,-0.016674021,-0.003452882,0.000711151,-0.045799885,0.013739966,-0.029340552,-0.035208661,0.000554608,-0.007800293,0.018892452,0.028481804,-0.011593096,-0.00894529,0.024474313,-0.008050761,0.025476186,-0.001306012,-0.00214687,-0.008050761,-0.018606203,-0.006047016,-0.028768053,0.029197427,-0.021468697,0.005402955,-0.021039322,-0.014312465,-0.002325775,-0.020896198,0.000706678,0.035638034,-0.008480135,-0.035351787,0.014312465,0.012523406,0.011807784,0.003041399,-0.010018725,-0.022613693,-0.021182448,-0.005474518,-0.007120451,0.025476186,0.036926158,-0.007907636,-0.014097777,0.010519661,0.005617642,0.014670276,-0.011664659,0.011879345,-0.012738093,-0.007871855,-0.012666531,0.032918669,-0.010018725,0.007943418,0.024188064,0.005760767,-0.003918037,0.022613693,0.017318081,0.036496785,0.037784904,0.008694822,0.016674021,0.000106225,0.003685459,-0.031201173,-0.01016185,-0.02404494,-0.019035578,0.031773672,0.000975037,-0.032489292,-0.033920541,0.015385899,-0.023186192,0.012523406,-0.011163722,-0.005116706,0.015314337,-0.006834202,-0.038357403,-0.023472441,0.015529023,0.017747456,0.005653423,-0.002325775,0.009088415,-0.022899942,0.02433119,0.000849803,-0.042078644,-0.004257958,0.018176829,-0.0049378,-0.002415228,-0.016173085,0.012594969,0.013596841,-0.017031832,-0.001806949,-0.003810694,0.003005618,0.046944883,-0.025476186,0.012738093,0.009016853,-0.009660914,0.012666531,0.014026215,-0.010519661,0.022327444,0.00400749,-0.007478263,-0.03578116,0.009804038,-0.028911177,-0.018248392,0.004758894,0.005939673,0.033920541,-0.011378409,-0.005474518,0.012451844,0.018176829,0.033920541,0.025905561,-0.014670276,0.001798003,0.031344298,0.00431163,0.027193682,-0.006798421,0.011449971,0.00894529,0.013883091,0.023758691,-0.007692949,0.031344298,-0.014384027,-0.007514044,-0.026621183,-0.001645933,-0.010090288,-0.009589351,0.008193886,-0.007871855,-0.031773672,0.013525278,0.006583733,0.010949035,-0.004794675,-0.004061162,-0.021468697,0.011020597,-0.020609949,0.010018725,0.010662786,0.008158104,0.00370335,0.007800293,-0.029626802,0.029197427,-0.017174957,-0.00586811,-0.003112961,-0.018749328,-0.042364895,0.027050557,0.028624929,0.008837947,0.026334934,0.018248392,-0.004758894,0.009446226,-0.033061791,-0.022041194,-0.021039322,0.008086543,-0.009088415,-0.031630546,0.020896198,-0.018749328,0.022613693,-0.014097777,0.004347411,0.014813401,-0.013525278,-0.001726441,0.010448099,0.036067411,-0.026048684,-0.020753073,-0.005045144,0.033348043,-0.002576244,0.02404494,0.022041194,0.017031832,-0.000297431,-0.003184523,-0.012738093,0.022756819,-0.016888708,0.021039322,-0.000313085,0.032203045,-0.011235285,0.001583316,-0.00461577,-0.026334934,-0.002934055,-0.005939673,0.001458082,0.007156232,-0.005689205,-0.042937394,0.011378409,0.007156232,0.00554608,0.026621183,-0.014455589,-0.017604331,-0.02647806,-0.03578116,-0.009804038,0.006905764,-0.0197512,-0.035494912,-0.027623056,-0.00461577,0.011521534,0.006905764,0.009517789,0.003112961,0.033920541,-0.004687332,-0.005045144,-0.009231539,0.000126911,0.008694822,-0.029340552,0.011163722,0.047517382,-0.039788652,-0.033348043,-0.003041399,-0.007657168,-0.035065539,-0.012165595,-0.024617439,0.0049378,0.017461207,0.029626802,-0.004723113,-0.000366757,-0.041792396,0.041219898,-0.009446226,0.016960271,-0.017747456,-0.036067411,0.025046812,0.027336806,0.025905561,0.049234878,0.016602458,-0.005796548,0.021325571,-0.003524444,-0.000872166,0.014670276,0.020323699,0.002737259,0.009660914,-0.006440609,-0.062402345,-0.062688597,-0.008158104,-0.018749328,0.005438737,-0.002066362,0.000205742,-0.018749328,0.017103394,-0.03578116,0.000265004,-0.03663991,-0.024760563,0.054101113,-0.00647639,-0.026334934,0.034779288,0.022756819,-0.033348043,-0.02433119,-0.041792396,-0.014455589,-0.023329318,-0.004687332,-0.013453716,-0.018319955,-0.014455589,0.043509893,0.013453716,-0.014813401,0.009052633,-0.034349915,0.052097369,-0.003774913,0.016316209,-0.027050557,0.028195554,-0.007549825,-0.020466823,0.014598713,-0.005939673,0.003273976,-0.052097369,0.002701478,-0.02404494,-0.005903892,0.009947163,-0.00043161,0.02189807,0.042078644,-0.020609949,0.007836075,0.018892452,0.001207614,0.009159978,-0.029197427,-0.023329318,0.004347411,-0.019464951,0.020180576,0.019894326,0.00615436,0.021468697,-0.017461207,-0.011879345,-0.002307885,0.016101522,-0.029626802,-0.014455589,0.020323699,0.020753073,0.018176829,-0.006082797,0.027766181,0.016530896,-0.008444354,0.001806949,0.029626802,-0.012451844,0.023186192,0.006869983,-0.034063663,-0.012094032,-0.021611821,-0.008050761,0.05581861,-0.004257958,-0.025333062,-0.004526317,0.018033706,0.027479932,0.025476186,0.008802165,-0.009589351,0.012809656,0.012523406,0.0400749,0.018033706,0.011020597,0.014956526,0.013883091,-0.006655296,0.019608077,-0.03234617,0.007585606,-0.036067411,-0.024617439,-0.001628043,0.022041194,0.026764309,-0.038643654,-0.009124196,-0.020323699,-0.013883091,0.02404494,0.002361557,-0.03234617,-0.0049378,0.018606203,0.022327444,0.043509893,-0.030485548,-0.003560225,0.007442481,0.00370335,0.011449971,0.023472441,0.000197915,-0.011950907,0.023329318,-0.009804038,-0.025619311,0.0074067,-0.003953818,0.014312465,0.048662379,-0.027193682,0.019894326,-0.042364895,0.003327648,0.042937394,-0.040933646,-0.020466823,0.056104861,0.020896198,-0.014527151,-0.036210533,-0.022470569,0.035924286,-0.013167467,-0.055532362,-0.006190141,-0.027909305,0.012881218,0.003005618,0.005689205,0.01109216,-0.016387772,-0.021468697,0.018176829,-0.021611821,0.032918669,0.002951946,-0.008837947,-0.031773672,-0.029913051,0.017318081,0.017461207,-0.02833868,-0.027479932,-0.023615567,0.037212405,-0.023615567,-0.02404494,0.029626802,0.002951946,0.004043271,-0.001377575,0.007800293,0.024188064,-0.027336806,-0.002361557,-0.00307718,-0.025189938,0.007192013,-0.000207978,0.040933646,0.010877473,-0.000720096,-0.006941545,0.003059289,0.032775544,-0.007657168,0.019321827,-0.012094032,0.042078644,-0.010591224,0.011807784,-0.016173085,-0.015529023,-0.023615567,0.016173085,-0.018606203,0.007192013,-0.008587479,0.000257177,0.002245268,-0.011879345,0.044082388,-0.005939673,-0.003059289,-0.013954652,-0.026621183,0.039502401,-0.006440609,0.014384027,0.012094032,-0.034779288,-0.002379447,0.023329318,0.029483676,-0.002325775,-0.001565426,0.025619311,0.018606203,-0.016101522,-0.0301993,0.002576244,0.035208661,0.002325775,-0.011664659,-0.022470569,-0.047231134,-0.016888708,-0.017747456,0.05152487,0.009374664,-0.010591224,0.009303101,-0.005009362,-0.029197427,0.001726441,-0.023758691,-0.002934055,-0.017461207,0.018606203,-0.002665696,-0.003578116,-0.018606203,-0.004651551,-0.021325571,0.005367174,-0.009124196,0.016888708,-0.01295278,0.002048471,-0.011593096,0.017604331,-0.008515916,0.006082797,-0.036067411,-0.027336806,-0.010018725,-0.001306012,0.026334934,-0.019321827,-0.030914923,-0.026764309,-0.0024689,-0.005581861,-0.002755149,0.019464951,-0.01295278,0.011163722,0.000639588,0.025476186,0.029483676,0.042651143,-0.011306847,0.002737259,0.010090288,-0.015600586,0.038357403,0.029197427,-0.008193886,0.044082388,0.032489292,-0.00123445,-0.008372792,0.009124196,-0.00309507,-0.041792396,0.007764512,-0.009947163,0.044941138,0.030056175,-0.013024342,-0.019321827,0.019321827,0.008551697,-0.053814866,0.038071156,-0.037784904,0.012165595,-0.008444354,-0.029626802,-0.006905764,-0.028195554,-0.01080591,-0.0098756,-0.032203045,0.040361151,-0.033920541,0.004454754,-0.036067411,0.011879345,-0.011235285,0.020609949,-0.004579989,0.0074067,-0.017103394,0.01789058,0.011449971,-0.007836075,0.000427138,-0.007120451,0.008337011,0.00123445,-0.003273976,-0.007263576,-0.011449971,0.022756819,0.002576244,-0.013310592,-0.013382155,-0.011664659,-0.013453716,-0.005152487,-0.050379876,-0.034636162,-0.011306847,0.015028087,0.008480135,-0.047517382,-0.00586811,-0.008301229,-0.01416934,0.000876638,0.000326503,0.01080591,0.004150615,0.005259831,-0.008837947,0.017031832,-0.016316209,-0.036210533,-0.013883091,-0.000295195,0.014240902,0.020753073,-0.022899942,-0.038929902,0.00586811,-0.008050761,0.00016437,-0.001932183,0.001789058,0.017031832,0.045227386,-0.016745584,-0.005689205,0.008372792,0.008301229,-0.016674021,-0.004222177,0.005832329,0.016173085,-0.009374664,-0.006869983,-0.052669868,0.035065539,0.000123557,0.007478263,0.033491168,0.054387365,0.002254213,-0.007836075,-0.020323699,-0.019178702,-0.010376536,-0.039788652,-0.032632418,-0.012380281,-0.002540462,-0.016602458,-0.022756819,0.019608077,0.001887456,0.032918669,0.008050761,-0.013739966,0.006547953,-0.016674021,0.001574371,0.019321827,-0.016960271,-0.031201173,0.027766181,0.006655296,0.020753073,0.009804038,0.024903689,-0.043509893,0.015815273,-0.017962143,-0.043223642,0.033920541,-0.007764512,-0.006762639,0.017819017,-0.026621183,0.046658635,-0.004490536,0.024188064,-0.010304974,0.004651551,0.047231134,-0.038071156,0.009589351,-0.033920541,-0.027050557,0.050093625,0.008515916,-0.025189938,-0.008050761,0.011950907,0.004973582,0.014527151,-0.009374664,-0.003721241,0.019608077,0.049807377,0.016602458,0.02404494];
  3. 保存并关闭文件。

2

在终端窗口中打开 mongosh 并连接到您的集群。有关连接的详细说明,请参阅通过mongosh连接到集群。

3

mongosh 提示符下运行以下命令:

use sample_mflix
switched to db sample_mflix
4

<path-to-file> 替换为 embeddings.js 文件的绝对路径后,运行以下命令以加载嵌入:

load('/<path-to-file>/embeddings.js');

要验证嵌入是否已成功加载,运行以下命令:

STAR_WARS_EMBEDDING.length
2048
5
1db.embedded_movies.aggregate([
2 {
3 $rankFusion: {
4 input: {
5 pipelines: {
6 vectorPipeline: [
7 {
8 "$vectorSearch": {
9 "index": "hybrid-vector-search",
10 "path": "plot_embedding_voyage_3_large",
11 "queryVector": STAR_WARS_EMBEDDING,
12 "numCandidates": 100,
13 "limit": 20
14 }
15 }
16 ],
17 fullTextPipeline: [
18 {
19 "$search": {
20 "index": "hybrid-full-text-search",
21 "phrase": {
22 "query": "star wars",
23 "path": "title"
24 }
25 }
26 },
27 { "$limit": 20 }
28 ]
29 }
30 },
31 combination: {
32 weights: {
33 vectorPipeline: 0.5,
34 fullTextPipeline: 0.5
35 }
36 },
37 "scoreDetails": true
38 }
39 },
40 {
41 "$project": {
42 _id: 1,
43 title: 1,
44 plot: 1,
45 scoreDetails: {"$meta": "scoreDetails"}
46 }
47 },
48 {
49 "$limit": 10
50 }
51]);
[
{
_id: ObjectId('573a1397f29313caabce68f6'),
plot: "Luke Skywalker joins forces with a Jedi Knight, a cocky pilot, a wookiee and two droids to save the universe from the Empire's world-destroying battle-station, while also attempting to rescue Princess Leia from the evil Darth Vader.",
title: 'Star Wars: Episode IV - A New Hope',
scoreDetails: {
value: 0.01626123744050767,
description: 'value output by reciprocal rank fusion algorithm, computed as sum of (weight * (1 / (60 + rank))) across input pipelines from which this document is output, from:',
details: [
{
inputPipelineName: 'fullTextPipeline',
rank: 2,
weight: 0.5,
value: 2.9571781158447266,
details: []
},
{
inputPipelineName: 'vectorPipeline',
rank: 1,
weight: 0.5,
value: 0.7987099885940552,
details: []
}
]
}
},
{
_id: ObjectId('573a139af29313caabcf0f5f'),
plot: 'Two Jedi Knights escape a hostile blockade to find allies and come across a young boy who may bring balance to the Force, but the long dormant Sith resurface to reclaim their old glory.',
title: 'Star Wars: Episode I - The Phantom Menace',
scoreDetails: {
value: 0.015527202696196438,
description: 'value output by reciprocal rank fusion algorithm, computed as sum of (weight * (1 / (60 + rank))) across input pipelines from which this document is output, from:',
details: [
{
inputPipelineName: 'fullTextPipeline',
rank: 2,
weight: 0.5,
value: 2.9571781158447266,
details: []
},
{
inputPipelineName: 'vectorPipeline',
rank: 7,
weight: 0.5,
value: 0.7771433591842651,
details: []
}
]
}
},
{
_id: ObjectId('573a1397f29313caabce77d9'),
plot: 'After the rebels have been brutally overpowered by the Empire on their newly established base, Luke Skywalker takes advanced Jedi training with Master Yoda, while his friends are pursued by Darth Vader as part of his plan to capture Luke.',
title: 'Star Wars: Episode V - The Empire Strikes Back',
scoreDetails: {
value: 0.015504807692307693,
description: 'value output by reciprocal rank fusion algorithm, computed as sum of (weight * (1 / (60 + rank))) across input pipelines from which this document is output, from:',
details: [
{
inputPipelineName: 'fullTextPipeline',
rank: 4,
weight: 0.5,
value: 2.712062358856201,
details: []
},
{
inputPipelineName: 'vectorPipeline',
rank: 5,
weight: 0.5,
value: 0.7810181975364685,
details: []
}
]
}
},
{
_id: ObjectId('573a1397f29313caabce8cdb'),
plot: 'After rescuing Han Solo from the palace of Jabba the Hutt, the rebels attempt to destroy the second Death Star, while Luke struggles to make Vader return from the dark side of the Force.',
title: 'Star Wars: Episode VI - Return of the Jedi',
scoreDetails: {
value: 0.015388257575757576,
description: 'value output by reciprocal rank fusion algorithm, computed as sum of (weight * (1 / (60 + rank))) across input pipelines from which this document is output, from:',
details: [
{
inputPipelineName: 'fullTextPipeline',
rank: 4,
weight: 0.5,
value: 2.712062358856201,
details: []
},
{
inputPipelineName: 'vectorPipeline',
rank: 6,
weight: 0.5,
value: 0.7782549858093262,
details: []
}
]
}
},
{
_id: ObjectId('573a13c0f29313caabd62f62'),
plot: 'Anakin Skywalker and Ahsoka Tano must rescue the kidnapped son of Jabba the Hutt, but political intrigue complicates their mission.',
title: 'Star Wars: The Clone Wars',
scoreDetails: {
value: 0.015141165755919854,
description: 'value output by reciprocal rank fusion algorithm, computed as sum of (weight * (1 / (60 + rank))) across input pipelines from which this document is output, from:',
details: [
{
inputPipelineName: 'fullTextPipeline',
rank: 1,
weight: 0.5,
value: 3.609658718109131,
details: []
},
{
inputPipelineName: 'vectorPipeline',
rank: 12,
weight: 0.5,
value: 0.7561323642730713,
details: []
}
]
}
},
{
_id: ObjectId('573a139af29313caabcf124d'),
plot: 'As the Clone Wars near an end, the Sith Lord Darth Sidious steps out of the shadows, at which time Anakin succumbs to his emotions, becoming Darth Vader and putting his relationships with Obi-Wan and Padme at risk.',
title: 'Star Wars: Episode III - Revenge of the Sith',
scoreDetails: {
value: 0.014854753521126762,
description: 'value output by reciprocal rank fusion algorithm, computed as sum of (weight * (1 / (60 + rank))) across input pipelines from which this document is output, from:',
details: [
{
inputPipelineName: 'fullTextPipeline',
rank: 4,
weight: 0.5,
value: 2.712062358856201,
details: []
},
{
inputPipelineName: 'vectorPipeline',
rank: 11,
weight: 0.5,
value: 0.756283700466156,
details: []
}
]
}
},
{
_id: ObjectId('573a139af29313caabcf1258'),
plot: 'Ten years after initially meeting, Anakin Skywalker shares a forbidden romance with Padmè, while Obi-Wan investigates an assassination attempt on the Senator and discovers a secret clone army crafted for the Jedi.',
title: 'Star Wars: Episode II - Attack of the Clones',
scoreDetails: {
value: 0.014391447368421052,
description: 'value output by reciprocal rank fusion algorithm, computed as sum of (weight * (1 / (60 + rank))) across input pipelines from which this document is output, from:',
details: [
{
inputPipelineName: 'fullTextPipeline',
rank: 4,
weight: 0.5,
value: 2.712062358856201,
details: []
},
{
inputPipelineName: 'vectorPipeline',
rank: 16,
weight: 0.5,
value: 0.7400004267692566,
details: []
}
]
}
},
{
_id: ObjectId('573a1398f29313caabce9091'),
plot: "A Duke's son leads desert warriors against the galactic emperor and his father's evil nemesis when they assassinate his father and free their desert world from the emperor's rule.",
title: 'Dune',
scoreDetails: {
value: 0.008064516129032258,
description: 'value output by reciprocal rank fusion algorithm, computed as sum of (weight * (1 / (60 + rank))) across input pipelines from which this document is output, from:',
details: [
{ inputPipelineName: 'fullTextPipeline', rank: 0, weight: 0.5 },
{
inputPipelineName: 'vectorPipeline',
rank: 2,
weight: 0.5,
value: 0.7947750091552734,
details: []
}
]
}
},
{
_id: ObjectId('573a1397f29313caabce6f53'),
plot: 'In this Star Wars take-off, the peaceful planet of Jillucia has been nearly wiped out by the Gavanas, whose leader takes orders from his mother (played a comic actor in drag) rather than ...',
title: 'Message from Space',
scoreDetails: {
value: 0.007936507936507936,
description: 'value output by reciprocal rank fusion algorithm, computed as sum of (weight * (1 / (60 + rank))) across input pipelines from which this document is output, from:',
details: [
{ inputPipelineName: 'fullTextPipeline', rank: 0, weight: 0.5 },
{
inputPipelineName: 'vectorPipeline',
rank: 3,
weight: 0.5,
value: 0.7913960218429565,
details: []
}
]
}
},
{
_id: ObjectId('573a139df29313caabcfa90b'),
plot: 'In this Star Wars take-off, the peaceful planet of Jillucia has been nearly wiped out by the Gavanas, whose leader takes orders from his mother (played a comic actor in drag) rather than ...',
title: 'Message from Space',
scoreDetails: {
value: 0.007936507936507936,
description: 'value output by reciprocal rank fusion algorithm, computed as sum of (weight * (1 / (60 + rank))) across input pipelines from which this document is output, from:',
details: [
{ inputPipelineName: 'fullTextPipeline', rank: 0, weight: 0.5 },
{
inputPipelineName: 'vectorPipeline',
rank: 3,
weight: 0.5,
value: 0.7913960218429565,
details: []
}
]
}
}
]

示例查询从语义搜索和全文搜索中检索排序后的搜索结果,并根据结果数组中的位置为结果中的文档分配倒数排名分数。倒数排名分数的计算公式如下:

1.0/{document position in the results + constant value}

然后,查询将每个文档的两次搜索得分相加,根据综合得分对文档进行排名,并对文档进行排序以返回单一结果。常量的值始终为60

观看应用程序演示,该应用程序展示了将MongoDB搜索全文搜索和向量搜索相结合以返回单个合并结果设立的混合搜索查询。该应用程序实施相对分数融合 (RSF) 和倒数排名融合 (RRF),以返回使用排名融合算法创建的合并设立。

时长:2.43 分钟

后退

自定义评分

在此页面上