net.sourceforge.sconman
Class Query

java.lang.Object
  extended by net.sourceforge.sconman.Query

public class Query
extends java.lang.Object

Queryrepresents queries over the content store. Use its methods to build complex queries.

Author:
mballesteros

Field Summary
(package private) static org.apache.lucene.analysis.Analyzer analyzer
          The query analyzer
 
Constructor Summary
Query()
          Builds an empty query
Query(java.lang.String query)
          Builds a query from a Lucene query expression
 
Method Summary
 Query andAuthorEquals(User author)
          The contents MUST be owned by the specified user
 Query andBelowCategory(Category category)
          The content MUST be below the specified category
 Query andBelowCategoryIn(Category[] cats)
          The content MUST be below the specified categories
 Query andCategoryEquals(Category cat)
          The contents MUST be in the specified category
 Query andCategoryIn(Category[] cats)
          The contents MUST be among the specified categories
 Query andContentTypeEquals(ContentType ctype)
          The contents MUST be of the specified type
 Query andContentTypeIn(ContentType[] ctypes)
          The contents MUST be among the specified content types
 Query andFieldEquals(java.lang.String field, java.lang.String value)
          The field MUST have the specified value
 Query andFieldInRange(java.lang.String field, java.util.Date from, java.util.Date to, boolean included)
          The content MUST have a date field in the given range
 Query andFieldInRange(java.lang.String field, java.lang.String from, java.lang.String to, boolean included)
          The content MUST have a field in the given range
 Query andFieldMatches(java.lang.String field, java.lang.String value)
          The field can have any word of value
 Query andNotBelowCategory(Category category)
          The content MUST be below the specified category
(package private)  org.apache.lucene.search.BooleanQuery getLuceneQuery()
          Returns the internal Lucene query
 Query orFieldEquals(java.lang.String field, java.lang.String value)
          The field COULD have the specified value
(package private) static org.apache.lucene.search.Query parseQuery(java.lang.String query)
          Parses a user query String
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

analyzer

static final org.apache.lucene.analysis.Analyzer analyzer
The query analyzer

Constructor Detail

Query

public Query()
Builds an empty query


Query

public Query(java.lang.String query)
Builds a query from a Lucene query expression

Parameters:
query - The Lucene query
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getLuceneQuery

org.apache.lucene.search.BooleanQuery getLuceneQuery()
Returns the internal Lucene query

Returns:

andCategoryEquals

public Query andCategoryEquals(Category cat)
The contents MUST be in the specified category

Parameters:
cat - The category where the contents MUST be

andAuthorEquals

public Query andAuthorEquals(User author)
The contents MUST be owned by the specified user

Parameters:
author - The contents author

andBelowCategory

public Query andBelowCategory(Category category)
The content MUST be below the specified category

Parameters:
category -

andBelowCategoryIn

public Query andBelowCategoryIn(Category[] cats)
The content MUST be below the specified categories

Parameters:
cats - The category list where the contents MUST be among

andNotBelowCategory

public Query andNotBelowCategory(Category category)
The content MUST be below the specified category

Parameters:
category -

andCategoryIn

public Query andCategoryIn(Category[] cats)
The contents MUST be among the specified categories

Parameters:
cats - The category list where the contents MUST be among

andContentTypeEquals

public Query andContentTypeEquals(ContentType ctype)
The contents MUST be of the specified type

Parameters:
ctype - The content type the content MUST be

andContentTypeIn

public Query andContentTypeIn(ContentType[] ctypes)
The contents MUST be among the specified content types

Parameters:
cats - The content type list where the contents MUST be among

andFieldEquals

public Query andFieldEquals(java.lang.String field,
                            java.lang.String value)
The field MUST have the specified value

Parameters:
field - The field to constraint
value - The value that the field MUST have

orFieldEquals

public Query orFieldEquals(java.lang.String field,
                           java.lang.String value)
The field COULD have the specified value

Parameters:
field - The field to constraint
value - The value that the field COULD have

andFieldInRange

public Query andFieldInRange(java.lang.String field,
                             java.lang.String from,
                             java.lang.String to,
                             boolean included)
The content MUST have a field in the given range

Parameters:
field - The field to constraint
from - The lower bound
to - The upper bound
included - True to include bounds

andFieldInRange

public Query andFieldInRange(java.lang.String field,
                             java.util.Date from,
                             java.util.Date to,
                             boolean included)
The content MUST have a date field in the given range

Parameters:
field - The date field to constraint
from - The lower bound
to - The upper bound
included - True to include bounds

andFieldMatches

public Query andFieldMatches(java.lang.String field,
                             java.lang.String value)
The field can have any word of value

Parameters:
field - The field to constraint
value - The value that the field can have

parseQuery

static org.apache.lucene.search.Query parseQuery(java.lang.String query)
Parses a user query String

Parameters:
query - The user query
Returns:
The Lucene Query object


Copyright null null. All Rights Reserved.