cancel
Showing results for 
Search instead for 
Did you mean: 

search result limits

darionis
Champ on-the-rise
Champ on-the-rise
Hello,

is it possible to perform a search without imposing "permission evaluation" limitations. By default, alfresco will not return more than 1000 results. I can raise the limits but in some situations, like reporting and analytics, I don't actually care about permission evaluations and I want ALL the results. Is it possible?

For example, customer is interested how many documents does she have in the repository. I would like to perform a search and get the title of every document. For this use case, permission evaluation is not essential, is there any way to turn it of for a single query? If not, is there any other alternative?

Thanks!
6 REPLIES 6

romschn
Star Collaborator
Star Collaborator
In your custom code, if you execute the query with system user then it avoids permission checks and return all the results.

darionis
Champ on-the-rise
Champ on-the-rise
<blockquote>
if you execute the query with system user then it avoids permission checks and return all the results.
</blockquote>

I created web script that runs as system user:
<authentication runas="system">user</authentication>
. It simply omits some search results, 'admin' user returns more results. Interestingly, results that system user omits, come from folders with permissions inheritance turned off and permissions explicitly set.

I hoped system user does not evaluate permissions and returns absolutely everything, but it does not appear to be so?

romschn
Star Collaborator
Star Collaborator
Using runas in this way only works for web scripts that are loaded from the classpath. For security reasons, it will not work for web scripts uploaded to the repository.

Instead of putting the entry in desc xml, you can try it as below as well -
In your java controller class you can use
AuthenticationUtil.setRunAsUserSystem(); 
perform your logic and then
AuthenticationUtil.clearCurrentSecurityContext();

mrogers
Star Contributor
Star Contributor
That's probably an inappropriate approach.   You will either run out of memory, time or other resources.     And there are documents which are not in the full text search index.

Alfresco Enterprise already reports things like number of documents.  It does this be either an approximation which is the max docid.   Or a canned sql query.   

darionis
Champ on-the-rise
Champ on-the-rise
Thank you guys,

suggestion to use "system" user sounds good. I saw "canned query" term on Alfresco wiki but couldn't find any documentation. Is there any docs about "canned queries"? Is it like  stored procedure?

Thing is that I am having hard time producing reports from alfresco. That involves queries that return lots and lots of results (simple property queries, no full text search). Returning 50000 rows from relational database is not uncommon, so I hoped I can do the same with alfresco if I turn off permission checks or anything that may affect search performance.

Thanks!

kaynezhang
World-Class Innovator
World-Class Innovator
Alfresco 4.0 is using mybatis(ibatis) and moving some core queries to the datbase layer. this can offer better performance .
canned query are just used to encapsulate some functions(for example pageing result ,filter result),canned query is implementated by org.mybatis.spring.SqlSessionTemplate.It is a wrapper of SqlSessionTemplate.

If you just want to create report ,I suggest you use some alfresco report add on,for example
https://code.google.com/p/alfresco-business-reporting/.