StringBuffer emailStrBuf = new StringBuffer(); List emailList = contact.getEmailAddresses(); for (Iterator iter = emailList.iterator(); iter.hasNext();) { String cur = (String)(iter.next()); emailStrBuf.append(cur); emailStrBuf.append(' ');
StringBuilder searchText = new StringBuilder(); appendContactField(searchText, contact, Contact.A_company); appendContactField(searchText, contact, Contact.A_firstName); appendContactField(searchText, contact, Contact.A_lastName);  StringBuilder emailStrBuf = new StringBuilder(); List<String> emailList = contact.getEmailAddresses(); for (String cur : emailList) { emailStrBuf.append(cur).append(' ');
    public void indexContact(Mailbox mbox, IndexItem redo, boolean deleteFirst, int mailItemId, Contact contact)    throws ServiceException {        initAnalyzer(mbox);        synchronized(getLock()) {                    if (mLog.isDebugEnabled()) {                mLog.debug("indexContact("+contact+")");            }            try {                StringBuffer contentText = new StringBuffer();                Map m = contact.getFields();                for (Iterator it = m.values().iterator(); it.hasNext(); )                {                    String cur = (String)it.next();                    contentText.append(cur);                    contentText.append(' ');                }                if (deleteFirst) {                    try {                        deleteDocuments(new int[] { mailItemId });                    } catch (IOException e) {                        mLog.debug("indexContact ignored IOException deleting documents (index does not exist yet?)", e);                    }                }                Document doc = new Document();                String subj = contact.getFileAsString().toLowerCase();                String name = (subj.length() > DbMailItem.MAX_SENDER_LENGTH ? subj.substring(0, DbMailItem.MAX_SENDER_LENGTH) : subj);                StringBuffer emailStrBuf = new StringBuffer();                List emailList = contact.getEmailAddresses();                for (Iterator iter = emailList.iterator(); iter.hasNext();) {                    String cur = (String)(iter.next());                    emailStrBuf.append(cur);                    emailStrBuf.append(' ');                }                String emailStr = emailStrBuf.toString();                contentText.append(ZimbraAnalyzer.getAllTokensConcatenated(LuceneFields.L_H_TO, emailStr));                /* put the email addresses in the "To" field so they can be more easily searched */                doc.add(Field.UnStored(LuceneFields.L_H_TO, emailStr));                /* put the name in the "From" field */                doc.add(new Field(LuceneFields.L_H_FROM, name, false/*store*/, true/*index*/, false/*token*/ ));                doc.add(Field.UnStored(LuceneFields.L_CONTENT, contentText.toString()));                doc.add(Field.UnStored(LuceneFields.L_H_SUBJECT, subj));                doc.add(Field.Keyword(LuceneFields.L_MAILBOX_BLOB_ID, Integer.toString(mailItemId)));                doc.add(Field.Text(LuceneFields.L_PARTNAME, LuceneFields.L_PARTNAME_CONTACT));                doc.add(new Field(LuceneFields.L_SORT_SUBJECT, subj.toUpperCase(), true/*store*/, true/*index*/, false /*token*/));                doc.add(new Field(LuceneFields.L_SORT_NAME, name.toUpperCase(), false/*store*/, true/*index*/, false /*token*/));                addDocument(redo, doc, mailItemId, contact.getDate(), false);            } catch (IOException ioe) {                throw ServiceException.FAILURE("indexContact caught IOException", ioe);            }        }            }    