1 /******************************************************************************
3 * $Id: searchindex.h,v 1.7 2001/03/19 19:27:41 root Exp $
5 * Copyright (C) 1997-2012 by Dimitri van Heesch.
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation under the terms of the GNU General Public License is hereby
9 * granted. No representations are made about the suitability of this software
10 * for any purpose. It is provided "as is" without express or implied warranty.
11 * See the GNU General Public License for more details.
13 * Documents produced by Doxygen are derivative works derived from the
14 * input used in their production; they are not affected by this license.
18 #ifndef _SEARCHINDEX_H
19 #define _SEARCHINDEX_H
32 /*! Initialize the search indexer */
33 void initSearchIndexer();
34 /*! Cleanup the search indexer */
35 void finializeSearchIndexer();
37 //------- server side search index ----------------------
41 URL(const char *n,const char *u) : name(n), url(u) {}
49 URLInfo(int idx,int f) : urlIdx(idx), freq(f) {}
57 IndexWord(const char *word);
58 void addUrlIndex(int,bool);
59 const QIntDict<URLInfo> &urls() const { return m_urls; }
60 QCString word() const { return m_word; }
64 QIntDict<URLInfo> m_urls;
70 enum Kind { Internal, External };
71 SearchIndexIntf(Kind k) : m_kind(k) {}
72 virtual ~SearchIndexIntf() {}
73 virtual void setCurrentDoc(Definition *ctx,const char *anchor,bool isSourceFile) = 0;
74 virtual void addWord(const char *word,bool hiPriority) = 0;
75 virtual void write(const char *file) = 0;
76 Kind kind() const { return m_kind; }
81 class SearchIndex : public SearchIndexIntf
85 void setCurrentDoc(Definition *ctx,const char *anchor,bool isSourceFile);
86 void addWord(const char *word,bool hiPriority);
87 void write(const char *file);
89 void addWord(const char *word,bool hiPrio,bool recurse);
90 QDict<IndexWord> m_words;
91 QVector< QList<IndexWord> > m_index;
97 class SearchIndexExternal : public SearchIndexIntf
101 SearchIndexExternal();
102 ~SearchIndexExternal();
103 void setCurrentDoc(Definition *ctx,const char *anchor,bool isSourceFile);
104 void addWord(const char *word,bool hiPriority);
105 void write(const char *file);
110 //------- client side search index ----------------------
112 void writeJavascriptSearchIndex();
113 void writeSearchCategories(FTextStream &t);