Hallo,
I have a problem with the search module. The search displays javascript code from my little extra pages which I call by require_once().

Is that a bug of the search.module?
How can I exclude certain nodes from being indexed or - better - make the module ignoring javascript code?

I searched the forums and the whole drupal site but couldn't find any real help to this. (There is also one similar (and open) request on this issue: http://drupal.org/node/55971)

I would be very thankful for help.
thanks in advance

Comments

magico’s picture

Category: bug » support

It's strange. Javascript is a theme thing, while the search uses the node content to generate it's index.
Where are you putting your javascript code?

hausig’s picture

Hi, thanks a lot for your reply.

I kind of solved the problem.
First, I put the javascript in one of my own html scripts (in front of a form) directly. (They are called by require_once('xyz') from a Durupal page/node. That caused the search to index the javascript, too. (Actually, the search does not index html but javascript. Is it possible that the search recognizes html code to exclude from indexing but not code between other tags like "

?) Now, I put the javascript in an extra file xyz.js and call the required functions in a html script by using:

. Now, the problem seems to be solved.

magico’s picture

Status: Active » Fixed

Ah I now understand. Anyway, the solution you used for last is the best one because we should always put javascript in separated files: for gracefull downgrade to browsers that do not support it and also for better re-use of javascript files (that will be cached by any browser).

I will mark this as fixed, and anyone that wants to use javascript should always use a separated file that will do dynamic attach to HTML document elements.

Anonymous’s picture

Status: Fixed » Closed (fixed)