Welcome to Aspire Knowledge Central (AKC)
Home Public Library Author Content
How to use ListDataCollection
Click here to provide feedback or comments at the bottom of this page
private IDataCollection getDocumentCollection(List documentList)
{
Vector columnNamesVector = new Vector();
columnNamesVector.add(IndentLuceneIndex.FIELD_ID);
columnNamesVector.add(IndentLuceneIndex.FIELD_APP);
columnNamesVector.add(IndentLuceneIndex.FIELD_DOC);
columnNamesVector.add(IndentLuceneIndex.FIELD_TITLE);
columnNamesVector.add(IndentLuceneIndex.FIELD_DESCRIPTION);
ListDataCollection luceneDocumentCollection
= new ListDataCollection(columnNamesVector);
//Fill it up with rows
Iterator luceneDocItr = documentList.iterator();
while(luceneDocItr.hasNext())
{
Document doc = (Document)luceneDocItr.next();
IDataRow collectionRow = getDataRow(doc
,new VectorMetaData(columnNamesVector));
luceneDocumentCollection.addDataRow(collectionRow);
}
return luceneDocumentCollection;
}
private IDataRow getDataRow(Document luceneDoc, IMetaData columnMetaData)
{
List columnValues = new ArrayList();
columnValues.add(luceneDoc.get(IndentLuceneIndex.FIELD_ID));
columnValues.add(luceneDoc.get(IndentLuceneIndex.FIELD_APP));
columnValues.add(luceneDoc.get(IndentLuceneIndex.FIELD_DOC));
columnValues.add(luceneDoc.get(IndentLuceneIndex.FIELD_TITLE));
columnValues.add(luceneDoc.get(IndentLuceneIndex.FIELD_DESCRIPTION));
return new ListDataRow(columnMetaData,columnValues);
}