def main(argv=None): if argv is None: argv = sys.argv try: try: opts, args = getopt.getopt(argv[1:],'hvu:',['help', 'verbose', 'url=']) except getopt.error, msg: raise _Usage(msg) if len(opts) == 0: raise _Usage(_helpMessage) solrUrl=None for option, value in opts: if option in ('-h', '--help'): raise _Usage(_helpMessage) elif option in ('-u', '--url'): solrUrl = value elif option in ('-v', '--verbose'): global _verbose _verbose = True for filename in sys.stdin: filename = filename.rstrip() if not ".json" in filename or not os.path.exists(filename): continue verboseLog("Processing: "+filename) f = open(filename, 'r') jsonContents = f.read() postString = prepareDocForSolr(jsonContents) verboseLog(postString) postJsonDocToSolr(solrUrl, postString)
def main(argv=None): if argv is None: argv = sys.argv try: try: opts, args = getopt.getopt(argv[1:], 'hvu:', ['help', 'verbose', 'url=']) except getopt.error, msg: raise _Usage(msg) if len(opts) == 0: raise _Usage(_helpMessage) solrUrl = None for option, value in opts: if option in ('-h', '--help'): raise _Usage(_helpMessage) elif option in ('-u', '--url'): solrUrl = value elif option in ('-v', '--verbose'): global _verbose _verbose = True for filename in sys.stdin: filename = filename.rstrip() if not ".json" in filename or not os.path.exists(filename): continue verboseLog("Processing: " + filename) f = open(filename, 'r') jsonContents = f.read() postString = prepareDocForSolr(jsonContents) verboseLog(postString) postJsonDocToSolr(solrUrl, postString)
def main(argv=None): if argv is None: argv = sys.argv try: try: opts, args = getopt.getopt(argv[1:], 'hvu:o:', ['help', 'verbose', 'url=', 'object=']) except getopt.error, msg: raise _Usage(msg) if len(opts) == 0: raise _Usage(_helpMessage) solrUrl = None objectType = None for option, value in opts: if option in ('-h', '--help'): raise _Usage(_helpMessage) elif option in ('-v', '--verbose'): global _verbose _verbose = True elif option in ('-u', '--url'): solrUrl = value elif option in ('-o', '--object'): objectType = value if solrUrl == None or objectType == None: raise _Usage(_helpMessage) for filename in sys.stdin: filename = filename.rstrip() if not ".json" in filename or not os.path.exists(filename): continue verboseLog("Processing: " + filename) f = open(filename, 'r') jsonContents = f.read() jsonObjs = prepareDocs(jsonContents, objectType) for obj in jsonObjs: cleanseImage(obj) cleanseBody(obj) formatDate(obj) unravelStructs(obj) postString = prepareDocForSolr(obj, False) verboseLog(postString) postJsonDocToSolr(solrUrl, postString)
def main(argv=None): if argv is None: argv = sys.argv try: try: opts, args = getopt.getopt(argv[1:],'hvu:o:',['help', 'verbose', 'url=', 'object=']) except getopt.error, msg: raise _Usage(msg) if len(opts) == 0: raise _Usage(_helpMessage) solrUrl=None objectType=None for option, value in opts: if option in ('-h', '--help'): raise _Usage(_helpMessage) elif option in ('-v', '--verbose'): global _verbose _verbose = True elif option in ('-u', '--url'): solrUrl = value elif option in ('-o', '--object'): objectType = value if solrUrl == None or objectType == None: raise _Usage(_helpMessage) for filename in sys.stdin: filename = filename.rstrip() if not ".json" in filename or not os.path.exists(filename): continue verboseLog("Processing: "+filename) f = open(filename, 'r') jsonContents = f.read() jsonObjs = prepareDocs(jsonContents, objectType) for obj in jsonObjs: cleanseImage(obj) cleanseBody(obj) formatDate(obj) unravelStructs(obj) postString = prepareDocForSolr(obj, False) verboseLog(postString) postJsonDocToSolr(solrUrl, postString)