LuceneUtils

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.Object
    Various utilities to interface with Lucene.
    • 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
    • Constructor Detail

      • LuceneUtils

        public LuceneUtils()
    • 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)