cancel
Showing results for 
Search instead for 
Did you mean: 

How to exceed Lucene Limit Search?

razieltd
Champ in-the-making
Champ in-the-making
Hi!

Is it possible with a ws java-backed research by lucene an unlimited number of nodes?
Now if i try to reseach in a store that contains 1100 nodes, the results list contains only 1000

I found this code:

SearchParameters sp = new SearchParameters();
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
sp.setQuery("PATH:\"/*\"");
sp.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
sp.setLimitBy(LimitBy.FINAL_SIZE);
sp.setLimit(1100);
rs=searchService.query(sp);

but nothing… if i try with sp.setLimit(10); work and my result list length is 10 but if i try with any value more higher then 1000 dont work… Smiley Sad

why? Smiley Indifferent
20 REPLIES 20

mrogers
Star Contributor
Star Contributor
Because the number of permission checks and the time to search are also limited.  You will find other threads discussing how to change this if you search these forums.

razieltd
Champ in-the-making
Champ in-the-making
Thank you for the answare. But can i ask you a favor? can you post me some of these threads? Because when iam searching i found only solution that dont work (probably i did not understand  :roll: ).

Now iam trying to implement in my webscript (java-baked) something like this


         int batchSize = 10;
         QueryConfiguration queryCfg = new QueryConfiguration();
         queryCfg.setFetchSize(batchSize);
         RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();
         repositoryService.setHeader(new RepositoryServiceLocator().getServiceName().getNamespaceURI(), "QueryHeader", queryCfg);
         Query query=new Query(SearchService.LANGUAGE_LUCENE,"PATH:\"/*\"");
         Store store=new Store();
         store.setScheme("archive");
         store.setAddress("SpacesStore");
         QueryResult result =repositoryService.query(store, query, true);
         //process the first query result
         String querySession = result.getQuerySession();
         while (querySession != null) {
             result = repositoryService.fetchMore(querySession);
             querySession = result.getQuerySession();
         }
         int size=(int)result.getResultSet().getTotalRowCount();

but dont work.

Thx a lot  Smiley Happy

razieltd
Champ in-the-making
Champ in-the-making
???  Smiley Indifferent  ???

darryl_staflund
Champ in-the-making
Champ in-the-making
Hi there,

Here is an example of how I disable this limit in Java:


package com.companyname.alfresco.common.daos.impl;

import static java.lang.String.format;

import java.util.List;

import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.LimitBy;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchParameters;
import org.alfresco.service.cmr.search.SearchService;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.stereotype.Component;

import com.companyname.alfresco.common.daos.SearchDao;

@Component
public final class SearchDaoImpl implements SearchDao {
   private SearchService searchService;

   @Required
   public void setSearchService(final SearchService service) {
      searchService = service;
   }

   @Override
   public List<NodeRef> searchForContentNode(final NodeRef nodeRef) {
      final SearchParameters params = getSearchParameters(nodeRef);

      ResultSet resultSet = null;

      try {
         resultSet = searchService.query(params);
         return resultSet.getNodeRefs();
      }

      finally {
         if (resultSet != null) {
            resultSet.close();
         }
      }
   }

   private SearchParameters getSearchParameters(final NodeRef nodeRef) {
      final SearchParameters params = new SearchParameters();
      params.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
      params.setLanguage(SearchService.LANGUAGE_LUCENE);
      params.setQuery(format(QUERY_PATTERN, ContentModel.TYPE_CONTENT, nodeRef));
      params.setLimitBy(LimitBy.UNLIMITED);
      params.setLimit(0);
      params.setMaxPermissionChecks(100000);
      params.setMaxPermissionCheckTimeMillis(100000);
      params.setMaxItems(-1);
      return params;
   }
}



I hope it's helpful.

Darryl

razieltd
Champ in-the-making
Champ in-the-making
Thank you so much!  Smiley Very Happy

but when i try to implement this code i receive this exception in my ws


Message:   org.alfresco.service.cmr.search.SearchParameters.setMaxPermissionChecks(I)V
   
Exception:   java.lang.NoSuchMethodError - org.alfresco.service.cmr.search.SearchParameters.setMaxPermissionChecks(I)V


:shock:   :shock:   :shock:


what can i do?


EDIT:

i receive this exception with these 3 methods:
            …
         params.setMaxPermissionChecks(100000);
         params.setMaxPermissionCheckTimeMillis(100000);
         params.setMaxItems(-1);

:shock:

mrogers
Star Contributor
Star Contributor
What version are you using?

razieltd
Champ in-the-making
Champ in-the-making
Alfresco 3.1

razieltd
Champ in-the-making
Champ in-the-making
No solutions for this problem?  Smiley Sad  There is another method that can i use for bypass the limit?

Thx  :?

razieltd
Champ in-the-making
Champ in-the-making
Ehmmm… someone have the solution? or another way for this?

Thx