tokenBuilder.append((String) groupIter.next());
tokenBuilder.append(" ");
}
//doc.add(new Field("groups", new IteratorTokenStream(groupIter)));
doc.add(new Field("groups", new WhitespaceTokenizer(new StringReader(tokenBuilder.toString()))));
}
// Add the URL of the document
doc.add(new Field("url", url, Field.Store.YES, Field.Index.NOT_ANALYZED));
// Add the file name (without protocol, drive-letter and path)
String filenameWithVariants = RegainToolkit.urlToWhitespacedFileName(url);
doc.add(new Field("filename", new WhitespaceTokenizer(new StringReader(filenameWithVariants))));
PathFilenamePair pfPair = RegainToolkit.fragmentUrl(url);
// Add the filename field for sorting
doc.add(new Field("filename_sort", pfPair.getFilename(), Field.Store.YES, Field.Index.NOT_ANALYZED));