« Back to Document Library...

SQL Query Limits and the Document Library

<< TableOfContents>>

Introduction #

In order for searches in the Document Library to work, the SQL clause count must equal AT LEAST as many folders as you have in your Document Library.

Background #

If you don't ensure this is true, then you may find that documents can be found with a search that is conducted from within a lower-level folder in the Document Library, but the same search will fail to find those same documents, when it is conducted from a higher folder level.

This is because each folder is added to your SQL query. Therefore, if a search is made from within lower levels in the Document Library's folder hierarchy, the search may succeed because the numbers of folders at that level and below was less than the maximum clause count. But if the same search is performed from higher levels in the Document Library, then the search may fail because there are more folders to be searched through, from that higher level -- there are more folders beneath it, after all.

If you have search problems of this sort, modify the Lucene BooleanQueryImpl() method to reset the maximum clause count to a higher number -- the clause count should be at least as high as the number of folders found in the Document Library:

public class BooleanQueryImpl implements Boolean Query { public BooleanQueryImpl() { _booleanQuery = new org.apache.lucene.search.BooleanQuery(); _booleanQuery.setMaxClauseCount(8000); } <...> }

0 Attachments
12202 Views
Average (0 Votes)
The average rating is 0.0 stars out of 5.
Comments
Threaded Replies Author Date
In LuceneIndexSearcherImpl (Liferay 6.0 EE)... Bruce Altner April 29, 2011 10:13 AM
I'm using Liferay 6.0.6 CE and I believe to... lou cat November 16, 2012 3:24 AM
Note: it seems my version is catching the... lou cat November 16, 2012 3:53 AM

In LuceneIndexSearcherImpl (Liferay 6.0 EE) this is handled by catching the BooleanQuery.TooManyClauses exception, then setting the limit to Integer.MAX_VALUE and rerunning the query. So this is probably OBE?
Posted on 4/29/11 10:13 AM.
I'm using Liferay 6.0.6 CE and I believe to have this problem (when I try to select a root folder from the configuration of DL display, I'm not able to see more than the first 20 folders).

Please can you explain better what is the best practice to modify that class? It seems part of liferay kernel and I'd like not to mess up everything emoticon

I've also created a thread in the forum, if you prefer that:
http://www.liferay.com/community/forums/-/message_boards/message/17956366
Posted on 11/16/12 3:24 AM in reply to Bruce Altner.
Note: it seems my version is catching the BooleanQuery.TooManyClauses exception... so or this is not related to my problem, or the exception doesn't solve the issue emoticon
Posted on 11/16/12 3:53 AM in reply to lou cat.