C
ckirchho
Hallo,
my task is to establish some kind of full text file search in
Javascript. The files and it's contents are fixed, the HTML/JavaScript
pages lie offline on a server.
As far as Javascript cannot access files via any i/o operations, I
have written a routine in Delphi. It parses files in one folder and
generates a Javascrip tfile. The first lines build up a file table,
then the word index is build.
Example:
addTable("Filename1.txt")
addTable("Filename2.txt")
....
addTable("Filenamen.txt")
addIndex("Word1", "1,5,9")
addIndex("Word2", "30,156,1002")
....
addIndex("Wordn", "40")
This script can be rather huge when there are lots of files and lots
of different words in those files. An example script I generated had
approx.160.000 lines.
In additon I wrote a Javascript that contains the needed functions for
building the search Index. When the HTML-file that should realize the
search is opened, the script I built with Delphi is opened and
executed, which calls the functions in the other Javascript and
generates the serach index in the working memory.
In Firefox, the script runs fine, but in IExplorer 7 I get an error
message stating an error in line 32769 of the Delphi generated script.
There is absolutely no error in this line, and I guess it has more to
do with some code line limit, because 32768 is a power of 2.
Is this a known Internet Explorer issue? WHat should I do as a work
around? subdivide the script in multiple scripts, each not longer than
32768 code lines, and than write a wrapper script that calls those
subdivided script?
Are there any other good approaches for buildung and using a search
index in Javascript for realizing a full text search?
Regards,
Christian Kirchhoff
my task is to establish some kind of full text file search in
Javascript. The files and it's contents are fixed, the HTML/JavaScript
pages lie offline on a server.
As far as Javascript cannot access files via any i/o operations, I
have written a routine in Delphi. It parses files in one folder and
generates a Javascrip tfile. The first lines build up a file table,
then the word index is build.
Example:
addTable("Filename1.txt")
addTable("Filename2.txt")
....
addTable("Filenamen.txt")
addIndex("Word1", "1,5,9")
addIndex("Word2", "30,156,1002")
....
addIndex("Wordn", "40")
This script can be rather huge when there are lots of files and lots
of different words in those files. An example script I generated had
approx.160.000 lines.
In additon I wrote a Javascript that contains the needed functions for
building the search Index. When the HTML-file that should realize the
search is opened, the script I built with Delphi is opened and
executed, which calls the functions in the other Javascript and
generates the serach index in the working memory.
In Firefox, the script runs fine, but in IExplorer 7 I get an error
message stating an error in line 32769 of the Delphi generated script.
There is absolutely no error in this line, and I guess it has more to
do with some code line limit, because 32768 is a power of 2.
Is this a known Internet Explorer issue? WHat should I do as a work
around? subdivide the script in multiple scripts, each not longer than
32768 code lines, and than write a wrapper script that calls those
subdivided script?
Are there any other good approaches for buildung and using a search
index in Javascript for realizing a full text search?
Regards,
Christian Kirchhoff