我只是按照教程从NutchWiki设置Nutch。
下载Nutch 2.x src并设置所有配置。
当我刚开始爬行时会出现问题。
当我运行此代码时:bin/nutch inject crawl/crawldb urls
我收到如下错误消息:Unrecognized arg urls
我只是按照教程中的所有步骤,创建了目录,对配置文件进行了更改等。我还有一个查询,即apache-nutch-2.x / runtime / local /中没有crawldb目录,是自动生成还是需要手动生成吗?
对此问题的任何帮助将不胜感激。
答案 0 :(得分:4)
我遇到了同样的问题。文档似乎已经过时了。这是1.x。
对于2.x我尝试了以下内容,它对我有用。
def addDiamondProduct(){
def today = new Date().clearTime()
def todayGoldPrice = GoldRates.findAllByGoldDate(today)
def category = Categories.get(params.category)
def karigad = Karigads.get(params.karigad)
Double totalDiamondAmount = params.diamondWeight.toDouble() * params.diamondRate.toDouble()
Double totalGoldAmount = params.goldWeight.toDouble() * ( params.goldPercent.toDouble()/100 ) * todayGoldPrice.rate
Double totalMc = params.goldWeight.toDouble() * params.mcPerGram.toDouble()
Double totalStoneAmount = params.stoneWeight.toDouble() * params.stonePricePerCarat.toDouble()
Double totalPurchasePrice = totalDiamondAmount.toDouble() + totalGoldAmount.toDouble() + totalStoneAmount.toDouble() + totalMc.toDouble()
def product = new DiamondProducts(
productCode: params.productCode,
diamondWeight: params.diamondWeight,
diamondRate: params.diamondRate,
totalDiamondAmount: totalDiamondAmount.toString(),
goldWeight: params.goldWeight,
goldKt: params.goldPurity,
goldPercent: params.goldPercent,
totalGoldAmount: totalGoldAmount.toString(),
mcGram: params.mcPerGram,
totalMc: totalMc.toString(),
stoneWeight: params.stoneWeight,
stonePricePerCarat: params.stonePricePerCarat,
totalStoneAmount: totalStoneAmount.toString(),
totalPurchasePrice: totalPurchasePrice.toString(),
salePrice: params.salePrice,
remarks: params.remarks,
description: params.description,
itemNumber: params.itemNumber,
karigad: karigad,
category: category,
status: "notSold",
createdDate: new Date()
)
product.save()
flash.message = "Product Added Successfully."
redirect(action: 'diamondProducts')
}
希望它有所帮助。