Package es.ipsa.atril.documentindexer

Examples of es.ipsa.atril.documentindexer.DocumentIndexer.query()


      if (sSearchStr.length()>0) {
        String sSanitizedSearchStr = Gadgets.removeChars(sSearchStr,"\"\n'");
        sQry += " AND (concept:\""+sSanitizedSearchStr+"\"* OR employee_name:\""+sSanitizedSearchStr+"\"* OR comments:\""+sSanitizedSearchStr+"\"*)";
      }
    }
    SortableList<Document> oLst = (SortableList<Document>) oIdx.query(sQry);
    if (!oLst.isEmpty()) {
      int o = 0, n = 0;
      for (Document d : oLst) {
        if (iOffset<=o++) {
          try {
View Full Code Here


        String sSanitizedSearchStr = Gadgets.removeChars(sSearchStr, "\"\n");
        sQry += " AND (ticket_number:\""+sSanitizedSearchStr +"\" OR concept:\""+sSanitizedSearchStr +"*\" OR comments:\""+sSanitizedSearchStr +"*\")";
      }
    }
    Log.out.debug("DocumentIndexer.query("+sQry+")");
    SortableList<Document> oLst = (SortableList<Document>) oIdx.query(sQry);
    if (!oLst.isEmpty()) {
      int o = 0, n = 0;
      for (Document d : oLst) {
        if (iOffset<=o++) {
          try {
View Full Code Here

        sQry += " AND (invoice_number:\""+sSanitizedSearchStr +"\" OR concept:\""+sSanitizedSearchStr +"*\" OR comments:\""+sSanitizedSearchStr +"*\")";
      }
    }
   
    Log.out.debug("DocumentIndexer.query("+sQry+")");
    SortableList<Document> oLst = (SortableList<Document>) oIdx.query(sQry);
    if (!oLst.isEmpty()) {
      int o = 0, n = 0;
      for (Document d : oLst) {
        if (iOffset<=o++) {
          try {
View Full Code Here

    DocumentIndexer oIdx = oSes.getDocumentIndexer();
    oIdx.setMaximumNumberOfDocumentReturned(1);
    String sQry = DocumentIndexer.AdditionalDocumentFields.DOCUMENT_TYPE_NAME.value() + ":" + getTypeName();
    for (NameValuePair oNvp : aNvp)
      sQry += " AND "+oNvp.getName()+"=\""+oNvp.getValue()+"\"";
    SortableList<Document> oLst = (SortableList<Document>) oIdx.query(sQry);
    if (oLst.isEmpty())
      return null;
    else
      return oLst.get(0);   
  }
View Full Code Here

 
  public static List<CustomerAccount> search(AtrilSession oSes, String sNameOrId) {
    DocumentIndexer oIdx = oSes.getDocumentIndexer();
    oIdx.setMaximumNumberOfDocumentReturned(50);
    String sSanitizedNameOrId = Gadgets.removeChars(sNameOrId, "\"*?").trim();
    SortableList<Document> oLst = (SortableList<Document>) oIdx.query("(business_name:\"" + sSanitizedNameOrId + "\" OR tax_id:\""+sNameOrId+"\") AND " + DocumentIndexer.AdditionalDocumentFields.DOCUMENT_TYPE_NAME.value() + ":" + "CustomerAccount");
    if (oLst.isEmpty()) {
      int i1stWord = sSanitizedNameOrId.indexOf(' ');
      if (i1stWord>0) sSanitizedNameOrId = sSanitizedNameOrId.substring(0, i1stWord);
      oLst = (SortableList<Document>) oIdx.query("(business_name:" + sNameOrId + "* AND " + DocumentIndexer.AdditionalDocumentFields.DOCUMENT_TYPE_NAME.value() + ":" + "CustomerAccount", "business_name");
      if (oLst.isEmpty()) {
View Full Code Here

    String sSanitizedNameOrId = Gadgets.removeChars(sNameOrId, "\"*?").trim();
    SortableList<Document> oLst = (SortableList<Document>) oIdx.query("(business_name:\"" + sSanitizedNameOrId + "\" OR tax_id:\""+sNameOrId+"\") AND " + DocumentIndexer.AdditionalDocumentFields.DOCUMENT_TYPE_NAME.value() + ":" + "CustomerAccount");
    if (oLst.isEmpty()) {
      int i1stWord = sSanitizedNameOrId.indexOf(' ');
      if (i1stWord>0) sSanitizedNameOrId = sSanitizedNameOrId.substring(0, i1stWord);
      oLst = (SortableList<Document>) oIdx.query("(business_name:" + sNameOrId + "* AND " + DocumentIndexer.AdditionalDocumentFields.DOCUMENT_TYPE_NAME.value() + ":" + "CustomerAccount", "business_name");
      if (oLst.isEmpty()) {
        oLst = (SortableList<Document>) oIdx.query("(business_name:" + sNameOrId + "~ AND " + DocumentIndexer.AdditionalDocumentFields.DOCUMENT_TYPE_NAME.value() + ":" + "CustomerAccount", "business_name");
      }
    }
    ArrayList aLst = new ArrayList();
View Full Code Here

    if (oLst.isEmpty()) {
      int i1stWord = sSanitizedNameOrId.indexOf(' ');
      if (i1stWord>0) sSanitizedNameOrId = sSanitizedNameOrId.substring(0, i1stWord);
      oLst = (SortableList<Document>) oIdx.query("(business_name:" + sNameOrId + "* AND " + DocumentIndexer.AdditionalDocumentFields.DOCUMENT_TYPE_NAME.value() + ":" + "CustomerAccount", "business_name");
      if (oLst.isEmpty()) {
        oLst = (SortableList<Document>) oIdx.query("(business_name:" + sNameOrId + "~ AND " + DocumentIndexer.AdditionalDocumentFields.DOCUMENT_TYPE_NAME.value() + ":" + "CustomerAccount", "business_name");
      }
    }
    ArrayList aLst = new ArrayList();
    for (Document d : oLst) {
      CustomerAccount oAcc = new CustomerAccount();
View Full Code Here

   
    DocumentIndexer oIdx = oSes.getDocumentIndexer();

    long lEnd, lStart = new Date().getTime();
   
    SortableList<Document> oLst = (SortableList<Document>) oIdx.query("business_name:\"" + sBusinessName + "\" AND " + DocumentIndexer.AdditionalDocumentFields.DOCUMENT_TYPE_NAME.value() + ":" + "CustomerAccount");
    if (!oLst.isEmpty()) throw new IllegalArgumentException(sBusinessName+" already exists");

    Log.out.debug("PROFILING: Search Business Name "+String.valueOf((lEnd=new Date().getTime())-lStart)+" ms");
    lStart = lEnd;
   
View Full Code Here

      if (sSearchStr.length()>0) {
        String sSanitizedSearchStr = Gadgets.removeChars(sSearchStr, "\"\n");
        sQry += " AND (ticket_number:\""+sSanitizedSearchStr +"\" OR concept:\""+sSanitizedSearchStr +"\" OR comments:\""+sSanitizedSearchStr +"\")";
      }
    }
    SortableList<Document> oLst = (SortableList<Document>) oIdx.query(sQry);
    if (!oLst.isEmpty()) {
      int o = 0, n = 0;
      for (Document d : oLst) {
        if (iOffset<=o++) {
          try {
View Full Code Here

  public BillNote forConcept(AtrilSession oSes, String sConcept, String sEmployeeUuid) {
    String sTaxPayerId = getDocument().parents().get(0).id();
    DocumentIndexer oIdx = oSes.getDocumentIndexer();
    final String sQry = "taxpayer:\""+sTaxPayerId+"\" AND employee_uuid:\""+sEmployeeUuid+"\" AND concept:\"" + Gadgets.removeChars(sConcept,"\"\n'")+ "\" AND " + DocumentIndexer.AdditionalDocumentFields.DOCUMENT_TYPE_NAME.value() + ":" + "BillNote";
    Log.out.debug("DocumentIndexer.query("+sQry+")");
    SortableList<Document> oLst = (SortableList<Document>) oIdx.query(sQry);
    if (oLst.isEmpty())
      return create(oSes, "", "basic", sTaxPayerId, sConcept, sEmployeeUuid);
    else
      return new BillNote(oSes.getDms().getDocument(oLst.get(0).id()));
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.