On 25 Aug 2009, at 11:46, Manik Surtani wrote:


On 25 Aug 2009, at 11:09, Emmanuel Bernard wrote:


On 25 août 09, at 11:33, Manik Surtani wrote:


CacheQuery cq = new QueryFactory(cache).getQuery("fieldName",
"stuffToSearchFor");

Looks good.  But I think we should also support Lucene queries
directly, as they provide a richer set of searchable terms and
constraints.  Or perhaps impls like BooleanQuery to combine queries.

E.g.:

Query luceneQuery = createComplexLuceneQuery();
CacheQuery cq = new QueryFactory(cache).getQuery(luceneQuery);

See:

http://lucene.apache.org/java/2_4_1/api/core/org/apache/lucene/search/Query.html

It's a fine line to add "easy" query object factory methods:
- this single term query is often not enough
- even when it is, are you doing a TermQuery, a FuzzyTermQuery
(which fuzzy factor), a PrefixQuery or even why not a RangeQuery?

where are you going to draw the line? I would rather see some DSL to
build Lucene queries which I would like to work on for HSearch as soon
as free time comes by.

Aren't there standards around this already?

If you're talking about API methods here then I believe that HS deals with any type of Lucene query.

The issue with doing something like: - 

CacheQuery cq = new QueryFactory(cache).getQuery(luceneQuery);

is that to create a lucene query then you need to do the work of creating up a QueryParser and stuff like that. This is the bit that I'd like to avoid.

Is it too round-about / tricky / yucky if we the user is to provide the specific class of the query? Or is that what you were suggesting anyway Manik?

e.g.: - 
CacheQuery cq = new QueryFactory(cache).getQuery(org.apache.lucene.query.BooleanQuery.class);

If I'm completely off topic and talking rubbish then just ignore :). 




--
Manik Surtani
manik@jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org





_______________________________________________
infinispan-dev mailing list
infinispan-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/infinispan-dev

Navin Surtani

Intern Infinispan
Intern JBoss Cache Searchable