A Text Retrieval Package for the Unix Operating System

Liam R. E. Quin

SoftQuad Inc. (lee at sq.com)

Note: the author of this paper has moved to liamquin at interlog dot com


Appendix I - Source for lqphrase


PRIVATE void
MatchOnePhrase(Phrase)
    char *Phrase;
{
    t_Phrase *P;
    unsigned long matchCount;

    if (!Phrase || !*Phrase) {
	/* ignore an empty phrase */
	return;
    }

    if ((P = LQT_StringToPhrase(Phrase)) == (t_Phrase *) 0) {
	/* not empty, but contained no plausible words */
	return;
    }

    /* PrintAndRejectOneMatch() is a function that prints
     * a single match.  It is called for each match as soon as it is
     * read from the disk.  This means that results start appearing
     * immediately, a huge benefit in a pipeline.
     * The `Reject' is because it doesn't retain the match in the
     * returned data structure.
     */
    matchCount = LQT_MakeMatchesWhere(P, PrintAndRejectOneMatch);

    /* finished. */
    return;
}


Next   Top