|
39 | 39 | it 'adds JSON documents (as a array of documents)' do |
40 | 40 | documents = <<JSON |
41 | 41 | [ |
42 | | - { "objectId": 123, "title": "Pride and Prejudice", "comment": "A great book" }, |
43 | | - { "objectId": 456, "title": "Le Petit Prince", "comment": "A french book" }, |
44 | | - { "objectId": 1, "title": "Alice In Wonderland", "comment": "A weird book" }, |
45 | | - { "objectId": 1344, "title": "The Hobbit", "comment": "An awesome book" }, |
46 | | - { "objectId": 4, "title": "Harry Potter and the Half-Blood Prince", "comment": "The best book" } |
| 42 | + { "objectRef": 123, "title": "Pride and Prejudice", "comment": "A great book" }, |
| 43 | + { "objectRef": 456, "title": "Le Petit Prince", "comment": "A french book" }, |
| 44 | + { "objectRef": 1, "title": "Alice In Wonderland", "comment": "A weird book" }, |
| 45 | + { "objectRef": 1344, "title": "The Hobbit", "comment": "An awesome book" }, |
| 46 | + { "objectRef": 4, "title": "Harry Potter and the Half-Blood Prince", "comment": "The best book" } |
47 | 47 | ] |
48 | 48 | JSON |
49 | | - response = index.add_documents_json(documents) |
| 49 | + response = index.add_documents_json(documents, 'objectRef') |
50 | 50 |
|
51 | 51 | expect(response).to be_a(Hash) |
52 | 52 | expect(response).to have_key('updateId') |
|
56 | 56 |
|
57 | 57 | it 'adds NDJSON documents (as a array of documents)' do |
58 | 58 | documents = <<NDJSON |
59 | | - { "objectId": 123, "title": "Pride and Prejudice", "comment": "A great book" } |
60 | | - { "objectId": 456, "title": "Le Petit Prince", "comment": "A french book" } |
61 | | - { "objectId": 1, "title": "Alice In Wonderland", "comment": "A weird book" } |
62 | | - { "objectId": 4, "title": "Harry Potter and the Half-Blood Prince", "comment": "The best book" } |
| 59 | + { "objectRef": 123, "title": "Pride and Prejudice", "comment": "A great book" } |
| 60 | + { "objectRef": 456, "title": "Le Petit Prince", "comment": "A french book" } |
| 61 | + { "objectRef": 1, "title": "Alice In Wonderland", "comment": "A weird book" } |
| 62 | + { "objectRef": 4, "title": "Harry Potter and the Half-Blood Prince", "comment": "The best book" } |
63 | 63 | NDJSON |
64 | | - response = index.add_documents_ndjson(documents) |
| 64 | + response = index.add_documents_ndjson(documents, 'objectRef') |
65 | 65 | expect(response).to be_a(Hash) |
66 | 66 | expect(response).to have_key('updateId') |
67 | 67 | index.wait_for_pending_update(response['updateId']) |
|
70 | 70 |
|
71 | 71 | it 'adds CSV documents (as a array of documents)' do |
72 | 72 | documents = <<CSV |
73 | | -"objectId:number","title:string","comment:string" |
| 73 | +"objectRef:number","title:string","comment:string" |
74 | 74 | "1239","Pride and Prejudice","A great book" |
75 | 75 | "4569","Le Petit Prince","A french book" |
76 | 76 | "49","Harry Potter and the Half-Blood Prince","The best book" |
77 | 77 | CSV |
78 | | - response = index.add_documents_csv(documents) |
| 78 | + response = index.add_documents_csv(documents, 'objectRef') |
79 | 79 | expect(response).to be_a(Hash) |
80 | 80 | expect(response).to have_key('updateId') |
81 | 81 | index.wait_for_pending_update(response['updateId']) |
|
0 commit comments