Menu

External Indexing works with test url encoding, but no results shown from html search box

2021-01-10
2022-03-04
  • Tom Williams

    Tom Williams - 2021-01-10

    Hello Everyone,
    I have been using doxygen for years, but just recently tried to get the external indexing to work. I have very carefully followed the directions here: https://www.doxygen.nl/manual/extsearch.html, and set up a clean linux server with apache just for testing this feature.

    The place I have been stuck on for many days now is that when I do a search from the search box on the html page, I a page with the title Search Results is display, but it is completely blank. This is what I know so far:
    - Running doxygen 1.8.20

    • HTML is generated on windows 10. Server is linux (Amazon AWS) using doxysearch.cgi

    • Tried converting searchdata.xml conversion with doxyindexer both from windows and on linux with same non-working results

    • If I do a html search for something I know is not in the index, the I get the proper "Sorry, no documents matching your query.".

    • If I do a command line test for "timer", things work fine: http://myserver/cgi-bin/doxysearch.cgi?q=timer&n=20&p=1&cb=dummy. I can see the JSON and all the appropriate results. The first few lines are:

    dummy({
      "hits":100,
      "first":20,
      "count":20,
      "page":1,
      "pages":5,
      "query": "timer",
      "items":[
      {"type": "page",
       "name": "examplesPage::exampleTimersGroup::exampleTimersGroup-Stopwatch",
       "tag": "",
       "url": "example_timers_group-_stopwatch.html",
       "fragments":[
       ]
      },
    
    • By debugging/stepping through the search.js code I think I see the problem. When using the html search on a value that is in the index, function(data) is never executed. But when something is not in the index, it is.
      Here is a snippet from the javascript debugger with a breakpoint at the function:
    function searchFor(query,page,count) {
      $.getJSON(serverUrl+"?cb=?",
      {
        n:count,
        p:page,
        q:query
      },
      function(data) {
        var results = $('#searchresults');
        $('#MSearchField').val(query);
    

    Here the values are: query = "timer", page = 0, count = 20. If I stop at this breakpoint, and change the value of page from 0 to 1, the page renders with all the correct results. In the case were the search term is not in the index, all the values are 0.

    I also used wireshark packet capture and verified all the correct data was being sent from the server to the client, the same data I see when I do the manual URL test.

    This really has me stuck, any ideas or comments are greatly appreciated. In the end what I'm looking for is a much better search function than the default. To summarize:
    - Get proper output when a search term is not in the index
    - Works with URL encoding with doxysearch.cgi
    - Search Result page is blank when a search is done with a term that is in the index

     

    Last edit: Tom Williams 2021-01-10
    • Tom Williams

      Tom Williams - 2021-01-10

      Found out a little more information. In search.js the $.getJSON(serverUrl+"?cb=?",...) function does not result in any "data" to process. The data variable is null.

      function searchFor(query,page,count) {
        $.getJSON(serverUrl+"?cb=?",
        {
          n:count,
          p:page,
          q:query
        },
        function(data) {
          var results = $('#searchresults');
      

      However, if the searchFor(query, 0, 20) function changes the page from 0 to 1, searchFor(query, 1, 20), then the data variable contains:

      data = {hits: 100, first: 20, count: 20, page: 1, pages: 5, …}

      like it should, so the page can be displayed.

       
      • gulabkhan

        gulabkhan - 2022-11-20
        Post awaiting moderation.
  • Tom Williams

    Tom Williams - 2021-01-10

    Narrowed it down. On the page 0 search for 20 entries, it gets to number 8 and doxysearch throws an error. This is the last entry, number 7, from the query, and the error message.

     {"type": "page",
       "name": "examplesPage::examplePlatformSpecificGroup::platformExamples-MCF::examplePulseGeneratorAndCounter-MCF",
       "tag": "",
       "url": "example_pulse_generator_and_counter.html",
       "fragments":[
         "... generate a waveform output on one <span class=\"hl\">timer</span> and use the <span class=\"hl\">timer</span> capture feature...",
         "... generate a waveform output on one <span class=\"hl\">timer</span> and use the <span class=\"hl\">timer</span> capture feature...",
         "... generate a waveform output on one <span class=\"hl\">timer</span> and use the <span class=\"hl\">timer</span> capture feature..."
       ]
      },
    ({"error":"Unknown Exception!"})
    

    Looks like its coming from doxysearch.cpp:

      catch (...) // Any other exception
      {
        showError(callback,"Unknown Exception!");
        exit(1);
      }
    
     
  • joekyle

    joekyle - 2022-04-07
    Post awaiting moderation.

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.