小编Bib*_*hew的帖子

数组作为构造函数参数

我有个问题 .我正在学习java,这个示例代码不起作用,说:

 $javac Quicksort.java 2>&1
    Quicksort.java:16: error: constructor Quicksort in class Quicksort cannot be applied to given types;
    Quicksort qc = new Quicksort(values);
    ^
    required: no arguments
    found: int[]
    reason: actual and formal argument lists differ in length
    1 error
Run Code Online (Sandbox Code Playgroud)

无法弄清楚原因.谁能帮忙?

我的代码片段是:

   public class Quicksort{
   public int[] number ;

   public void Quicksort(int[] values){
       this.number=values;
   }
   public void print(){
       for (int i=0; i<number.length;i++)
           System.out.println(number[i]);



   }
   public static void main(String[] args){
       int[] values = {3,4,5,6,7,8};
       Quicksort qc = new Quicksort(values);
       qc.print();
   } …
Run Code Online (Sandbox Code Playgroud)

java

3
推荐指数
1
解决办法
538
查看次数

XML文件内容的弹性搜索

我是弹性搜索的新手.我的用例是在一些XML文件集中搜索文本.所以我的问题是.

  1. 这是否可以使用弹性搜索获得
  2. 我尝试了以下方法:

    安装了Elastic搜索,应用了附件插件

创建了一个映射:

  curl -XPUT 'http://localhost:9200/second/?pretty=1'  -d '
 {
        "mapping" : {
            "xmlfile" : {
                "properties" : {
                    "attachment": { "type" : "attachment" }
                }
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

索引XML文件:

curl -XPOST "http://localhost:9200/second/xmlfile?pretty=1" -d '
       {
      "file" : "'`base64 D:\\games.xml | perl -pe 's/\n/\\n/g'`'"
       }
Run Code Online (Sandbox Code Playgroud)

试过搜索:

 curl -XGET 'http://localhost:9200/second/xmlfile/_search?pretty=1'  -d '
{
   "query" : {
      "text" : {
         "file" : "curField"  //currField is a string inside my xml
      }
   }
}
Run Code Online (Sandbox Code Playgroud)

上面的搜索给了我SearchNotFound Exception所以id

 curl -XGET 'http://localhost:9200/second/xmlfile/_search?pretty=1'  -d '
{ …
Run Code Online (Sandbox Code Playgroud)

rest elasticsearch

1
推荐指数
1
解决办法
2843
查看次数

标签 统计

elasticsearch ×1

java ×1

rest ×1