Sunspot 검색에서 '또는'를 어떻게 사용할 수 있습니까? 내 코드에서또는/|| in Sunspot 검색
나는
with(:location_id, current_user.location.path_ids || current_user.location.parent.descendant_ids)
검색은 첫 번째 부분을 평가 있습니다.
'current_user.location.path_ids'를 먼저 입력하면 (|| 이전), 그 검색 결과로 얻은 레코드 만 가져옵니다. 'current_user.location.parent.descendant_ids'를 먼저 입력하면 검색 결과가 표시됩니다. 나는 둘 다 결과를 원해.
나는 또한 당신이 내 질문을 이해 바랍니다
with(:location_id, current_user.location.path_ids || :location_id, current_user.location.parent.descendant_ids)
을 시도했습니다.
감사합니다! 나는 또한 두 배열을 + 대신에 +로 병합 할 수 있다는 것을 알았다. –