We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36404
    • 307 Posts
    Hi,

    one more question about AjaxSearch that i post in a different thread because it has nothing to do with my custom tables one

    when i have a try at a search that mustn’t have any result, say "toto" for example, the favorite French devs var smiley it returns three pages in the result. Of course, to be sure of what i say i’ve search if ever i would have forgotten some toto here and there in the page and... no, the browser search doesn’t return anything.

    Well, some more investigation shows that i’ve a totop css class <p class="toTop" exactly in the source code of those pages, then my question is "it seeems that the search does’nt exclude the html tags, is it possible to do so as it could give some really confusing result when giving the css classes understandable names (what is known as a good practice smiley ?"

    thanks again for any idea smiley

    have swing
      réfléchir avant d'agir
      • 5811
      • 1,717 Posts
      my question is "it seeems that the search does’nt exclude the html tags
      It’s true, if some fields, for instance the content field of the site_content table, contains html tags, then Mysql found the search terms even if they are part of an html tags (e.g src, div, img, ... but also the class names).

      is it possible to do so as it could give some really confusing result when giving the css classes understandable names
      Following your post, I am currently testing to filter the Mysql results in order to exclude the results when the search terms are only part of a html tag.

      For this I do as follow:
      - set up a text string which is the concatenation of all the displayed fields results
      - strip html tag from the text string
      - search the search terms in the text string
      - exclude the result if no search terms found (because this means that they were part of html tags)

      This run perfectly but I see two limitations/impacts:
      - The list of searchable fields should be a sub-list of the displayed fields.
      - And now the "nowords" group of results is not the complement of the "oneword" group of results, when a searchterm is found inside an html or MODx tag.

      I think that these two limitations/impacts are acceptables regarding the fact we exclude unwanted documents.
      And this filtering impact very few the performance ( 10/30 millisecondes / result, depending of the lenght of the document and the position of the search term).

      I will implement this with the ajaxSearch 1.9.0.
        • 5811
        • 1,717 Posts

        I will implement this with the ajaxSearch 1.9.0.
        Done with AjaxSearch190 #6955

        To see the differences, run a basic search with the searchterm "src" with AS 184. And the same test with AS 190.
          • 36404
          • 307 Posts
          hi coroico,

          thanks a lot for all your answers (about custom tables and this source code search question)

          i’m going to have a try at upgrading my website snippet ajaxSearch and play with it

          thanks a lot, really useful snippet, the least i can say, really great job smiley

          have swing
            réfléchir avant d'agir