public void addIndexEntry(char[] category, char[] key, String containerRelativePath) { this.memoryIndex.addIndexEntry(category, key, containerRelativePath); } public String containerRelativePath(String documentPath) {
public boolean hasChanged() { return this.memoryIndex.hasChanged(); } /**
public void remove(String containerRelativePath) { this.memoryIndex.remove(containerRelativePath); } /**
if (this.memoryIndex.shouldMerge() && this.monitor.exitReadEnterWrite()) { try { save(); if (this.memoryIndex.hasChanged()) { results = this.diskIndex.addQueryResults(categories, key, rule, this.memoryIndex); results = this.memoryIndex.addQueryResults(categories, key, rule, results); } else { results = this.diskIndex.addQueryResults(categories, key, rule, null);
/** * Returns the document names that contain the given substring, if null then returns all of them. */ public String[] queryDocumentNames(String substring) throws IOException { SimpleSet results; if (this.memoryIndex.hasChanged()) { results = this.diskIndex.addDocumentNames(substring, this.memoryIndex); this.memoryIndex.addDocumentNames(substring, results); } else { results = this.diskIndex.addDocumentNames(substring, null); } if (results.elementSize == 0) return null; String[] documentNames = new String[results.elementSize]; int count = 0; Object[] paths = results.values; for (int i = 0, l = paths.length; i < l; i++) if (paths[i] != null) documentNames[count++] = (String) paths[i]; return documentNames; } public void remove(String containerRelativePath) {
public void save() throws IOException { // must own the write lock of the monitor if (!hasChanged()) return; int numberOfChanges = this.memoryIndex.docsToReferences.elementSize; this.diskIndex.separator = this.separator; this.diskIndex = this.diskIndex.mergeWith(this.memoryIndex); this.memoryIndex = new MemoryIndex(); if (numberOfChanges > 1000) System.gc(); // reclaim space if the MemoryIndex was very BIG } public void startQuery() {
if (this.memoryIndex.shouldMerge() && this.monitor.exitReadEnterWrite()) { try { save(); if (this.memoryIndex.hasChanged()) { results = this.diskIndex.addQueryResults(categories, key, rule, this.memoryIndex); results = this.memoryIndex.addQueryResults(categories, key, rule, results); } else { results = this.diskIndex.addQueryResults(categories, key, rule, null);
/** * Returns the document names that contain the given substring, if null then returns all of them. */ public String[] queryDocumentNames(String substring) throws IOException { SimpleSet results; if (this.memoryIndex.hasChanged()) { results = this.diskIndex.addDocumentNames(substring, this.memoryIndex); this.memoryIndex.addDocumentNames(substring, results); } else { results = this.diskIndex.addDocumentNames(substring, null); } if (results.elementSize == 0) return null; String[] documentNames = new String[results.elementSize]; int count = 0; Object[] paths = results.values; for (int i = 0, l = paths.length; i < l; i++) if (paths[i] != null) documentNames[count++] = (String) paths[i]; return documentNames; } public void remove(String containerRelativePath) {
public void save() throws IOException { // must own the write lock of the monitor if (!hasChanged()) return; int numberOfChanges = this.memoryIndex.docsToReferences.elementSize; this.diskIndex.separator = this.separator; this.diskIndex = this.diskIndex.mergeWith(this.memoryIndex); this.memoryIndex = new MemoryIndex(); if (numberOfChanges > 1000) System.gc(); // reclaim space if the MemoryIndex was very BIG } public void startQuery() {
if (this.memoryIndex.shouldMerge() && this.monitor.exitReadEnterWrite()) { try { save(); if (this.memoryIndex.hasChanged()) { results = this.diskIndex.addQueryResults(categories, key, rule, this.memoryIndex); results = this.memoryIndex.addQueryResults(categories, key, rule, results); } else { results = this.diskIndex.addQueryResults(categories, key, rule, null);
/** * Returns the document names that contain the given substring, if null then returns all of them. */ public String[] queryDocumentNames(String substring) throws IOException { SimpleSet results; if (this.memoryIndex.hasChanged()) { results = this.diskIndex.addDocumentNames(substring, this.memoryIndex); this.memoryIndex.addDocumentNames(substring, results); } else { results = this.diskIndex.addDocumentNames(substring, null); } if (results.elementSize == 0) return null; String[] documentNames = new String[results.elementSize]; int count = 0; Object[] paths = results.values; for (int i = 0, l = paths.length; i < l; i++) if (paths[i] != null) documentNames[count++] = (String) paths[i]; return documentNames; } public void remove(String containerRelativePath) {
public void save() throws IOException { // must own the write lock of the monitor if (!hasChanged()) return; int numberOfChanges = this.memoryIndex.docsToReferences.elementSize; this.diskIndex.separator = this.separator; this.diskIndex = this.diskIndex.mergeWith(this.memoryIndex); this.memoryIndex = new MemoryIndex(); if (numberOfChanges > 1000) System.gc(); // reclaim space if the MemoryIndex was very BIG } public void startQuery() {
public void remove(String containerRelativePath) { this.memoryIndex.remove(containerRelativePath); } /**
public void addIndexEntry(char[] category, char[] key, String containerRelativePath) { this.memoryIndex.addIndexEntry(category, key, containerRelativePath); } public String containerRelativePath(String documentPath) {
public boolean hasChanged() { return this.memoryIndex.hasChanged(); } /**
if (this.memoryIndex.shouldMerge() && this.monitor.exitReadEnterWrite()) { try { save(); if (this.memoryIndex.hasChanged()) { results = this.diskIndex.addQueryResults(categories, key, rule, this.memoryIndex); results = this.memoryIndex.addQueryResults(categories, key, rule, results); } else { results = this.diskIndex.addQueryResults(categories, key, rule, null);
/** * Returns the document names that contain the given substring, if null then returns all of them. */ public String[] queryDocumentNames(String substring) throws IOException { SimpleSet results; if (this.memoryIndex.hasChanged()) { results = this.diskIndex.addDocumentNames(substring, this.memoryIndex); this.memoryIndex.addDocumentNames(substring, results); } else { results = this.diskIndex.addDocumentNames(substring, null); } if (results.elementSize == 0) return null; String[] documentNames = new String[results.elementSize]; int count = 0; Object[] paths = results.values; for (int i = 0, l = paths.length; i < l; i++) if (paths[i] != null) documentNames[count++] = (String) paths[i]; return documentNames; } public void remove(String containerRelativePath) {
public void save() throws IOException { // must own the write lock of the monitor if (!hasChanged()) return; int numberOfChanges = this.memoryIndex.docsToReferences.elementSize; this.diskIndex.separator = this.separator; this.diskIndex = this.diskIndex.mergeWith(this.memoryIndex); this.memoryIndex = new MemoryIndex(); if (numberOfChanges > 1000) System.gc(); // reclaim space if the MemoryIndex was very BIG } public void startQuery() {
public void remove(String containerRelativePath) { this.memoryIndex.remove(containerRelativePath); } /**
public void addIndexEntry(char[] category, char[] key, String containerRelativePath) { this.memoryIndex.addIndexEntry(category, key, containerRelativePath); } public String containerRelativePath(String documentPath) {