2012-09-16 3 views
0

스트림 테이블에서 검색 결과를 가져올 때 반환되는 구성 요소 중 하나는 주석 배열입니다. 주석 배열의 주석 텍스트를 기반으로 검색하는 방법이 있는지 궁금합니다.FQL - 스트림에서 주석 배열 검색

내 검색어입니다. 어떤 방법에 대한 있는가 : 반환 된 행 중 하나에 대한

 

    SELECT post_id, attribution, message, description, comments.comment_list.text, likes, 
    place, permalink, message_tags, message, description_tags, type 
    FROM stream WHERE filter_key in 
    (SELECT filter_key FROM stream_filter WHERE uid=me()) 
    AND 
    (
    (strpos(lower(message), 'college football') >= 0) OR 
    (strpos(lower(description), 'college football') >= 0) OR 
    (strpos(lower(attribution), 'college football') >= 0) 
    ) 
    order by created_time desc 

comments.comment_list.text에게 결과는 다음과 같이 :

 

    "comments": { 
      "comment_list": [ 
      { 
       "text": "I love college football" 
      }, 
      { 
       "text": "Alabama and LSU rule college football" 
      } 
      ] 
    } 

내 질문은 그것은 현재의 형태에 잘 작동 나 또한 메시지, 설명속성 위와 같은 방법으로 comments.comment_list.text에서 검색 하시겠습니까? 나는 다음과 같은 무언가를 추가하려고 할 때 :

 

    (strpos(lower(comments.comment_list.text), 'college football') >= 0) 

나는 빈 데이터 집합을 (흥미롭게도, 내가 어떤 오류, 단지 빈 결과를 얻을하지 않습니다) 얻었다. 이유를 알 수 있습니다. 필자는 어떻게 든 주석 배열을 반복하고 텍스트를 검색하고 주석 텍스트를 비교할 수 있어야하기 때문입니다. 페이스 북 끝에서 FQL을 사용하여이 작업을 수행하고 싶습니다. 모든 결과를 가져 오지 않고 끝까지 반복하지 않으려합니다. 내가 어떻게 할 수 있을지에 대한 아이디어 나 제안?

미리 도움을 청하십시오!

답변

2

stream 테이블의 comments 필드는 주석의 하위 집합 만 검색합니다. 나는 한계가 5라고 생각한다. FQL에 의해 반환 된 배열을 통해 검색하는 것은 쉬운 것처럼 보인다. 그렇지 않습니다.

가장 좋은 방법은 이것을 멀티 쿼리로 변환하는 것입니다. 결과를 보려면 #combined 데이터 만보고 싶을 것입니다.

{'all_posts': 
    'SELECT post_id FROM stream WHERE filter_key in 
    (SELECT filter_key FROM stream_filter WHERE uid=me())', 
'commented': 
    'SELECT post_id FROM comment WHERE post_id IN (SELECT post_id FROM #all_posts) 
     AND (strpos(lower(text), 'college football') >= 0', 
'combined': 
    'SELECT post_id, attribution, message, description, comments.comment_list.text, likes, 
     place, permalink, message_tags, message, description_tags, type 
     FROM stream WHERE post_id IN (SELECT post_id FROM #all_posts) AND 
     (
     (strpos(lower(message), 'college football') >= 0) OR 
     (strpos(lower(description), 'college football') >= 0) OR 
     (strpos(lower(attribution), 'college football') >= 0) 
     ) 
    OR post_id IN (SELECT post_id FROM #commented) 
    order by created_time desc' 
}