com.atlassian.bonnie
Class LuceneUtils

java.lang.Object
  extended bycom.atlassian.bonnie.LuceneUtils

public class LuceneUtils
extends java.lang.Object


Field Summary
protected static org.apache.log4j.Category log
          Logger.
 
Constructor Summary
LuceneUtils()
           
 
Method Summary
static java.util.Map buildMapFromDocument(org.apache.lucene.document.Document doc)
          Builds a Map representation of a Document.
static org.apache.lucene.search.Query buildSingleFieldMultiValuePrefixQuery(java.lang.String field, java.util.Collection values, boolean andQuery)
           
static org.apache.lucene.search.Query buildSingleFieldMultiValueTermQuery(java.lang.String field, java.util.Collection values, boolean andQuery)
          Builds a query that checks that the field contains all or some of the values specified.
static org.apache.lucene.search.Query buildSingleFieldSingleValueTermQuery(java.lang.String field, java.lang.String query)
           
static java.lang.String dateToString(java.util.Date date)
           
static java.util.Date stringToDate(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.log4j.Category log
Logger.

Constructor Detail

LuceneUtils

public LuceneUtils()
Method Detail

dateToString

public static java.lang.String dateToString(java.util.Date date)

stringToDate

public static java.util.Date stringToDate(java.lang.String s)

buildSingleFieldSingleValueTermQuery

public static org.apache.lucene.search.Query buildSingleFieldSingleValueTermQuery(java.lang.String field,
                                                                                  java.lang.String query)

buildSingleFieldMultiValueTermQuery

public static org.apache.lucene.search.Query buildSingleFieldMultiValueTermQuery(java.lang.String field,
                                                                                 java.util.Collection values,
                                                                                 boolean andQuery)
Builds a query that checks that the field contains all or some of the values specified. You can set this behaviour by adjusting the value of the addQuery parameter

Parameters:
field -
values -
andQuery - - set to true if you require the value of the field to match ALL values
Returns:

buildSingleFieldMultiValuePrefixQuery

public static org.apache.lucene.search.Query buildSingleFieldMultiValuePrefixQuery(java.lang.String field,
                                                                                   java.util.Collection values,
                                                                                   boolean andQuery)

buildMapFromDocument

public static java.util.Map buildMapFromDocument(org.apache.lucene.document.Document doc)
Builds a Map representation of a Document. This allows dot-style notation in Velocity to be retained for both object- and map-backed representations.

Dotted fields are split into maps that will lead to the eventual value. For example, content.space.name will resolve to map->map->string. This approach also assumes there is no clash between dotted keys and top-level keys, i.e. there aren't both content=foo and content.space.name=bar.

Parameters:
doc -
Returns:


Copyright © 2006-2009 Atlassian Software Systems Pty Ltd. All Rights Reserved.