outputStream.println("Displayed "+tot+" out of "+totalTerms+" terms in the index"); } catch (Exception e) {
Iterator iterator = c.iterator(); int tot = 0; int totalTerms = 0; ArrayList ats = new ArrayList(); while (iterator.hasNext()) { MailboxIndex.AdminInterface.TermInfo info = (MailboxIndex.AdminInterface.TermInfo)iterator.next(); String termText = info.mTerm.text();  if (termText.indexOf('@') > -1) { ats.add(termText); }  if (NumDigits(termText) <= 2) { if (termText.length() > 2 && !termText.equals("")) {  totalTerms++;   if (info.mFreq >= minNum) { if (tot < maxNum) { tot++;   int occurences = admin.countTermOccurences(LuceneFields.L_CONTENT, termText);        outputStream.println("" + info.mFreq + ": " + termText+" ("+occurences+")");   } } } } }      outputStream.println("Displayed "+tot+" out of "+totalTerms+" terms in the index"); } catch (Exception e) {
	public void dumpTerms(int mailboxId) throws IOException, ServiceException	{		outputStream.print("Field Name> ");		String field = inputReader.readLine();		if (field.equals("")) {			return;		}				outputStream.print("Min Frequency> ");		String min = inputReader.readLine();		outputStream.print("Max Frequency> ");		String max = inputReader.readLine();		int minNum=0,maxNum=100;		boolean constrain = false;		if (!min.equals("")) {			minNum = Integer.parseInt(min);			constrain = true;		}		if (!max.equals("")) { 			constrain = true;			maxNum = Integer.parseInt(max);		}		if (constrain) {			outputStream.println("Showing all terms with frequencies between "+minNum+" and "+maxNum);		}		//        MailboxIndex searcher = Indexer.GetInstance().getMailboxIndex(mailboxId);//        MailboxIndex searcher = Mailbox.getMailboxById(mailboxId).getMailboxIndex();                MailboxIndex.AdminInterface admin = null;						try {//			Collection c = new ArrayList();			Collection c = new TreeSet(new MailboxIndex.AdminInterface.TermInfo.FreqComparator());            Mailbox mbox = MailboxManager.getInstance().getMailboxById(mailboxId);            admin = mbox.getMailboxIndex().getAdminInterface();                        admin.enumerateTerms(c, field);            int numDocs = admin.numDocs();                        double minFlt = minNum / 10000.0;            double maxFlt = maxNum / 10000.0;            outputStream.println("minFlt = "+minFlt+" max="+maxFlt);                        double scaledMin = minFlt * numDocs;            double scaledMax = maxFlt * numDocs;			outputStream.println("Showing all terms with frequencies between "+scaledMin+" and "+scaledMax);			//			IndexReader reader = admin.getIndexReader();            			Iterator iterator = c.iterator();			int tot = 0;			int totalTerms = 0;			ArrayList ats = new ArrayList();			while (iterator.hasNext()) {				MailboxIndex.AdminInterface.TermInfo info = 					(MailboxIndex.AdminInterface.TermInfo)iterator.next();				String termText = info.mTerm.text();								if (termText.indexOf('@') > -1) {					ats.add(termText);				}								if (NumDigits(termText) <= 2) {					if (termText.length() > 2 && !termText.equals("")) {												totalTerms++;												//				if ((info.mFreq >= scaledMin) && (info.mFreq<=scaledMax)) {						if (info.mFreq >= minNum) {							if (tot < maxNum) {								tot++;//				            	TermEnum e = reader.terms(new Term(LuceneFields.L_CONTENT, termText));//				            	int occurences = e.docFreq() - info.mFreq;								int occurences = admin.countTermOccurences(LuceneFields.L_CONTENT, termText);//				            	//				            	int low0 = 0; // 5//				            	int high0 = 99999; // 40//				            	int low = 0; // 5//				            	int high = 99999; // 75								//				            	if (info.mFreq > low0 && info.mFreq < high0 && occurences > low && occurences < high) {				            		outputStream.println("" + info.mFreq + ": " + termText+" ("+occurences+")");//				            	}															}						}					}				}			}//			outputStream.println("Ats list:");//			for (int i = 0; i <ats.size(); i++) {//				outputStream.println(ats.get(i).toString());//			}			outputStream.println("Displayed "+tot+" out of "+totalTerms+" terms in the index");		} catch (Exception e) {            outputStream.println("Caught "+ExceptionToString.ToString(e));		} finally {            if (admin!=null) {                admin.close();            }		}	}