Get sorted resultlist of fulltext search


function getSortedFullTextSearch(query:string, fieldName:string) {
	var resultList:java.util.Vector = new java.util.Vector();
	var documenColl:NotesDocumentCollection = database.FTSearch(query);
	var tempDoc:NotesDocument = tempDc.getFirstDocument();
	var tempTreeMap:java.util.TreeMap = new java.util.TreeMap();

	// fill the treeMap
	while (tempDoc != null) {
		// set the value of the field in "fieldName" as key for sorting with this criteria
		tempTreeMap.put(tempDoc.getItemValueString(fieldname), tempDoc);										
		tempDoc = tempDc.getNextDocument(tempDoc);
	}

	// iterate through treemap to get sorted resultlist
	var tempColl:java.util.Collection = tempTreeMap.values();
	var tempIt:java.util.Iterator = tempColl.iterator();

	while (tempIt.hasNext()) {
		resultList.add(tempIt.next());
	}

	return resultList;
}
All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.
No comments yetLogin first to comment...