com.google.appengine.api.search.dev
Class LuceneUtils
- java.lang.Object
-
- com.google.appengine.api.search.dev.LuceneUtils
-
public final class LuceneUtils extends java.lang.ObjectVarious utilities to interface with Lucene.
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringFIELDLESS_FIELD_NAMEThe name of the field under which we store tokens for all fields, so that we can search for them without a field prefix.static longMSEC_PER_DAY
-
Constructor Summary
Constructors Constructor and Description LuceneUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static java.lang.LongdateStringToLong(java.lang.String value)static java.lang.StringextractTextFromHtml(java.lang.String html)static QuerygetMatchAnyDocumentQuery()static QuerygetMatchNoneQuery()static booleanisDateString(java.lang.String value)Checks whether provided string is an ISO-8601 date.static java.lang.ObjectluceneFieldToValue(Fieldable f, ContentType type)static java.lang.StringmakeLuceneFieldName(DocumentPb.Field field)static java.lang.StringmakeLuceneFieldName(java.lang.String name, DocumentPb.FieldValue.ContentType type)static java.lang.StringmakeLuceneFieldNameWithExtractedText(DocumentPb.Field field)static java.lang.StringmakeLuceneFieldNameWithExtractedText(java.lang.String name, DocumentPb.FieldValue.ContentType type)static TermnewDeleteTerm(java.lang.String docId)static doublenumericFieldToDouble(Fieldable f)static doublestringValueToDouble(java.lang.String value)Locale-aware Double parsing.static DocumentPb.DocumenttoAppengineDocument(Document d)static DocumentPb.DocumenttoAppengineDocumentId(Document d)static DocumenttoLuceneDocument(java.lang.String docId, DocumentPb.Document input)static java.util.List<AbstractField>toLuceneFields(DocumentPb.Field field)
-
-
-
Field Detail
-
FIELDLESS_FIELD_NAME
public static final java.lang.String FIELDLESS_FIELD_NAME
The name of the field under which we store tokens for all fields, so that we can search for them without a field prefix.- See Also:
- Constant Field Values
-
MSEC_PER_DAY
public static final long MSEC_PER_DAY
- See Also:
- Constant Field Values
-
-
Method Detail
-
makeLuceneFieldName
public static java.lang.String makeLuceneFieldName(DocumentPb.Field field)
-
makeLuceneFieldName
public static java.lang.String makeLuceneFieldName(java.lang.String name, DocumentPb.FieldValue.ContentType type)
-
makeLuceneFieldNameWithExtractedText
public static java.lang.String makeLuceneFieldNameWithExtractedText(java.lang.String name, DocumentPb.FieldValue.ContentType type)
-
makeLuceneFieldNameWithExtractedText
public static java.lang.String makeLuceneFieldNameWithExtractedText(DocumentPb.Field field)
-
extractTextFromHtml
public static java.lang.String extractTextFromHtml(java.lang.String html)
-
stringValueToDouble
public static double stringValueToDouble(java.lang.String value)
Locale-aware Double parsing. Double.valueOf(String) fails if your locale uses commas as decimal separators. This takes that into account.
-
toLuceneFields
public static java.util.List<AbstractField> toLuceneFields(DocumentPb.Field field)
-
toLuceneDocument
public static Document toLuceneDocument(java.lang.String docId, DocumentPb.Document input)
-
dateStringToLong
public static java.lang.Long dateStringToLong(java.lang.String value) throws java.text.ParseException- Throws:
java.text.ParseException
-
isDateString
public static boolean isDateString(java.lang.String value)
Checks whether provided string is an ISO-8601 date.
-
numericFieldToDouble
public static double numericFieldToDouble(Fieldable f)
-
luceneFieldToValue
public static java.lang.Object luceneFieldToValue(Fieldable f, ContentType type)
-
toAppengineDocumentId
public static DocumentPb.Document toAppengineDocumentId(Document d)
-
toAppengineDocument
public static DocumentPb.Document toAppengineDocument(Document d) throws InvalidProtocolBufferException- Throws:
InvalidProtocolBufferException
-
getMatchAnyDocumentQuery
public static Query getMatchAnyDocumentQuery()
-
getMatchNoneQuery
public static Query getMatchNoneQuery()
-
newDeleteTerm
public static Term newDeleteTerm(java.lang.String docId)
-
-