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.