Package org.apache.james.mailbox.SearchQuery

Examples of org.apache.james.mailbox.SearchQuery.DateOperator


     * @param crit
     * @return query
     * @throws UnsupportedSearchException
     */
    private Query createInternalDateQuery(SearchQuery.InternalDateCriterion crit) throws UnsupportedSearchException {
        DateOperator dop = crit.getOperator();
        DateResolution res = dop.getDateResultion();
        String field = toInteralDateField(res);
        return createQuery(field, dop);
    }
View Full Code Here


            ContainsOperator cop = (ContainsOperator) op;
            return createTermQuery(fieldName, cop.getValue().toUpperCase(Locale.ENGLISH));
        } else if (op instanceof SearchQuery.ExistsOperator){
            return new PrefixQuery(new Term(fieldName, ""));
        } else if (op instanceof SearchQuery.DateOperator) {
                DateOperator dop = (DateOperator) op;
                String field = toSentDateField(dop.getDateResultion());
                return createQuery(field, dop);
        } else if (op instanceof SearchQuery.AddressOperator) {
            String field = name.toLowerCase(Locale.ENGLISH);
            return createTermQuery(field, ((SearchQuery.AddressOperator) op).getAddress().toUpperCase(Locale.ENGLISH));
        } else {
View Full Code Here

     * @param crit
     * @return query
     * @throws UnsupportedSearchException
     */
    public static Query createInternalDateQuery(SearchQuery.InternalDateCriterion crit) throws UnsupportedSearchException {
        DateOperator op = crit.getOperator();
        DateResolution res = op.getDateResultion();
        Date date = op.getDate();
        long value = DateUtils.truncate(date, SearchQuery.toCalendarType(res)).getTime();
        String field = toInteralDateField(res);
       
        switch(op.getType()) {
        case ON:
            return NumericRangeQuery.newLongRange(field ,value, value, true, true);
        case BEFORE:
            return NumericRangeQuery.newLongRange(field ,0L, value, true, false);
        case AFTER:
View Full Code Here

TOP

Related Classes of org.apache.james.mailbox.SearchQuery.DateOperator

Copyright © 2018 www.massapicom. 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.