org.infinispan.query
Class QueryFactory

java.lang.Object
  extended by org.infinispan.query.QueryFactory

public class QueryFactory
extends Object

Class that is used to build CacheQuery

Since:
4.0
Author:
Navin Surtani

Constructor Summary
QueryFactory(Cache cache, QueryHelper qh)
           
 
Method Summary
 CacheQuery getBasicQuery(String field, String search)
          This method is a basic query.
 CacheQuery getQuery(org.apache.lucene.search.Query luceneQuery, Class<?>... classes)
          This is a simple method that will just return a CacheQuery, filtered according to a set of classes passed in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryFactory

public QueryFactory(Cache cache,
                    QueryHelper qh)
Method Detail

getQuery

public CacheQuery getQuery(org.apache.lucene.search.Query luceneQuery,
                           Class<?>... classes)
This is a simple method that will just return a CacheQuery, filtered according to a set of classes passed in. If no classes are passed in, it is assumed that no type filtering is performed.

Parameters:
luceneQuery - - Query
classes - - only return results of type that matches this list of acceptable types
Returns:
the query object which can be used to iterate through results

getBasicQuery

public CacheQuery getBasicQuery(String field,
                                String search)
                         throws org.apache.lucene.queryParser.ParseException
This method is a basic query. The user provides 2 strings and internally the Query is built.

The first string is the field that they are searching and the second one is the search that they want to run.

For example: -

CacheQuery cq = new QueryFactory

The query is built by use of a QueryParser and a StandardAnalyzer

Parameters:
field - - the field on the class that you are searching
search - - the String that you want to be using to search
Returns:
CacheQuery result
Throws:
org.apache.lucene.queryParser.ParseException

Google Analytics

Copyright © 2011 JBoss, a division of Red Hat. All Rights Reserved.