45748d58b5b832232d1de4c98230f979ca146859 kent Fri Nov 14 16:36:21 2014 -0800 Adding trixSearchCmp function to header file and fixed documentation. diff --git src/lib/trix.c src/lib/trix.c index 2289c58..cb655a3 100644 --- src/lib/trix.c +++ src/lib/trix.c @@ -662,31 +662,31 @@ findUnorderedSpan(twrList, itemId, &ts->unorderedSpan, &ts->leftoverLetters); ts->orderedSpan = findOrderedSpan(twrList, itemId); ts->wordPos = findWordPos(twrList, itemId); slAddHead(&tsList, ts); } seekAllPastId(twrList, itemId); if (anyTwrDone(twrList)) break; } slReverse(&tsList); return tsList; } int trixSearchResultCmp(const void *va, const void *vb) -/* Compare two trixSearchResult by itemId. */ +/* Compare two trixSearchResult in such a way that most relevant searches tend to be first. */ { const struct trixSearchResult *a = *((struct trixSearchResult **)va); const struct trixSearchResult *b = *((struct trixSearchResult **)vb); int dif; dif = a->unorderedSpan - b->unorderedSpan; if (dif == 0) { dif = a->orderedSpan - b->orderedSpan; if (dif == 0) { dif = a->leftoverLetters - b->leftoverLetters; if (dif == 0) dif = a->wordPos - b->wordPos; } }