IndexDatabase.java revision 1016
58N/A * See LICENSE.txt included in this distribution for the specific
58N/A * file and include the License file at LICENSE.txt.
1356N/Apublic class IndexDatabase {
773N/A private boolean interrupted;
253N/A initialize();
1190N/A static void updateAll(ExecutorService executor, IndexChangedListener listener) throws IOException {
1327N/A public static void update(ExecutorService executor, IndexChangedListener listener, List<String> paths) throws IOException {
1185N/A } catch (IOException e) {
816N/A throw new FileNotFoundException("Failed to create root directory [" + indexDir.getAbsolutePath() + "]");
816N/A throw new FileNotFoundException("Failed to create root directory [" + spellDir.getAbsolutePath() + "]");
773N/A interrupted = false;
58N/A //TODO we might need to add writer.commit after certain phases of index generation, right now it will only happen in the end
58N/A writer = new IndexWriter(indexDirectory, AnalyzerGuru.getAnalyzer(),IndexWriter.MaxFieldLength.UNLIMITED);
58N/A while (uidIter.term() != null && uidIter.term().field().equals("u") && uidIter.term().text().startsWith(startuid)) {
58N/A removeFile();
58N/A } catch (IOException e) {
65N/A } catch (IOException e) {
99N/A log.warning("Failed to set last modified time on '" + timestamp.getAbsolutePath() + "', used for timestamping the index database.");
99N/A log.warning("Failed to create file '" + timestamp.getAbsolutePath() + "', used for timestamping the index database.");
129N/A } catch (IOException e) {
129N/A } catch (IOException e) {
318N/A public void createSpellingSuggestions() {
173N/A } catch (IOException e) {
173N/A } catch (IOException e) {
480N/A } catch (IOException e) {
1299N/A //below will only let go files and directories, anything else is considered special and is not added
1326N/A private boolean acceptSymlink(String absolutePath, String canonicalPath) throws IOException {
1326N/A absolutePath.substring(allowedSymlink.length()).equals(canonicalPath.substring(allowedTarget.length()))) {
1326N/A if (isInterrupted()) {
1016N/A String uid = Util.uid(path, DateTools.timeToString(file.lastModified(), DateTools.Resolution.MILLISECOND)); // construct uid for doc
640N/A interrupted = true;
937N/A private boolean isInterrupted() {
639N/A return interrupted;
} catch (IOException e) {
} catch (IOException e) {
} catch (IOException e) {
} catch (IOException e) {
if (p == null) {
return null;
return ret;
if (this.project != other.project && (this.project == null || !this.project.equals(other.project))) {
public int hashCode() {
return hash;