diff --git oak-core/src/main/java/org/apache/jackrabbit/oak/query/fulltext/SimpleExcerptProvider.java oak-core/src/main/java/org/apache/jackrabbit/oak/query/fulltext/SimpleExcerptProvider.java
index de14165..37f7943 100644
--- oak-core/src/main/java/org/apache/jackrabbit/oak/query/fulltext/SimpleExcerptProvider.java
+++ oak-core/src/main/java/org/apache/jackrabbit/oak/query/fulltext/SimpleExcerptProvider.java
@@ -190,7 +190,7 @@ public class SimpleExcerptProvider {
         return excerpt.toString();
     }
 
-    private static String highlight(StringBuilder text, Set<String> searchToken) {
+    static String highlight(StringBuilder text, Set<String> searchToken) {
         Set<String> tokens = tokenize(searchToken);
         text = new StringBuilder(encodeIllegalXMLCharacters(text.toString()));
         for (String token : tokens) {
@@ -206,7 +206,8 @@ public class SimpleExcerptProvider {
     private static StringBuilder replaceAll(StringBuilder in, String token,
             String start, String end) {
         boolean isLike = false;
-        if (token.endsWith("*")) {
+
+        if (token.endsWith("*") && token.length() > 1) {
             token = token.substring(0, token.length() - 1);
             isLike = true;
         }
diff --git oak-core/src/test/java/org/apache/jackrabbit/oak/query/fulltext/SimpleExcerptProviderTest.java oak-core/src/test/java/org/apache/jackrabbit/oak/query/fulltext/SimpleExcerptProviderTest.java
new file mode 100644
index 0000000..5e1e693
--- /dev/null
+++ oak-core/src/test/java/org/apache/jackrabbit/oak/query/fulltext/SimpleExcerptProviderTest.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.jackrabbit.oak.query.fulltext;
+
+import org.junit.Test;
+
+import static com.google.common.collect.ImmutableSet.of;
+import static org.apache.jackrabbit.oak.query.fulltext.SimpleExcerptProvider.highlight;
+import static org.junit.Assert.assertEquals;
+
+public class SimpleExcerptProviderTest {
+    
+    @Test
+    public void simpleTest() throws Exception{
+        assertEquals("<div><span><strong>fox</strong> is jumping</span></div>",
+                highlight(sb("fox is jumping"), of("fox")));
+        assertEquals("<div><span>fox is <strong>jumping</strong></span></div>",
+                highlight(sb("fox is jumping"), of("jump*")));
+
+    }
+
+    @Test
+    public void highlightWithWildCard() throws Exception{
+        assertEquals("<div><span><strong>fox</strong> is jumping</span></div>",
+                highlight(sb("fox is jumping"), of("fox *")));
+    }
+
+    private static StringBuilder sb(String text){
+        return new StringBuilder(text);
+    }
+}
