add: * @param {Boolean} create True to create the index (overwriting an * existing index), false to append to an existing index. 
context: helma.Search.Index = function(directory, analyzer) {    /**     * Tries to create a new IndexWriter or IndexModifier for up to the     * number of milliseconds defined in helma.Search.Index.LOCK_TIMEOUT.     * @private     */    var getWriterModifier = function(what, create) {        var waitFor, elapsed = 0;        while (elapsed < helma.Search.Index.LOCK_TIMEOUT) {            if (!this.isLocked()) {                return new Packages.org.apache.lucene.index[what](directory,                                   analyzer, create == true ? true : false);            } else {                waitFor = Math.round(Math.random() * 100) + 50;                java.lang.Thread.sleep(waitFor);                elapsed += waitFor;                app.logger.debug("[Thread " + java.lang.Thread.currentThread().getId()                                 + "] waiting for " + elapsed + "ms");            }        }        throw("Failed to create " + what + " due to active lock (Thread "              + java.lang.Thread.currentThread().getId() + ")");    };    /**     * Returns an IndexModifier instance for adding or deleting     * documents to resp. from the underlying index. If the     * index is currently locked this method will try for the next     * two seconds to create the IndexModifier, otherwise it will     * throw an error.     * @returns An IndexModifier instance.     * @type org.apache.lucene.index.IndexModifier     */    this.getModifier = function(create) {        return getWriterModifier.call(this, "IndexModifier", create);    };    /**     * Returns an IndexWriter instance that can be used to add documents to     * the underlying index or to perform various other modifying operations.     * If the index is currently locked this method will try for the next     * two seconds to create the IndexWriter, otherwise it will     * throw an error.     * @returns An IndexWriter instance.     * @type org.apache.lucene.index.IndexWriter     */    this.getWriter = function(create) {        return getWriterModifier.call(this, "IndexWriter", create);    };    /**     * Returns an IndexReader instance. Due to locking issues an     * IndexModifier should be used for deleting documents.     * @returns An IndexReader instance     * @type org.apache.lucene.index.IndexReader     */    this.getReader = function() {        return Packages.org.apache.lucene.index.IndexReader.open(directory);    };    /**     * Returns the directory the underlying Lucene index is located at.     * @returns The directory of this index     * @type org.apache.lucene.store.Directory     */    this.getDirectory = function() {        return directory;    };    /**     * Returns the analyzer used within this index.     * @returns The analyzer used within this index.     * @type org.apache.lucene.analysis.Analyer     */    this.getAnalyzer = function() {        return analyzer;    };        /**     * Returns a searcher for querying this index.     * @returns A searcher useable for querying the index.     * @type helma.Search.Searcher     */    this.getSearcher = function() {        return new helma.Search.Searcher(this);    };        /** @ignore */    this.toString = function() {        return ("[Lucene Index " + directory + "]");    };    return this;};
meta: 2504	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/2504/cd05f1679b99c384278e2ea30a39494334ce834b/Search.js/buggy/helma/Search.js