MongoDB ベクトル検索とMongoDB Search クエリをハイブリッド検索として使用すると、統合結果が得られます。
このチュートリアルでは、映画の詳細が含まれる sample_mflix.embedded_moviesコレクションに対してハイブリッド検索を実行する方法を説明します。 具体的には、このチュートリアルでは次の手順について説明します。
MongoDB ベクトル検索インデックスを
plot_embedding_voyage_3_largeフィールドに作成します。このフィールドには、映画のプロットの概要を表すベクトル埋め込みが含まれています。sample_mflix.embedded_moviesコレクションにMongoDB Searchインデックスを作成します。次の方法を使用して、
$searchクエリと$vectorSearchクエリの結果を組み合わせてクエリを実行します。セマンティック ブースト
因果ランクの統合
ハイブリッド検索を使用する理由
ハイブリッド検索とは、同じクエリ条件に対して全文検索やセマンティック検索などの異なる検索方法を集約したものです。 全文検索はクエリ用語の完全一致を見つけるのに効果的ですが、ドキュメントに完全なクエリ用語が含まれていない場合でも、セマンティック検索ではセマンティック類似ドキュメントを識別できるという追加の利点があります。 これにより、シノニムとコンテキストが類似する一致も、両方の検索方法の合計結果に含まれるようになります。
逆に、データセットで使用されるのと同じコンテキストで埋め込みモデルの訓練で考慮されることが予想されない場合は、ベクトル検索に次のことがメリットをもたらす可能性があります。全文検索と組み合わせて使用します。
クエリごとに、各検索方法の重みを設定することもできます。 全文検索結果とセマンティック検索結果がクエリに最も関連し、適切であるかどうかに基づいて、クエリごとのその検索方法の重みを増やすことができます。
ハイブリッド検索を実現するには、次の手法を適用できます。
手法 | セマンティック ブースト | 因果ランクの統合 | ||
目的 | ベクトル検索に一致するドキュメントを優先することで、全文検索結果の精度を向上させます。非常に大きな結果セットを検索する場合に便利です。 | 結果内のドキュメントの逆ランクを計算することにより、異なる検索メソッドの結果を単一のランク付けされた結果セットに結合します。 | ||
ランキング方法 |
|
| ||
スコアリング方法 | ベクトル検索の結果に一致するドキュメントの全文結果スコアを、重み付きベクトル検索スコアでブーストします。 | 次の式を使用してスコアを計算します。 次に、検索方法ごとに異なる重み( | ||
検索機能 |
| |||
出力 | のドキュメントを含む単一の結果セット | 両方の検索方法のドキュメントを含む単一の結果セット。 |
前提条件
始める前に、以下のものを用意してください。
MongoDBバージョン v8.0 以上を搭載した Atlas クラスター。
注意
MongoDB Search とMongoDB ベクトル検索インデックスの両方を保存し、パフォーマンス クエリを実行するのに十分なメモリがあることを Atlas クラスターに確認してください。
Atlas クラスターにロードされた sample_mflix データ。
mongoshAtlas クラスターでクエリを実行するには、次の手順に従います。Project Data Access Adminプロジェクトにアクセスして、 MongoDB ベクトル検索とMongoDB Search インデックスを作成します。
MongoDB ベクトル検索とMongoDB Search インデックスの作成
このセクションでは、 sample_mflix.embedded_moviesコレクションのフィールドに次のインデックスを作成する方法について説明します。
plot_embedding_voyage_3_largeフィールドのMongoDB ベクトル検索インデックス :そのフィールドに対してベクトルクエリを実行中。titleフィールドのMongoDB Searchインデックス:そのフィールドに対して全文検索を実行中ための MongoDB Search インデックス。
手順
mongosh を使用してクラスターに接続します。
詳細については、「mongosh経由でクラスターに接続する」を参照してください。
MongoDB ベクトル検索インデックスを定義します。
次のコマンドを実行します。このインデックス定義は、コレクションをクエリするときに、plot_embedding_voyage_3_largeフィールドをMongoDB ベクトル検索フィールドとしてインデックス化します。
1 db.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 );
セマンティック ブースト
このセクションでは、それぞれsample_mflix.embedded_movies plot_embedding_voyage_3_largeplot$vectorSearchと$search パイプラインステージを使用して、 フィールドと フィールドのスタータームを表す コレクション内のデータをクエリする方法を示します。このクエリは、同じドキュメントの$search スコアを使用して全文スコアをブーストすることで、$vectorSearch クエリの関連性を向上させます。
手順
埋め込み用のファイルを作成します。
query-embeddings.jsという名前のファイルを作成します。touch query-embeddings.js 次の埋め込みをコピーしてファイルに貼り付けます。
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]; ファイルを保存して閉じます。
mongosh を使用してクラスターに接続します。
ターミナルウィンドウで mongosh を開き、クラスターに接続します。接続の詳細な手順については、 mongosh経由でクラスターに接続する を参照してください。
sample_mflix データベースを使用します。
mongoshプロンプトで次のコマンドを実行します。
use sample_mflix
switched to db sample_mflix
embedded_moviesコレクションに対して次のMongoDB Search クエリを実行します。
1 vectorWeight = 1; 2 vectorCutoff = 0.7; 3 numResults = 20; 4 numCandidates = numResults * 10; 5 6 // Execute the vector search 7 vectorResults = 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 33 vectorScoresMap = {}; 34 vectorResults.forEach(result => { 35 vectorScoresMap[result._id] = result.vectorScore * vectorWeight; 36 }); 37 38 // Execute the text search with boosting based just on ID 39 textResults = 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結果をブーストし、最も関連性の高いドキュメントを返します。セマンティック ブーストでは、次の手順を実行します。
$vectorSearchクエリを実行します。指定された制限以上の候補数を指定して、考慮する必要がある値は、オーバーリクエスト値を使用します。オーバーリクエストを使用すると、次のことが実行できます。
考慮する必要がある多数のドキュメント プールを初期検索に含めます。
後続のステージでスコアリングの計算を調整します。
クエリは、次の計算を使用して、ベクトル検索中に考慮する候補の数を決定します。
numCandidates = limit * over request 結果は、最小スコアしきい値(
vectorCutoff)に基づいてフィルタリングされます。ベクトル検索スコアをスケーリングして、ドキュメントのスコアリングとランキングへのベクトル検索結果の影響を調整します。
vectorWeightパラメーターを使用して重みを設定し、ベクトル検索スコアにvectorWeightを掛けます。これによりベクトル検索結果の重要性が制御され、最もセマンティックに関連するドキュメントのみが考慮されるようになります。$searchクエリを実行し、ベクトル検索の結果に一致するドキュメントのスコアをブーストします。
サンプルクエリでは、次の変数を定義します。
vectorWeightベクトル検索スコアに重みを追加し、数値が低いほど重みが高くなります。vectorCutoff結果がブーストされるための最小ベクトルスコアを設定します。numResultsは、検索結果の数を指定しますnumCandidates初期検索中に考慮する候補の数を計算します。次の式を使用して、候補者の数を計算します。numCandidates = numResults x overRequestFactor
サンプル クエリでは、次のパイプライン ステージを使用して コレクションに対してセマンティック検索を実行し、結果内のドキュメントの逆ランクを検索します。
クエリの | |
プロットフィールドに スターティング というタームが含まれている映画を検索します。ベクトル検索結果の |
因果ランクの統合
このセクションでは、sample_mflix.embedded_movies plot_embedding_voyage_3_largetitle$vectorSearch} パイプライン$search ステージと パイプライン ステージを使用して、 フィールドと フィールドの スターターム をチェックする方法と、両方のステージの各ドキュメントのスコアを組み合わせて再試行する方法を示します。結果内のドキュメントをソートします。これにより、両方の検索で表示されるドキュメントが、結合された結果の上位に表示されるようになります。
手順
クエリで使用する埋め込みを設定します。
query-embeddings.jsという名前のファイルを作成します。次の埋め込みをコピーして、ファイルに貼り付けます。
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]; ファイルを保存して閉じます。
mongosh を使用してクラスターに接続します。
ターミナルウィンドウで mongosh を開き、クラスターに接続します。接続の詳細な手順については、 mongosh経由でクラスターに接続する を参照してください。
sample_mflix データベースを使用します。
mongoshプロンプトで次のコマンドを実行します。
use sample_mflix
switched to db sample_mflix
embedded_moviesコレクションに対して次のMongoDB Search クエリを実行します。
1 db.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 です。
サンプルクエリは、パイプラインの最終スコアへのランク寄与に影響を与えるために、次の重みをパイプラインに定義します。
vectorPipeline= 0.5fullTextPipeline= 0.5
重みを調整して、特定の検索により重要性を持たせることができます。数値が小さいほど重み付けは大きくなることにご注意ください。
重み付けされた逆ランクスコアは、次の式を使用して計算されます。
weight x reciprocal rank
scoreDetails.details.value は、 Reciprocal Rank Fusionを使用して重み付けおよび結合される前に、そのパイプラインの生スコアを示します。scoreDetails.value は重み付けされた逆数順位のスコアを示します。
サンプルクエリは、$rankFusion ステージを使用してセマンティッククエリとフルテキストクエリを個別に実行し、その後、入力クエリの結果を重複排除して、最終的なランクを付けた結果のセットに統合します。入力パイプラインに現れるランクとパイプラインの重みに基づいて、ランク付けされたドキュメントのセットを返します。具体的には、このステージは次の入力パイプラインを受け取ります。
| このパイプラインには |
|
サンプル クエリでは、次のステージを使用してセマンティック検索とテキスト検索の結果を組み合わせて、結果内のドキュメントの単一のランク付けされたリストを返します。
ビデオで学ぶ
MongoDB Search の全文検索とベクトル検索を組み合わせて 1 つのマージされた結果セットを返すハイブリッド検索クエリを紹介するアプリケーションのデモをご覧ください。アプリケーションは、ランク統合アルゴリズムによって作成されたマージされたセットを返すために、相対的スコア統合(RSF)と整数ランク統合(RLF)を実装します。
所要時間: 2.43 分