Hello. I have an intranet set up that is using mediawiki behind the scenes for content. I set up a search box on the intranet pages, that calls the api query module twice, first for title, then for text. I then take all the text matches and call the index.php render module to get the page text, so I can parse it for the searched term and highlight it in the results. I then sort all the title and page text matches alphabetically by the page titles. This all kind of works as intended, but seems like a crazy amount of hackery, so I’m hoping there’s a better way. If not, then maybe you can help me solve these issues:
1) The highlighted search results include html and wikitext code because it’s produced by index.php’s render. Using strip_tags() helps a little, but only when the matched string has both brackets ( < > ).
2) Categories show up as page title matches if I search on the regular wiki page, but not when I go through the api. I assume the wiki code is just also doing a category search and displaying it in the page title section?
I think I’m also going to split up my title and text search results. I had them combined as that’s what the users are used to in a previous system, but I think that just destroys whatever ranking system the search is using. Right?