camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: CAMEL-9434: camel-catalog - did you mean
Date Wed, 23 Dec 2015 15:07:33 GMT
CAMEL-9434: camel-catalog - did you mean


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f9352d9e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f9352d9e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f9352d9e

Branch: refs/heads/camel-2.16.x
Commit: f9352d9ebe9fa37dacd76b39b4c0ef96ef5a14fe
Parents: 5b4b7f0
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Dec 23 16:06:39 2015 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Dec 23 16:07:10 2015 +0100

----------------------------------------------------------------------
 .../apache/camel/catalog/lucene/LuceneSuggestionStrategy.java | 7 +++----
 .../org/apache/camel/catalog/EndpointValidationResult.java    | 6 +++---
 2 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f9352d9e/platforms/catalog-lucene/src/main/java/org/apache/camel/catalog/lucene/LuceneSuggestionStrategy.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-lucene/src/main/java/org/apache/camel/catalog/lucene/LuceneSuggestionStrategy.java
b/platforms/catalog-lucene/src/main/java/org/apache/camel/catalog/lucene/LuceneSuggestionStrategy.java
index 331e206..0be3cc5 100644
--- a/platforms/catalog-lucene/src/main/java/org/apache/camel/catalog/lucene/LuceneSuggestionStrategy.java
+++ b/platforms/catalog-lucene/src/main/java/org/apache/camel/catalog/lucene/LuceneSuggestionStrategy.java
@@ -20,7 +20,7 @@ import java.io.StringReader;
 import java.util.Set;
 
 import org.apache.camel.catalog.SuggestionStrategy;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.analysis.core.KeywordAnalyzer;
 import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.search.spell.PlainTextDictionary;
 import org.apache.lucene.search.spell.SpellChecker;
@@ -33,7 +33,7 @@ import org.apache.lucene.store.RAMDirectory;
  */
 public class LuceneSuggestionStrategy implements SuggestionStrategy {
 
-    private int maxSuggestions = 5;
+    private int maxSuggestions = 3;
 
     @Override
     public String[] suggestEndpointOptions(Set<String> names, String unknownOption)
{
@@ -51,9 +51,8 @@ public class LuceneSuggestionStrategy implements SuggestionStrategy {
             // use in-memory lucene spell checker to make the suggestions
             RAMDirectory dir = new RAMDirectory();
             SpellChecker checker = new SpellChecker(dir);
-            checker.indexDictionary(words, new IndexWriterConfig(new StandardAnalyzer()),
false);
+            checker.indexDictionary(words, new IndexWriterConfig(new KeywordAnalyzer()),
false);
 
-            // suggest up to 5 names
             return checker.suggestSimilar(unknownOption, maxSuggestions);
         } catch (Exception e) {
             // ignore

http://git-wip-us.apache.org/repos/asf/camel/blob/f9352d9e/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java
b/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java
index 953ebf4..4c03e2f 100644
--- a/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java
+++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java
@@ -229,15 +229,15 @@ public class EndpointValidationResult implements Serializable {
                 if (unknownSuggestions != null && unknownSuggestions.containsKey(name))
{
                     String[] suggestions = unknownSuggestions.get(name);
                     String str = Arrays.asList(suggestions).toString();
-                    options.put(name, "Unknown field. Did you mean: " + str);
+                    options.put(name, "Unknown option. Did you mean: " + str);
                 } else {
-                    options.put(name, "Unknown field.");
+                    options.put(name, "Unknown option.");
                 }
             }
         }
         if (required != null) {
             for (String name : required) {
-                options.put(name, "Missing required field");
+                options.put(name, "Missing required option");
             }
         }
         if (invalidEnum != null) {


Mime
View raw message