Package org.compass.core

Examples of org.compass.core.CompassHitsOperations


            if (searchString == null || searchString.equals("")) {
                return res;
            }

            final String[] aliases = { "school" };
            CompassHitsOperations schUserHits = getHits(searchString,
                    start, max_num_hits, aliases);

            final String[] aliases2 = { "schoolforumpost",
                    "userforumpost" };
            CompassHitsOperations forumPostHits = getHits(searchString,
                    start, max_num_hits, aliases2);

            addHitsToRes(res, schUserHits);
            addHitsToRes(res, forumPostHits);
View Full Code Here


    private CompassHitsOperations getHits(final String searchString,
            final int start, final int max_num_hits,
            final String[] aliases) {

        CompassHitsOperations hits = compassTemplate
                .executeFind(new CompassCallback() {
                    public Object doInCompass(CompassSession session)
                            throws CompassException {

                        CompassHits hits = session.queryBuilder()
                                .queryString(searchString).toQuery()
                                .setAliases(aliases).addSort(
                                        "searchOrder",
                                        SortPropertyType.INT,
                                        SortDirection.REVERSE).hits();

                        return hits.detach(start, max_num_hits);
                    }
                });
        log.debug("Search " + searchString + " alias "
                + ArrayUtils.toString(aliases) + " hits "
                + hits.getLength());
        return hits;
    }
View Full Code Here

TOP

Related Classes of org.compass.core.CompassHitsOperations

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.