org.openanzo.model.indexer.lucene
Class ModelIndexQuery

java.lang.Object
  extended by org.openanzo.indexer.lucene.LuceneQuery
      extended by org.openanzo.model.indexer.lucene.ModelIndexQuery
All Implemented Interfaces:
IQuery

public class ModelIndexQuery
extends LuceneQuery

Adds a date filter to the query. This stuff should be in another class since it's not indexer-specific. A date range should be specified as part of the query string. It will have the following format: http://openanzo.orgified:date_expression The date expression defines a date range determined by two time expressions. Time expressions can assume one of four forms: 1) a string containing the number of ms that have elapsed since January 1, 1970, 2) * for before/after expressions (see below), 3) a relative time expression, or 4) an absolute time expression. Relative time expressions begin with y (year), mo (month), d (date), * h (hour) or mi (minute). The next character in a relative time expression is '-' (can be interpreted as minus). mo-2 means two months ago, h-4 means four hours ago, etc. Absolute time expressions also begin with y, mo, d, h, or mi. The numbers following specify the exact time, with 4 chars for the year and two for each subsequent time unit. mo200404 means April 2004, mi200505051921 means 7:21pm on May 5, 2005. An absolute time may be passed in alone as a time range. The implied time range goes from the specified time to one time unit beyond the specified time. so modified:mo200506 encapsulates all of June 2005, modified:d20050621 encapsulates all of June 21, 2005. Ranges are of the form start_char time_expr_1 to time_expr_2 end_char. start_char is '[' or '{'. end_char is ']' or '}'. [ and ] include the dates that they are adjacent to, and { and } exclude the dates that they are adjacent to. Note that in the case where both time expressions are relative time expressions, the start_char and end_char must be present but they will be ignored. For relative time expressions, the implied inclusion/exclusion is as follows: [time_expr_1 to time_expr_2}

Author:
Wing Yung (wingyung@us.ibm.com)

Constructor Summary
ModelIndexQuery()
          Create a new ModelIndexQuery
 
Method Summary
 void initialize(java.util.Properties properties)
          Initializes the query with the properties object.
 void initialize(java.lang.String queryStr)
          Initializes the query based on the queryStr
 void initialize(java.lang.String defaultField, java.lang.String queryStr)
          Initializes a simple query.
static void main(java.lang.String[] args)
          Tests date parsing
 
Methods inherited from class org.openanzo.indexer.lucene.LuceneQuery
getFilter, getQuery
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelIndexQuery

public ModelIndexQuery()
Create a new ModelIndexQuery

Method Detail

initialize

public void initialize(java.util.Properties properties)
                throws IndexerException
Description copied from class: LuceneQuery
Initializes the query with the properties object. The properties object is expected to contain the default field to search (org.openanzo.indexer.lucene.query.field) and the text to search for (org.openanzo.indexer.lucene.query.text).

Specified by:
initialize in interface IQuery
Overrides:
initialize in class LuceneQuery
Parameters:
properties - configuration for this query
Throws:
IndexerException

initialize

public void initialize(java.lang.String defaultField,
                       java.lang.String queryStr)
                throws IndexerException
Description copied from class: LuceneQuery
Initializes a simple query. Sets the default field to search, along with the text to search. Note that text may contain other modifiers so that other fields are searched as well.

Specified by:
initialize in interface IQuery
Overrides:
initialize in class LuceneQuery
Parameters:
defaultField - default field to search in this query
queryStr - text query to search for, can use Lucene Query constructs
Throws:
IndexerException

initialize

public void initialize(java.lang.String queryStr)
                throws IndexerException
Description copied from class: LuceneQuery
Initializes the query based on the queryStr

Specified by:
initialize in interface IQuery
Overrides:
initialize in class LuceneQuery
Parameters:
queryStr - query string, can use Lucene Query constructs
Throws:
IndexerException

main

public static void main(java.lang.String[] args)
                 throws IndexerException
Tests date parsing

Parameters:
args -
Throws:
IndexerException


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.