Skip to content

Commit 8e3f835

Browse files
committed
Incorrect searchdata.xml for mainpage in case of external search
When having a problem like: ``` \mainpage main_t main_b ``` and we use an empty `Doxyfile` with just external search settings: ``` QUIET = YES SERVER_BASED_SEARCH = YES EXTERNAL_SEARCH = YES SEARCHENGINE_URL = http://localhost/cgi-bin/doxysearch.cgi ``` we get in the `searchdata.xml`: ``` <?xml version="1.0" encoding="UTF-8"?> <add> <doc> <field name="type">page</field> <field name="name">main_t</field> <field name="url">index.html</field> <field name="keywords"></field> <field name="text">main_t main_b main_b</field> </doc> </add> ``` We see here: - missing "keywords" - content of "text" where only `main_b` is expected. so like: ``` <field name="keywords">main_t</field> <field name="text">main_b</field> ```
1 parent 9b51550 commit 8e3f835

File tree

3 files changed

+49
-13
lines changed

3 files changed

+49
-13
lines changed

src/doxygen.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7696,6 +7696,25 @@ static void addToIndices()
76967696
}
76977697
}
76987698

7699+
if (Doxygen::mainPage)
7700+
{
7701+
Doxygen::indexList->addIndexItem(Doxygen::mainPage.get(),nullptr,QCString(),filterTitle(Doxygen::mainPage->title()));
7702+
if (Doxygen::searchIndex)
7703+
{
7704+
Doxygen::searchIndex->setCurrentDoc(Doxygen::mainPage.get(),Doxygen::mainPage->anchor(),FALSE);
7705+
std::string title = Doxygen::mainPage->title().str();
7706+
static const reg::Ex re(R"(\a[\w-]*)");
7707+
reg::Iterator it(title,re);
7708+
reg::Iterator end;
7709+
for (; it!=end ; ++it)
7710+
{
7711+
const auto &match = *it;
7712+
std::string matchStr = match.str();
7713+
Doxygen::searchIndex->addWord(matchStr.c_str(),TRUE);
7714+
}
7715+
}
7716+
}
7717+
76997718
for (const auto &pd : *Doxygen::pageLinkedMap)
77007719
{
77017720
if (pd->isLinkableInProject())

src/index.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4780,8 +4780,8 @@ static void writeIndex(OutputList &ol)
47804780
ol.startHeaderSection();
47814781
ol.startTitleHead(QCString());
47824782
ol.generateDoc(Doxygen::mainPage->docFile(),Doxygen::mainPage->getStartBodyLine(),
4783-
Doxygen::mainPage.get(),nullptr,Doxygen::mainPage->title(),TRUE,FALSE,
4784-
QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
4783+
Doxygen::mainPage.get(),nullptr,Doxygen::mainPage->title(),false,false,
4784+
QCString(),true,false,Config_getBool(MARKDOWN_SUPPORT));
47854785
headerWritten = TRUE;
47864786
}
47874787
}
@@ -4816,8 +4816,8 @@ static void writeIndex(OutputList &ol)
48164816

48174817
ol.startTextBlock();
48184818
ol.generateDoc(defFileName,defLine,Doxygen::mainPage.get(),nullptr,
4819-
Doxygen::mainPage->documentation(),TRUE,FALSE,
4820-
QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
4819+
Doxygen::mainPage->documentation(),true,false,
4820+
QCString(),false,false,Config_getBool(MARKDOWN_SUPPORT));
48214821
ol.endTextBlock();
48224822
ol.endPageDoc();
48234823
}
@@ -4861,8 +4861,8 @@ static void writeIndex(OutputList &ol)
48614861
if (!Config_getString(PROJECT_NUMBER).isEmpty())
48624862
{
48634863
ol.startProjectNumber();
4864-
ol.generateDoc(defFileName,defLine,Doxygen::mainPage.get(),nullptr,Config_getString(PROJECT_NUMBER),FALSE,FALSE,
4865-
QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
4864+
ol.generateDoc(defFileName,defLine,Doxygen::mainPage.get(),nullptr,Config_getString(PROJECT_NUMBER),false,false,
4865+
QCString(),false,false,Config_getBool(MARKDOWN_SUPPORT));
48664866
ol.endProjectNumber();
48674867
}
48684868
ol.endIndexSection(IndexSection::isTitlePageStart);

src/pagedef.cpp

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -305,19 +305,36 @@ void PageDefImpl::writePageDocumentation(OutputList &ol) const
305305
ol.writeString(" - ");
306306
ol.popGeneratorState();
307307
}
308-
ol.generateDoc(
308+
ol.disableAllBut(OutputType::Html);
309+
ol.generateDoc(
309310
docFile(), // fileName
310311
docLine(), // startLine
311312
this, // context
312-
nullptr, // memberdef
313+
nullptr, // memberdef
313314
docStr, // docStr
314-
TRUE, // index words
315-
FALSE, // not an example
316-
QCString(), // exampleName
317-
FALSE, // singleLine
318-
FALSE, // linkFromIndex
315+
true, // index words
316+
false, // not an example
317+
QCString(), // exampleName
318+
false, // singleLine
319+
false, // linkFromIndex
319320
TRUE // markdown support
320321
);
322+
ol.enableAll();
323+
ol.disable(OutputType::Html);
324+
ol.generateDoc(
325+
docFile(), // fileName
326+
docLine(), // startLine
327+
this, // context
328+
nullptr, // memberdef
329+
docStr, // docStr
330+
false, // index words
331+
false, // not an example
332+
QCString(), // exampleName
333+
false, // singleLine
334+
false, // linkFromIndex
335+
TRUE // markdown support
336+
);
337+
ol.enable(OutputType::Html);
321338
ol.endTextBlock();
322339

323340
if (hasSubPages())

0 commit comments

Comments
 (0)