|
37 | 37 | end |
38 | 38 |
|
39 | 39 | it 'adds JSON documents (as a array of documents)' do |
40 | | - documents = <<JSON |
41 | | - [ |
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 | | - ] |
48 | | -JSON |
| 40 | + documents = <<~JSON |
| 41 | + [ |
| 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 | + ] |
| 48 | + JSON |
49 | 49 | response = index.add_documents_json(documents, 'objectRef') |
50 | 50 |
|
51 | 51 | index.wait_for_task(response['taskUid']) |
52 | 52 | expect(index.documents['results'].count).to eq(5) |
53 | 53 | end |
54 | 54 |
|
55 | 55 | it 'adds NDJSON documents (as a array of documents)' do |
56 | | - documents = <<NDJSON |
57 | | - { "objectRef": 123, "title": "Pride and Prejudice", "comment": "A great book" } |
58 | | - { "objectRef": 456, "title": "Le Petit Prince", "comment": "A french book" } |
59 | | - { "objectRef": 1, "title": "Alice In Wonderland", "comment": "A weird book" } |
60 | | - { "objectRef": 4, "title": "Harry Potter and the Half-Blood Prince", "comment": "The best book" } |
61 | | -NDJSON |
| 56 | + documents = <<~NDJSON |
| 57 | + { "objectRef": 123, "title": "Pride and Prejudice", "comment": "A great book" } |
| 58 | + { "objectRef": 456, "title": "Le Petit Prince", "comment": "A french book" } |
| 59 | + { "objectRef": 1, "title": "Alice In Wonderland", "comment": "A weird book" } |
| 60 | + { "objectRef": 4, "title": "Harry Potter and the Half-Blood Prince", "comment": "The best book" } |
| 61 | + NDJSON |
62 | 62 | response = index.add_documents_ndjson(documents, 'objectRef') |
63 | 63 |
|
64 | 64 | index.wait_for_task(response['taskUid']) |
|
0 commit comments