/// <summary> /// Get a PasteDBRow that matches a list of supplied tags. /// </summary> /// <param name="tags">A list of tags to search for.</param> /// <returns>A PasteDBRow that most closely matches the supplied tags.</returns> public PasteDBRow getTopPasteByTags(List <String> tags) { TallyList hits = new TallyList(); foreach (String tag in tags) { List <PasteDBRow> results = getPastesByTag(tag); if (results != null) { foreach (PasteDBRow result in results) { hits.addNewHit(result.id); } } } if (!hits.isEmpty()) { return(getPasteByID(hits.getMostHitID())); } else { return(null); } }
/// <summary> /// Get a list of PasteDBRow, sorted in order of decreasing relevance, that match a list of supplied tags. /// </summary> /// <param name="tags">A list of tags to search for.</param> /// <returns>A sorted list of PasteDBRows.</returns> public List <PasteDBRow> getPastesByTags(List <String> tags) { //TODO: FINISH THIS. Currently implented as getTopPostsByTags() for testing throw new NotImplementedException(); TallyList hits = new TallyList(); foreach (String tag in tags) { List <PasteDBRow> results = getPastesByTag(tag); if (results != null) { foreach (PasteDBRow result in results) { hits.addNewHit(result.id); } } } if (!hits.isEmpty()) { //return (getPasteByID(hits.getMostHitID())); return(null); } else { return(null); } }
/// <summary> /// Get a PasteDBRow that matches a list of supplied tags. /// </summary> /// <param name="tags">A list of tags to search for.</param> /// <returns>A PasteDBRow that most closely matches the supplied tags.</returns> public PasteDBRow getTopPasteByTags(List<String> tags) { TallyList hits = new TallyList(); foreach (String tag in tags) { List<PasteDBRow> results = getPastesByTag(tag); if (results != null) { foreach (PasteDBRow result in results) { hits.addNewHit(result.id); } } } if (!hits.isEmpty()) return (getPasteByID(hits.getMostHitID())); else return null; }
/// <summary> /// Get a list of PasteDBRow, sorted in order of decreasing relevance, that match a list of supplied tags. /// </summary> /// <param name="tags">A list of tags to search for.</param> /// <returns>A sorted list of PasteDBRows.</returns> public List<PasteDBRow> getPastesByTags(List<String> tags) { //TODO: FINISH THIS. Currently implented as getTopPostsByTags() for testing throw new NotImplementedException(); TallyList hits = new TallyList(); foreach (String tag in tags) { List<PasteDBRow> results = getPastesByTag(tag); if (results != null) { foreach (PasteDBRow result in results) { hits.addNewHit(result.id); } } } if (!hits.isEmpty()) //return (getPasteByID(hits.getMostHitID())); return null; else return null; }