Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-9319

Returning the count of nodes based on search query

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: oak-search, query
    • Labels:
      None

      Description

      Is there a way to return the count of nodes for a given search query having different filtering clauses in a way, mimicking what we are able to do in an RDBMS query for eg., select count from table_name where <condition> <and/or> <condition>;

       

      Can this be replicated in OAK without having to fetch all nodes in memory and calculating the count of all nodes? 

       

      What the use case is to draw pagination.

      Let say, we are searching for 10(limit) nodes at a time. For that we use setLimit() and setOffset() on the query object.

      Also, we need the count of all nodes for that particular query to draw up the pages on front-end. For that, we have to make another search without the limit and offset, fetching all the nodes in memory and then making the count. 

      But what it seems is, fetching all nodes takes up a lot of time ~ 1 min on the server (depending upon the size of nodes. ~ 1 min for ~10K nodes). Instead of that, if we are directly able to query to return the count of nodes that will prove beneficial and quicker way.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              vishnuaggarwal23 Vishnu Aggarwal
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: