Skip to content

Apache Lucene open-source search software

don't crash ony non-stored fields. small fixes to the help text.

Daniel Naber592f6189a0b3
diff --git a/sandbox/contributions/lucli/src/lucli/LuceneMethods.java b/sandbox/contributions/lucli/src/lucli/LuceneMethods.java
index 7a7f4b2131b..5d64ed14d07 100644
--- a/sandbox/contributions/lucli/src/lucli/LuceneMethods.java
+++ b/sandbox/contributions/lucli/src/lucli/LuceneMethods.java
@@ -107,7 +107,7 @@ class LuceneMethods {
public LuceneMethods(String index) {
indexName = index;
- message("Lucene CLI. Using directory:" + indexName);
+ message("Lucene CLI. Using directory '" + indexName + "'. Type 'help' for instructions.");
}
@@ -175,8 +175,12 @@ class LuceneMethods {
for (int ii = 0; ii < fieldsArray.length; ii++) {
String currField = fieldsArray[ii];
String[] result = doc.getValues(currField);
- for (int i = 0; i < result.length; i++) {
- message(currField + ":" + result[i]);
+ if (result != null) {
+ for (int i = 0; i < result.length; i++) {
+ message(currField + ":" + result[i]);
+ }
+ } else {
+ message(currField + ": <not available>");
}
}
//another option is to just do message(doc);
diff --git a/sandbox/contributions/lucli/src/lucli/Lucli.java b/sandbox/contributions/lucli/src/lucli/Lucli.java
index 7821b2a9e26..dd551efe735 100644
--- a/sandbox/contributions/lucli/src/lucli/Lucli.java
+++ b/sandbox/contributions/lucli/src/lucli/Lucli.java
@@ -107,12 +107,12 @@ public class Lucli {
* Initialize the list of commands
*/
- addCommand("info", INFO, "Display info about the current Lucene Index. Example:info");
+ addCommand("info", INFO, "Display info about the current Lucene index. Example: info");
addCommand("search", SEARCH, "Search the current index. Example: search foo", 1);
addCommand("count", COUNT, "Return the number of hits for a search. Example: count foo", 1);
addCommand("optimize", OPTIMIZE, "Optimize the current index");
addCommand("quit", QUIT, "Quit/exit the program");
- addCommand("help", HELP, "Display help about commands.");
+ addCommand("help", HELP, "Display help about commands");
addCommand("terms", TERMS, "Show the first " + MAX_TERMS + " terms in this index. Supply a field name to only show terms in a specific field. Example: terms");
addCommand("index", INDEX, "Choose a different lucene index. Example index my_index", 1);
addCommand("tokens", TOKENS, "Does a search and shows the top 10 tokens for each document. Verbose! Example: tokens foo", 1);