In my web service, I want my web-app to show nodes list with pagination.
So, I need total count for some afts query.
when I query using Alfresco Rest API(api/-default-/public/search/versions/1/search), getting a result consumes pretty long time (approximately 3 seconds for 2000 nodes. and this would be increased linearly).
I wanted to decrease query time(just get count of query result). and I have tried some ways to solve this problem.
1. when I query using Alfresco admin console(node-browser), I could get count(with results) very faster than what i did So, I copied that HTTP request then request exactly same. But I could not get the result what i want. That HTTP response included some javascript codes.
2. I have accessed Alfresco's DB(postgreSQL). But I could not translate afts query to postgreSQL query...
3. I have queried to Alfresco's Solr. I could get query count very fast but the result was different with Alfresco Rest API.
Is there any way to get count of query in very short time??
Thanks.
You should be able to get a fast count by simply just asking for very few items in the search and using the totalItems element from the pagination data as the total number of results. Effectively you might want to call the operation twice - once for the fast count and another time for the actual data.
The amount of time to query for 2000 items is not necessarily representative for other cases. For one, if this was the first time any / a majority of these 2000 items were accessed / read then the duration is primarily due to load their data into memory caches. Doing the same search again could be well within sub-second speed. Also the level of maintenance / configuration of the database may be a significant factor here. If you are using the PostgreSQL server as it was installed by the default installer than bear in mind that it is not configured for production-grade use with larger amounts of data (e.g. its memory / shared_buffers is set to a measly 128 MiB).
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.