[sword-svn] r3067 - trunk/utilities/diatheke

refdoc at crosswire.org refdoc at crosswire.org
Tue Mar 4 11:32:25 MST 2014


Author: refdoc
Date: 2014-03-04 11:32:24 -0700 (Tue, 04 Mar 2014)
New Revision: 3067

Modified:
   trunk/utilities/diatheke/corediatheke.h
   trunk/utilities/diatheke/diatheke.cpp
Log:
applied patch by Timothy Nelson to close MODTOOLS-64 - enable diatheke to use lucene searches


Modified: trunk/utilities/diatheke/corediatheke.h
===================================================================
--- trunk/utilities/diatheke/corediatheke.h	2014-03-04 16:38:20 UTC (rev 3066)
+++ trunk/utilities/diatheke/corediatheke.h	2014-03-04 18:32:24 UTC (rev 3067)
@@ -63,7 +63,12 @@
 #define ST_REGEX 1     //  0
 #define ST_PHRASE 2    // -1
 #define ST_MULTIWORD 3 // -2
+#define ST_ENTRYATTRIB 4 // -3
+#define ST_CLUCENE 5 // -4
+#define ST_MULTILEMMA 6 // -5
 
+
+
 using namespace std;
 
 int hasalpha (char * string);

Modified: trunk/utilities/diatheke/diatheke.cpp
===================================================================
--- trunk/utilities/diatheke/diatheke.cpp	2014-03-04 16:38:20 UTC (rev 3066)
+++ trunk/utilities/diatheke/diatheke.cpp	2014-03-04 18:32:24 UTC (rev 3067)
@@ -49,8 +49,9 @@
 	fprintf (stderr, "If <book> is \"system\" you may use these system keys: \"modulelist\",\n");
 	fprintf (stderr, "\"modulelistnames\", \"bibliography\", and \"localelist\".");
 	fprintf (stderr, "\n");
-	fprintf (stderr, "Valid search_type values are: regex, multiword, and phrase(def).\n");
-	fprintf (stderr, "Valid option_filters values are: n (Strong's numbers),\n");
+	fprintf (stderr, "Valid search_type values are: phrase (default), regex, multiword,\n");
+	fprintf (stderr, "  attribute, lucene, multilemma.\n");
+	fprintf (stderr, "Valid (output) option_filters values are: n (Strong's numbers),\n");
 	fprintf (stderr, "  f (Footnotes), m (Morphology), h (Section Headings),\n");
 	fprintf (stderr, "  c (Cantillation), v (Hebrew Vowels), a (Greek Accents), p (Arabic Vowels)\n");
 	fprintf (stderr, "  l (Lemmas), s (Scripture Crossrefs), r (Arabic Shaping),\n");
@@ -95,19 +96,30 @@
 		}
 		else if (!::stricmp("-s", argv[i])) {
 			if (i+1 <= argc) {
-				if (!::stricmp("phrase", argv[i+1])) {
+				i++;
+				if (!::stricmp("phrase", argv[i])) {
 					searchtype = ST_PHRASE;
-					i++;
 				}
-				else if (!::stricmp("regex", argv[i+1])) {
+				else if (!::stricmp("regex", argv[i])) {
 					searchtype = ST_REGEX;
-					i++;
 				}
-				else if (!::stricmp("multiword", argv[i+1])) {
+				else if (!::stricmp("multiword", argv[i])) {
 					searchtype = ST_MULTIWORD;
-					i++;
 				}
-				else i++;
+				else if (!::stricmp("lucene", argv[i])) {
+					searchtype = ST_CLUCENE;
+				}
+				else if (!::stricmp("attribute", argv[i])) {
+					searchtype = ST_ENTRYATTRIB;
+				}
+				else if (!::stricmp("multilemma", argv[i])) {
+					searchtype = ST_MULTILEMMA;
+				}
+				else {
+					fprintf (stderr, "Unknown search_type: %s\n", argv[i]);
+					fprintf (stderr, "Try diatheke --help\n");
+					return 0;
+				}
 			}
 		}
  		else if (!::stricmp("-r", argv[i])) {
@@ -268,6 +280,7 @@
 	if (runquery == (RQ_BOOK | RQ_REF)) {
  	    doquery(maxverses, outputformat, outputencoding, optionfilters, searchtype, range, text, locale, ref, &cout, script, variants);
 	}
+	//if we got this far without exiting, something went wrong, so print syntax
 	else printsyntax();
 
 	return 0;




More information about the sword-cvs mailing list