inc/trix.h

Go to the documentation of this file.
00001 /* trix - text retrieval index.  Stuff for fast two level index
00002  * of text for fast word searches. */
00003 
00004 struct trix
00005 /* A two level index */
00006     {
00007     struct lineFile *lf;        /* Open file on first level index. */
00008     struct trixIxx *ixx;        /* Second level index in memory. */
00009     int ixxSize;                /* Size of second level index. */
00010     int ixxAlloc;               /* Space allocated for index. */
00011     struct hash *wordHitHash;   /* Hash of word hitsLists, so search on "the the the" works fast. */
00012     };
00013 
00014 struct trixSearchResult
00015 /* Result of a trix search. */
00016     {
00017     struct trixSearchResult *next;
00018     char *itemId;               /* ID of matching item */
00019     int unorderedSpan;          /* Minimum span in single doc with words in any order. */
00020     int orderedSpan;            /* Minimum span in single doc with words in search order. */
00021     int wordPos;                /* Position of word in doc more or less. */
00022     int leftoverLetters;        /* Number of leftover letters in words. */
00023     };
00024 
00025 #define trixPrefixSize 5        /* Size of prefix in second level index. */
00026 
00027 struct trix *trixOpen(char *ixFile);
00028 /* Open up index.  Load second level index in memory. */
00029 
00030 void trixClose(struct trix **pTrix);
00031 /* Close up index and free up associated resources. */
00032 
00033 struct trixSearchResult *trixSearch(struct trix *trix, int wordCount, char **words,
00034         boolean expand);
00035 /* Return a list of items that match all words.  This will be sorted so that
00036  * multiple-word matches where the words are closer to each other and in the
00037  * right order will be first.  Do a trixSearchResultFreeList when done. 
00038  * If expand is TRUE then this will match not only the input words, but also
00039  * additional words that start with the input words. */
00040 
00041 void trixSearchResultFree(struct trixSearchResult **pTsr);
00042 /* Free up data associated with trixSearchResult. */
00043 
00044 void trixSearchResultFreeList(struct trixSearchResult **pList);
00045 /* Free up a list of trixSearchResults. */

Generated on Tue Dec 25 18:39:29 2007 for blat by  doxygen 1.5.2