1 Reply Latest reply: Jun 14, 2010 4:02 PM by frank.closheim RSS

    search by attributes in content DB

    776466
      Hello,

      We have an application that is using Content DB API's. We are trying to optimize our code so that the searching take less to run, as it currently takes a minute and a half to recover 15 documents.

      In many cases we have more than 1000 documents per folder can affect this?

      When the same searching is done manually on the tool the result is displayed in a few seconds but through the java API is very very slow.

      I am copying some code, is it possible that there is something misconfigured?

      int intNumMaxReg = 50

      nv = new NamedValue[] {
      ClientUtils.newNamedValue(Options.RETURN_COUNT, intNumMaxReg),
      ClientUtils.newNamedValue(Options.FOLDER_RESTRICTION, new Long(sandbox.getId())),
      ClientUtils.newNamedValue(Options.PRIMARY_SORT_ATTRIBUTE, Attributes.CREATE_DATE)
      };

      expr = new SearchExpression();                         
      expr.setLeftOperand("[" + cat + ":" + attr + "]");
      expr.setOperator(FdkConstants.OPERATOR_EQUAL);
      expr.setRightOperand(valor);

      requestedAttributes = new AttributeRequest[]
      {          
      ClientUtils.newAttributeRequest(Attributes.CREATED_BY),                                   
      ClientUtils.newAttributeRequest(Attributes.CREATE_DATE),                                   
      ClientUtils.newAttributeRequest(Attributes.CAPABILITIES),                                   
      ClientUtils.newAttributeRequest(Attributes.CATEGORIES, new AttributeRequest[] {                              ClientUtils.newAttributeRequest(Attributes.CUSTOM_ALL),
           ClientUtils.newAttributeRequest(Attributes.CATEGORY_CLASS, new AttributeRequest[] {
                ClientUtils.newAttributeRequest(Attributes.DISPLAY_NAME)     
           })),
      ClientUtils.newAttributeRequest(Attributes.CATEGORY_CONFIGURATION, new AttributeRequest[] {
                ClientUtils.newAttributeRequest(Attributes.REQUIRED_CATEGORIES)
      }),
      ClientUtils.newAttributeRequest(Attributes.URL)
      };


      //Right here is where it takes so long.
      resultAtrib = search.search(expr, nv, requestedAttributes);


      Any help would be greatly appreciated.

      Thank you

      Edited by: user3359705 on 01-jun-2010 7:52
        • 1. Re: search by attributes in content DB
          frank.closheim
          Hi,

          what do you mean with "When the same searching is done manually on the tool"? How do you execute the search manually? Do you have the SQL of your Search and execute this against the DB? Is this taking significantly longer?

          - What is the purpose of your search? Are you searching for documents only or including folders, links, etc?
          - Folder Restrictions are usually a bit more expensive. So if possible, you should try to eliminate those and use categories or security as your restriction factor.
          - Do you really need all the info per doc you requested below for each and every document right away? Or can you get the doc details on a separate call only if the user is interested in? It takes longer to collect all the info you requested, than just simple info, like name, URL, create_date, etc. Especially all the category info seems to me a bit overkill, without knowing how large are your categories are. Imagine that you get the info for all 1000 docs right away.
          - How large is your data cache?
          - What ServiceConfiguration are you using?
          - How many users do these kind of searches in peak hours?

          Regards,
          Frank