Hi. I want to test sorting when search so I was created simple index like this.
String[] samples = {"duck dog","first dog","grammar dog","come dog","basic dog","intro dog","lipton dog","search dog","servlet dog","jan dog"}; Directory dir = FSDirectory.getDirectory(path); IndexWriter writer = new IndexWriter(dir,new GSKoreanAnalyzer(true),true); Document document = null; for(int i = 0; i < samples.length; i++) { document = new Document(); Field field = new Field("name",samples[i],Field.Store.YES,Field.Index.ANALYZED,Field.TermVector.WITH_POSITIONS_OFFSETS); document.add(field); writer.addDocument(document); } writer.optimize(); writer.close(); and I did create sample code (use Sort and TopFieldDocs). but It didn't work and throw Exception "there are more terms than documents in field "name", but it's impossible to sort on tokenized fields" What is this mean? I was searched about this issue in google and lucene java-wiki but I can't find. Is my code is wrong? If I had mistake, point to me please. Thanks. - Jang. -- DEV용식 http://devyongsik.tistory.com