Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products. If you have feedback or questions as you navigate the site, click Send Feedback.


Class LuceneUtils

  • java.lang.Object

  • public final class LuceneUtils
    extends java.lang.Object
    Various utilities to interface with Lucene.
    • Field Detail


        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
      • 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
      • getMatchAnyDocumentQuery

        public static Query getMatchAnyDocumentQuery()
      • getMatchNoneQuery

        public static Query getMatchNoneQuery()
      • newDeleteTerm

        public static Term newDeleteTerm(java.lang.String docId)