org.apache.lucene.gdata.search.query
Class QueryTranslator

java.lang.Object
  extended by org.apache.lucene.gdata.search.query.QueryTranslator

public class QueryTranslator
extends Object

Simple static methods to translate the http query to a lucene query string.

Author:
Simon Willnauer

Constructor Summary
QueryTranslator()
           
 
Method Summary
static String translateHttpSearchRequest(IndexSchema schema, Map<String,String[]> parameterMap, String categoryQuery)
          This method does a little preprocessing of the query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryTranslator

public QueryTranslator()
Method Detail

translateHttpSearchRequest

public static String translateHttpSearchRequest(IndexSchema schema,
                                                Map<String,String[]> parameterMap,
                                                String categoryQuery)
This method does a little preprocessing of the query. Basically it will map the given request parameters to a lucene syntax. Each parameter matching a index field in the given schema will be translated into a grouped query string according to the lucene query syntax.

  1. title=foo bar AND "FooBar" will be title:(foo bar AND "FooBar)
  2. updated-min=2005-08-09T10:57:00-08:00 will be translated to updated:[1123613820000 TO 9223372036854775807] according to the gdata protocol

Parameters:
schema - the index schema for the queried service
parameterMap - - the http parameter map returning String[] instances as values
categoryQuery - - the parsed category query from the request
Returns:
- a lucene syntax query string


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.