我用lucene做了个检索,可是他不能将我的字符串数组
切分开,请那位高手教一下
public class InsertIndexRecord {
public InsertIndexRecord(){

}

public int insertIndexRecord(String dbPath,File file){
int returnValue = 0;

try {
IndexWriter indexWriter = new IndexWriter(dbPath,new StandardAnalyzer(),false);

addFiles(indexWriter,file);

returnValue = 1;
} catch (IOException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}

return returnValue;
}

public int insertIndexRecord(String dbPath,String file){
return insertIndexRecord(dbPath,new File(file));
}

public void addFiles(IndexWriter indexWriter,File file){
Document document = new Document();

//document.add(new Field("fileName",file.getName(),Field.Store.YES,Field.Index.UN_TOKENIZED));

document.add(new Field("content",chgFiletoString(file),Field.Store.YES,Field.Index.TOKENIZED));

try {
indexWriter.addDocument(document);

indexWriter.close();
} catch (IOException e) {
e.printStackTrace();
}
}

public String chgFiletoString(File file){
String return_value = null;

StringBuffer sb = new StringBuffer();

char[] c = new char[4096];

try {
Reader reader = new FileReader(file);

int n = 0;

int i = 0;

while(true) {
System.out.println(i);

n = reader.read(c);

if(n > 0) {
sb.append(c,0,n);
}else{
    break;
}

i++;
}

reader.close();
}catch(Exception e) {
e.printStackTrace();
}

return_value = sb.toString(); return return_value;
}

public static void main(String[] args) {
InsertIndexRecord iir = new InsertIndexRecord();

String dbPath = "d:/lucene";

if(iir.insertIndexRecord(dbPath,"D:/a.txt") == 1){
System.out.println("a.txt添加成功..");
}
}
}这就是我创建索引的方法,请高手指教!