search_spec.rb 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Search', type: :request do
  4. let(:group) { create(:group) }
  5. let!(:admin) do
  6. create(:admin, groups: [Group.lookup(name: 'Users'), group])
  7. end
  8. let!(:agent) do
  9. create(:agent, firstname: 'Search 1234', groups: [Group.lookup(name: 'Users'), group])
  10. end
  11. let!(:customer) do
  12. create(:customer)
  13. end
  14. let!(:organization1) do
  15. create(:organization, name: 'Rest Org')
  16. end
  17. let!(:organization2) do
  18. create(:organization, name: 'Rest Org #2')
  19. end
  20. let!(:organization3) do
  21. create(:organization, name: 'Rest Org #3')
  22. end
  23. let!(:organization4) do
  24. create(:organization, name: 'Tes.t. Org')
  25. end
  26. let!(:organization5) do
  27. create(:organization, name: 'ABC_D Org')
  28. end
  29. let!(:customer2) do
  30. create(:customer, organization: organization1)
  31. end
  32. let!(:customer3) do
  33. create(:customer, organization: organization1)
  34. end
  35. let!(:ticket1) do
  36. create(:ticket, title: 'test 1234-1', customer: customer, group: group)
  37. end
  38. let!(:ticket2) do
  39. create(:ticket, title: 'test 1234-2', customer: customer2, group: group)
  40. end
  41. let!(:ticket3) do
  42. create(:ticket, title: 'test 1234-2', customer: customer3, group: group)
  43. end
  44. let!(:article1) do
  45. create(:ticket_article, ticket_id: ticket1.id)
  46. end
  47. let!(:article2) do
  48. create(:ticket_article, ticket_id: ticket2.id)
  49. end
  50. let!(:article3) do
  51. create(:ticket_article, ticket_id: ticket3.id)
  52. end
  53. describe 'request handling', performs_jobs: true, searchindex: true do
  54. before do
  55. searchindex_model_reload([Ticket, User, Organization])
  56. end
  57. it 'does settings index with nobody' do
  58. params = {
  59. query: 'test 1234',
  60. limit: 2,
  61. }
  62. post '/api/v1/search/ticket', params: params, as: :json
  63. expect(response).to have_http_status(:forbidden)
  64. expect(json_response).to be_a(Hash)
  65. expect(json_response).not_to be_blank
  66. expect(json_response['error']).to eq('Authentication required')
  67. post '/api/v1/search/user', params: params, as: :json
  68. expect(response).to have_http_status(:forbidden)
  69. expect(json_response).to be_a(Hash)
  70. expect(json_response).not_to be_blank
  71. expect(json_response['error']).to eq('Authentication required')
  72. post '/api/v1/search', params: params, as: :json
  73. expect(response).to have_http_status(:forbidden)
  74. expect(json_response).to be_a(Hash)
  75. expect(json_response).not_to be_blank
  76. expect(json_response['error']).to eq('Authentication required')
  77. end
  78. it 'does settings index with admin' do
  79. params = {
  80. query: '1234*',
  81. limit: 1,
  82. }
  83. authenticated_as(admin)
  84. post '/api/v1/search', params: params, as: :json
  85. expect(response).to have_http_status(:ok)
  86. expect(json_response).to be_a(Hash)
  87. expect(json_response).to be_truthy
  88. expect(json_response['result'][0]['type']).to eq('Ticket')
  89. expect(json_response['result'][0]['id']).to eq(ticket3.id)
  90. expect(json_response['result'][1]['type']).to eq('User')
  91. expect(json_response['result'][1]['id']).to eq(agent.id)
  92. expect(json_response['result'][2]).to be_falsey
  93. params = {
  94. query: '1234*',
  95. limit: 10,
  96. }
  97. post '/api/v1/search', params: params, as: :json
  98. expect(response).to have_http_status(:ok)
  99. expect(json_response).to be_a(Hash)
  100. expect(json_response).to be_truthy
  101. expect(json_response['result'][0]['type']).to eq('Ticket')
  102. expect(json_response['result'][0]['id']).to eq(ticket3.id)
  103. expect(json_response['result'][1]['type']).to eq('Ticket')
  104. expect(json_response['result'][1]['id']).to eq(ticket2.id)
  105. expect(json_response['result'][2]['type']).to eq('Ticket')
  106. expect(json_response['result'][2]['id']).to eq(ticket1.id)
  107. expect(json_response['result'][3]['type']).to eq('User')
  108. expect(json_response['result'][3]['id']).to eq(agent.id)
  109. expect(json_response['result'][4]).to be_falsey
  110. params = {
  111. query: '1234*',
  112. limit: 10,
  113. }
  114. post '/api/v1/search/ticket', params: params, as: :json
  115. expect(response).to have_http_status(:ok)
  116. expect(json_response).to be_a(Hash)
  117. expect(json_response).to be_truthy
  118. expect(json_response['result'][0]['type']).to eq('Ticket')
  119. expect(json_response['result'][0]['id']).to eq(ticket3.id)
  120. expect(json_response['result'][1]['type']).to eq('Ticket')
  121. expect(json_response['result'][1]['id']).to eq(ticket2.id)
  122. expect(json_response['result'][2]['type']).to eq('Ticket')
  123. expect(json_response['result'][2]['id']).to eq(ticket1.id)
  124. expect(json_response['result'][3]).to be_falsey
  125. params = {
  126. query: '1234*',
  127. limit: 10,
  128. }
  129. post '/api/v1/search/user', params: params, as: :json
  130. expect(response).to have_http_status(:ok)
  131. expect(json_response).to be_a(Hash)
  132. expect(json_response['result'][0]['type']).to eq('User')
  133. expect(json_response['result'][0]['id']).to eq(agent.id)
  134. expect(json_response['result'][1]).to be_falsey
  135. end
  136. it 'does settings index with agent' do
  137. params = {
  138. query: '1234*',
  139. limit: 1,
  140. }
  141. authenticated_as(agent)
  142. post '/api/v1/search', params: params, as: :json
  143. expect(response).to have_http_status(:ok)
  144. expect(json_response).to be_a(Hash)
  145. expect(json_response).to be_truthy
  146. expect(json_response['result'][0]['type']).to eq('Ticket')
  147. expect(json_response['result'][0]['id']).to eq(ticket3.id)
  148. expect(json_response['result'][1]['type']).to eq('User')
  149. expect(json_response['result'][1]['id']).to eq(agent.id)
  150. expect(json_response['result'][2]).to be_falsey
  151. params = {
  152. query: '1234*',
  153. limit: 10,
  154. }
  155. post '/api/v1/search', params: params, as: :json
  156. expect(response).to have_http_status(:ok)
  157. expect(json_response).to be_a(Hash)
  158. expect(json_response).to be_truthy
  159. expect(json_response['result'][0]['type']).to eq('Ticket')
  160. expect(json_response['result'][0]['id']).to eq(ticket3.id)
  161. expect(json_response['result'][1]['type']).to eq('Ticket')
  162. expect(json_response['result'][1]['id']).to eq(ticket2.id)
  163. expect(json_response['result'][2]['type']).to eq('Ticket')
  164. expect(json_response['result'][2]['id']).to eq(ticket1.id)
  165. expect(json_response['result'][3]['type']).to eq('User')
  166. expect(json_response['result'][3]['id']).to eq(agent.id)
  167. expect(json_response['result'][4]).to be_falsey
  168. params = {
  169. query: '1234*',
  170. limit: 10,
  171. }
  172. post '/api/v1/search/ticket', params: params, as: :json
  173. expect(response).to have_http_status(:ok)
  174. expect(json_response).to be_a(Hash)
  175. expect(json_response).to be_truthy
  176. expect(json_response['result'][0]['type']).to eq('Ticket')
  177. expect(json_response['result'][0]['id']).to eq(ticket3.id)
  178. expect(json_response['result'][1]['type']).to eq('Ticket')
  179. expect(json_response['result'][1]['id']).to eq(ticket2.id)
  180. expect(json_response['result'][2]['type']).to eq('Ticket')
  181. expect(json_response['result'][2]['id']).to eq(ticket1.id)
  182. expect(json_response['result'][3]).to be_falsey
  183. params = {
  184. query: '1234*',
  185. limit: 10,
  186. }
  187. post '/api/v1/search/user', params: params, as: :json
  188. expect(response).to have_http_status(:ok)
  189. expect(json_response).to be_a(Hash)
  190. expect(json_response['result'][0]['type']).to eq('User')
  191. expect(json_response['result'][0]['id']).to eq(agent.id)
  192. expect(json_response['result'][1]).to be_falsey
  193. end
  194. it 'does settings index with customer 1' do
  195. params = {
  196. query: '1234*',
  197. limit: 10,
  198. }
  199. authenticated_as(customer)
  200. post '/api/v1/search', params: params, as: :json
  201. expect(response).to have_http_status(:ok)
  202. expect(json_response).to be_a(Hash)
  203. expect(json_response).to be_truthy
  204. expect(json_response['result'][0]['type']).to eq('Ticket')
  205. expect(json_response['result'][0]['id']).to eq(ticket1.id)
  206. expect(json_response['result'][1]).to be_falsey
  207. params = {
  208. query: '1234*',
  209. limit: 10,
  210. }
  211. post '/api/v1/search/ticket', params: params, as: :json
  212. expect(response).to have_http_status(:ok)
  213. expect(json_response).to be_a(Hash)
  214. expect(json_response).to be_truthy
  215. expect(json_response['result'][0]['type']).to eq('Ticket')
  216. expect(json_response['result'][0]['id']).to eq(ticket1.id)
  217. expect(json_response['result'][1]).to be_falsey
  218. params = {
  219. query: '1234*',
  220. limit: 10,
  221. }
  222. post '/api/v1/search/user', params: params, as: :json
  223. expect(response).to have_http_status(:ok)
  224. expect(json_response).to be_a(Hash)
  225. expect(json_response['result'][0]).to be_falsey
  226. end
  227. it 'does settings index with customer 2' do
  228. params = {
  229. query: '1234*',
  230. limit: 10,
  231. }
  232. authenticated_as(customer2)
  233. post '/api/v1/search', params: params, as: :json
  234. expect(response).to have_http_status(:ok)
  235. expect(json_response).to be_a(Hash)
  236. expect(json_response).to be_truthy
  237. expect(json_response['result'][0]['type']).to eq('Ticket')
  238. expect(json_response['result'][0]['id']).to eq(ticket3.id)
  239. expect(json_response['result'][1]['type']).to eq('Ticket')
  240. expect(json_response['result'][1]['id']).to eq(ticket2.id)
  241. expect(json_response['result'][2]).to be_falsey
  242. params = {
  243. query: '1234*',
  244. limit: 10,
  245. }
  246. post '/api/v1/search/ticket', params: params, as: :json
  247. expect(response).to have_http_status(:ok)
  248. expect(json_response).to be_a(Hash)
  249. expect(json_response).to be_truthy
  250. expect(json_response['result'][0]['type']).to eq('Ticket')
  251. expect(json_response['result'][0]['id']).to eq(ticket3.id)
  252. expect(json_response['result'][1]['type']).to eq('Ticket')
  253. expect(json_response['result'][1]['id']).to eq(ticket2.id)
  254. expect(json_response['result'][2]).to be_falsey
  255. params = {
  256. query: '1234*',
  257. limit: 10,
  258. }
  259. post '/api/v1/search/user', params: params, as: :json
  260. expect(response).to have_http_status(:ok)
  261. expect(json_response).to be_a(Hash)
  262. expect(json_response['result'][0]).to be_falsey
  263. end
  264. # Verify fix for Github issue #2058 - Autocomplete hangs on dot in the new user form
  265. it 'does searching for organization with a dot in its name' do
  266. authenticated_as(agent)
  267. get '/api/v1/search/organization?query=tes.', as: :json
  268. expect(response).to have_http_status(:ok)
  269. expect(json_response['result'].size).to eq(1)
  270. expect(json_response['result'][0]['type']).to eq('Organization')
  271. target_id = json_response['result'][0]['id']
  272. expect(json_response['assets']['Organization'][target_id.to_s]['name']).to eq('Tes.t. Org')
  273. end
  274. # Search query H& should correctly match H&M
  275. it 'does searching for organization with _ in its name' do
  276. authenticated_as(agent)
  277. get '/api/v1/search/organization?query=abc_', as: :json
  278. expect(response).to have_http_status(:ok)
  279. expect(json_response['result'].size).to eq(1)
  280. expect(json_response['result'][0]['type']).to eq('Organization')
  281. target_id = json_response['result'][0]['id']
  282. expect(json_response['assets']['Organization'][target_id.to_s]['name']).to eq('ABC_D Org')
  283. end
  284. it 'does find the ticket by group name even if the group name changes' do
  285. authenticated_as(agent)
  286. post '/api/v1/search/Ticket', params: { query: "number:#{ticket1.number} && group.name:ultrasupport" }, as: :json
  287. expect(response).to have_http_status(:ok)
  288. expect(json_response).to be_a(Hash)
  289. expect(json_response).to be_truthy
  290. expect(json_response['assets']['Ticket']).to be_falsey
  291. expect(group).not_to eq('ultrasupport')
  292. group.update(name: 'ultrasupport')
  293. perform_enqueued_jobs
  294. SearchIndexBackend.refresh
  295. post '/api/v1/search/Ticket', params: { query: "number:#{ticket1.number} && group.name:ultrasupport" }, as: :json
  296. expect(response).to have_http_status(:ok)
  297. expect(json_response).to be_a(Hash)
  298. expect(json_response).to be_truthy
  299. expect(json_response['assets']['Ticket'][ticket1.id.to_s]).to be_truthy
  300. end
  301. it 'does find the ticket by state name even if the state name changes' do
  302. authenticated_as(agent)
  303. post '/api/v1/search/Ticket', params: { query: "number:#{ticket1.number} && state.name:ultrastate" }, as: :json
  304. expect(response).to have_http_status(:ok)
  305. expect(json_response).to be_a(Hash)
  306. expect(json_response).to be_truthy
  307. expect(json_response['assets']['Ticket']).to be_falsey
  308. expect(ticket1.state.name).not_to eq('ultrastate')
  309. ticket1.state.update(name: 'ultrastate')
  310. perform_enqueued_jobs
  311. SearchIndexBackend.refresh
  312. post '/api/v1/search/Ticket', params: { query: "number:#{ticket1.number} && state.name:ultrastate" }, as: :json
  313. expect(response).to have_http_status(:ok)
  314. expect(json_response).to be_a(Hash)
  315. expect(json_response).to be_truthy
  316. expect(json_response['assets']['Ticket'][ticket1.id.to_s]).to be_truthy
  317. end
  318. it 'does find the ticket by priority name even if the priority name changes' do
  319. authenticated_as(agent)
  320. post '/api/v1/search/Ticket', params: { query: "number:#{ticket1.number} && priority.name:ultrapriority" }, as: :json
  321. expect(response).to have_http_status(:ok)
  322. expect(json_response).to be_a(Hash)
  323. expect(json_response).to be_truthy
  324. expect(json_response['assets']['Ticket']).to be_falsey
  325. expect(ticket1.priority.name).not_to eq('ultrapriority')
  326. ticket1.priority.update(name: 'ultrapriority')
  327. perform_enqueued_jobs
  328. SearchIndexBackend.refresh
  329. post '/api/v1/search/Ticket', params: { query: "number:#{ticket1.number} && priority.name:ultrapriority" }, as: :json
  330. expect(response).to have_http_status(:ok)
  331. expect(json_response).to be_a(Hash)
  332. expect(json_response).to be_truthy
  333. expect(json_response['assets']['Ticket'][ticket1.id.to_s]).to be_truthy
  334. end
  335. it 'does find the ticket by the checklist name', current_user_id: 1 do
  336. authenticated_as(agent)
  337. ticket1.create_checklist! name: 'chcklst name'
  338. perform_enqueued_jobs
  339. SearchIndexBackend.refresh
  340. post '/api/v1/search/Ticket', params: { query: 'chcklst' }, as: :json
  341. expect(response).to have_http_status(:ok)
  342. expect(json_response).to be_a(Hash)
  343. expect(json_response).to be_truthy
  344. expect(json_response['assets']['Ticket'][ticket1.id.to_s]).to be_truthy
  345. end
  346. it 'does find the ticket by a checklist entry', current_user_id: 1 do
  347. authenticated_as(agent)
  348. ticket1.create_checklist!
  349. ticket1.checklist.items.create! text: 'checklist entry'
  350. perform_enqueued_jobs
  351. SearchIndexBackend.refresh
  352. post '/api/v1/search/Ticket', params: { query: 'checklist entry' }, as: :json
  353. expect(response).to have_http_status(:ok)
  354. expect(json_response).to be_a(Hash)
  355. expect(json_response).to be_truthy
  356. expect(json_response['assets']['Ticket'][ticket1.id.to_s]).to be_truthy
  357. end
  358. end
  359. describe 'Assign user to multiple organizations #1573' do
  360. shared_examples 'search for organization ids' do
  361. context 'when customer with multi organizations', authenticated_as: :customer do
  362. context 'with multi organizations' do
  363. let(:customer) { create(:customer, organization: organizations[0], organizations: organizations[1..2]) }
  364. let(:organizations) { create_list(:organization, 5) }
  365. it 'does not return organizations which are not allowed' do
  366. params = {
  367. query: 'TestOrganization',
  368. limit: 10,
  369. }
  370. post '/api/v1/search/Organization', params: params, as: :json
  371. expect(json_response['result']).to include({ 'id' => organizations[0].id, 'type' => 'Organization' })
  372. expect(json_response['result']).to include({ 'id' => organizations[1].id, 'type' => 'Organization' })
  373. expect(json_response['result']).to include({ 'id' => organizations[2].id, 'type' => 'Organization' })
  374. expect(json_response['result']).not_to include({ 'id' => organizations[3].id, 'type' => 'Organization' })
  375. expect(json_response['result']).not_to include({ 'id' => organizations[4].id, 'type' => 'Organization' })
  376. end
  377. it 'does not return organizations which are not allowed when overwritten' do
  378. params = {
  379. query: 'TestOrganization',
  380. limit: 10,
  381. ids: organizations.map(&:id)
  382. }
  383. post '/api/v1/search/Organization', params: params, as: :json
  384. expect(json_response['result']).to include({ 'id' => organizations[0].id, 'type' => 'Organization' })
  385. expect(json_response['result']).to include({ 'id' => organizations[1].id, 'type' => 'Organization' })
  386. expect(json_response['result']).to include({ 'id' => organizations[2].id, 'type' => 'Organization' })
  387. expect(json_response['result']).not_to include({ 'id' => organizations[3].id, 'type' => 'Organization' })
  388. expect(json_response['result']).not_to include({ 'id' => organizations[4].id, 'type' => 'Organization' })
  389. end
  390. end
  391. context 'with single organization' do
  392. let(:customer) { create(:customer, organization: organizations[0]) }
  393. let(:organizations) { create_list(:organization, 5) }
  394. it 'does not return organizations which are not allowed' do
  395. params = {
  396. query: 'TestOrganization',
  397. limit: 10,
  398. }
  399. post '/api/v1/search/Organization', params: params, as: :json
  400. expect(json_response['result']).to include({ 'id' => organizations[0].id, 'type' => 'Organization' })
  401. expect(json_response['result']).not_to include({ 'id' => organizations[1].id, 'type' => 'Organization' })
  402. expect(json_response['result']).not_to include({ 'id' => organizations[2].id, 'type' => 'Organization' })
  403. expect(json_response['result']).not_to include({ 'id' => organizations[3].id, 'type' => 'Organization' })
  404. expect(json_response['result']).not_to include({ 'id' => organizations[4].id, 'type' => 'Organization' })
  405. end
  406. it 'does not return organizations which are not allowed when overwritten' do
  407. params = {
  408. query: 'TestOrganization',
  409. limit: 10,
  410. ids: organizations.map(&:id)
  411. }
  412. post '/api/v1/search/Organization', params: params, as: :json
  413. expect(json_response['result']).to include({ 'id' => organizations[0].id, 'type' => 'Organization' })
  414. expect(json_response['result']).not_to include({ 'id' => organizations[1].id, 'type' => 'Organization' })
  415. expect(json_response['result']).not_to include({ 'id' => organizations[2].id, 'type' => 'Organization' })
  416. expect(json_response['result']).not_to include({ 'id' => organizations[3].id, 'type' => 'Organization' })
  417. expect(json_response['result']).not_to include({ 'id' => organizations[4].id, 'type' => 'Organization' })
  418. end
  419. end
  420. context 'with no organization' do
  421. let(:customer) do
  422. organizations
  423. create(:customer)
  424. end
  425. let(:organizations) { create_list(:organization, 5) }
  426. it 'does not return organizations which are not allowed' do
  427. params = {
  428. query: 'TestOrganization',
  429. limit: 10,
  430. }
  431. post '/api/v1/search/Organization', params: params, as: :json
  432. expect(json_response['result']).not_to include({ 'id' => organizations[0].id, 'type' => 'Organization' })
  433. expect(json_response['result']).not_to include({ 'id' => organizations[1].id, 'type' => 'Organization' })
  434. expect(json_response['result']).not_to include({ 'id' => organizations[2].id, 'type' => 'Organization' })
  435. expect(json_response['result']).not_to include({ 'id' => organizations[3].id, 'type' => 'Organization' })
  436. expect(json_response['result']).not_to include({ 'id' => organizations[4].id, 'type' => 'Organization' })
  437. end
  438. it 'does not return organizations which are not allowed when overwritten' do
  439. params = {
  440. query: 'TestOrganization',
  441. limit: 10,
  442. ids: organizations.map(&:id)
  443. }
  444. post '/api/v1/search/Organization', params: params, as: :json
  445. expect(json_response['result']).not_to include({ 'id' => organizations[0].id, 'type' => 'Organization' })
  446. expect(json_response['result']).not_to include({ 'id' => organizations[1].id, 'type' => 'Organization' })
  447. expect(json_response['result']).not_to include({ 'id' => organizations[2].id, 'type' => 'Organization' })
  448. expect(json_response['result']).not_to include({ 'id' => organizations[3].id, 'type' => 'Organization' })
  449. expect(json_response['result']).not_to include({ 'id' => organizations[4].id, 'type' => 'Organization' })
  450. end
  451. end
  452. end
  453. it 'does return all organizations' do
  454. params = {
  455. query: 'Rest',
  456. limit: 10,
  457. }
  458. authenticated_as(admin)
  459. post '/api/v1/search/Organization', params: params, as: :json
  460. expect(json_response['result']).to include({ 'id' => organization1.id, 'type' => 'Organization' })
  461. expect(json_response['result']).to include({ 'id' => organization2.id, 'type' => 'Organization' })
  462. expect(json_response['result']).to include({ 'id' => organization3.id, 'type' => 'Organization' })
  463. end
  464. it 'does return organization specific ids' do
  465. params = {
  466. query: 'Rest',
  467. ids: [organization1.id],
  468. limit: 10,
  469. }
  470. authenticated_as(admin)
  471. post '/api/v1/search/Organization', params: params, as: :json
  472. expect(json_response['result']).to include({ 'id' => organization1.id, 'type' => 'Organization' })
  473. expect(json_response['result']).not_to include({ 'id' => organization2.id, 'type' => 'Organization' })
  474. expect(json_response['result']).not_to include({ 'id' => organization3.id, 'type' => 'Organization' })
  475. end
  476. end
  477. context 'with elasticsearch', searchindex: true do
  478. before do
  479. searchindex_model_reload([Ticket, User, Organization])
  480. end
  481. include_examples 'search for organization ids'
  482. end
  483. context 'with db only', searchindex: false do
  484. before do
  485. Setting.set('es_url', nil)
  486. end
  487. include_examples 'search for organization ids'
  488. end
  489. end
  490. end