Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8833365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:45:46+00:00 2026-06-14T08:45:46+00:00

I have a timeline type query that retrieves posts and athe users who have

  • 0

I have a timeline type query that retrieves posts and athe users who have ‘liked’ a post.

START me=node:node_auto_index(UserIdentifier='USER0')
MATCH me-[rels:FOLLOWS*0..1]-myfriend
WITH myfriend
MATCH myfriend-[:POSTED*]-statusupdates<-[r?:LIKE]-likers
WHERE myfriend <> statusupdates
RETURN distinct statusupdates, FILTER (x in collect(distinct likers) : x <> null), myfriend
ORDER BY statusupdates.PostTime DESC
LIMIT 25; 

I limit the number of posts that I retrieve to 25. I would also like to limit the number of users who have liked a post. Is there a way to use multiple limit clauses in a query? Ideally I would like to do something like the following:

START me=node:node_auto_index(UserIdentifier='USER0')
MATCH me-[rels:FOLLOWS*0..1]-myfriend
WITH myfriendMATCH myfriend-[:POSTED*]-statusupdates<-[r?:LIKE]-likers
WHERE myfriend <> statusupdates
RETURN distinct statusupdates, LIMIT FILTER (x in collect(distinct likers) : x <> null) 6, myfriend
ORDER BY statusupdates.PostTime DESC
LIMIT 25; 

Or:

START me=node:node_auto_index(UserIdentifier='USER0')
MATCH me-[rels:FOLLOWS*0..1]-myfriend
WITH myfriendMATCH myfriend-[:POSTED*]-statusupdates<-[r?:LIKE]-likers
WHERE myfriend <> statusupdates
RETURN distinct statusupdates, FILTER (x in collect(distinct likers) : x <> null), myfriend
LIMIT likers 6
ORDER BY statusupdates.PostTime DESC
LIMIT 25; 

Which would limit the number of returned likers for each post to 6. How can I achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:45:47+00:00Added an answer on June 14, 2026 at 8:45 am

    The trouble with limiting likers is that it’s on the other end of the query, so there’s no way to optimize that. You basically have to do two matches. Also, the LIMIT after the WITH is only available in 1.9.M01

    So, I think this sort of does what you want:

    START me=node:node_auto_index(UserIdentifier='USER0')
    MATCH me-[rels:FOLLOWS*0..1]-myfriend-[:POSTED*]-statusupdates<-[r?:LIKE]-likers
    WITH distinct likers
    // you can also order by something here, if you want.
    LIMIT 6
    START me=node:node_auto_index(UserIdentifier='USER0')
    // at this point, likers is already bound, so it's limited to the 6
    MATCH me-[rels:FOLLOWS*0..1]-myfriend-[:POSTED*]-statusupdates<-[r?:LIKE]-likers
    RETURN distinct statusupdates, likers, myfriend
    ORDER BY statusupdates.postTime
    LIMIT 25;
    

    Untested code. Hope it works–next time build us a sample in console so we can play around. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem when posting video through my app on users with TimeLine
I am using the PHP SDK to post to the logged in users timeline
I have a piece of art I made on the timeline that I want
I have a Facebook App & a Facebook Page (with Facebook Timeline enabled). The
I am having a problem with the Google annotated timeline. I have this function
Basically, I have a JSON response from the Twitter API containing a timeline. I
I have a timeline with little pins on it which when hovered over, slide
i am using the javascript simile timeline have a timeline items with very large
I am trying to do a timeline. The timeline have few dynamically keyframe elements
I have the following models. class Post < ActiveRecord::Base has_many :timeline_items, :as=>:subject define_index do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.