Package org.compass.core

Examples of org.compass.core.CompassQueryBuilder


    public List executeQuery (ObjectContext context, QuerySpecification spec)
    {
        CompassSession session = getCompass(context).openSession();
        CompassTransaction tr = session.beginTransaction();
        CompassQueryBuilder builder = session.queryBuilder();
        CompassQuery query = queryForPredicate(builder, spec.getPredicate());

        Class targetClass = ClassUtil.classForName(spec.getEntityName());
        query.setTypes(targetClass);
View Full Code Here


                        compassOperations.delete(iter.next());
                    }
                    return null;
                }
                CompassQuery query = null;
                CompassQueryBuilder queryBuilder = session.queryBuilder();
                if (args.length == 0) {
                    query = queryBuilder.matchAll();
                }
                if (clazz != null && ids.isEmpty()) {
                    query = queryBuilder.matchAll().setTypes(new Class[] {clazz});
                }
                if (query != null) {
                    compassOperations.delete(query);
                    return null;
                }
View Full Code Here

     * @param compassSession
     * @param clazzes
     * @return
     */
    public CompassQuery buildPolyClassQuery(CompassSession compassSession, Collection clazzes) {
        CompassQueryBuilder queryBuilder = compassSession.queryBuilder();
        CompassQueryBuilder.CompassBooleanQueryBuilder instanceBoolBuilder = queryBuilder.bool();
        for (Iterator iter = clazzes.iterator(); iter.hasNext(); ) {
            Class clz = (Class) iter.next();
            instanceBoolBuilder.addShould(
                queryBuilder.term("$/poly/class", clz.getName())
            );
        }
        return instanceBoolBuilder.toQuery();
    }
View Full Code Here

        String queryString = (String) query;
        if (escape) {
            queryString = CompassQueryParser.escape(queryString);
        }

        CompassQueryBuilder compassQueryBuilder = compassSession.queryBuilder();
        CompassQueryBuilder.ToCompassQuery stringBuilder;
        if (properties != null && !properties.isEmpty()) {
            stringBuilder = compassQueryBuilder.multiPropertyQueryString(queryString);
            for (Iterator iter = properties.iterator(); iter.hasNext(); ) {
                ((CompassQueryBuilder.CompassMultiPropertyQueryStringBuilder) stringBuilder).add((String) iter.next());
            }
        } else {
            stringBuilder = compassQueryBuilder.queryString(queryString);
        }

        if (analyzer != null) {
            InvokerHelper.invokeMethod(stringBuilder, "setAnalyzer", analyzer);
        }
View Full Code Here

TOP

Related Classes of org.compass.core.CompassQueryBuilder

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.