searchindex.java
来自「jsr170接口的java实现。是个apache的开源项目。」· Java 代码 · 共 1,046 行 · 第 1/3 页
JAVA
1,046 行
* <ul> * <li>the class must exist in the class path</li> * <li>the class must have a public default constructor</li> * <li>the class must be a Lucene Analyzer</li> * </ul> * <p> * If the above conditions are met, then a new instance of the class is * set as the analyzer. Otherwise a warning is logged and the current * analyzer is not changed. * <p> * This property setter method is normally invoked by the Jackrabbit * configuration mechanism if the "analyzer" parameter is set in the * search configuration. * * @param analyzerClassName the analyzer class name */ public void setAnalyzer(String analyzerClassName) { try { Class analyzerClass = Class.forName(analyzerClassName); analyzer = (Analyzer) analyzerClass.newInstance(); } catch (Exception e) { log.warn("Invalid Analyzer class: " + analyzerClassName, e); } } /** * Returns the class name of the analyzer that is currently in use. * * @return class name of analyzer in use. */ public String getAnalyzer() { return analyzer.getClass().getName(); } /** * Sets the location of the search index. * * @param path the location of the search index. */ public void setPath(String path) { this.path = path; } /** * Returns the location of the search index. Returns <code>null</code> if * not set. * * @return the location of the search index. */ public String getPath() { return path; } /** * The lucene index writer property: useCompoundFile */ public void setUseCompoundFile(boolean b) { useCompoundFile = b; } /** * Returns the current value for useCompoundFile. * * @return the current value for useCompoundFile. */ public boolean getUseCompoundFile() { return useCompoundFile; } /** * The lucene index writer property: minMergeDocs */ public void setMinMergeDocs(int minMergeDocs) { this.minMergeDocs = minMergeDocs; } /** * Returns the current value for minMergeDocs. * * @return the current value for minMergeDocs. */ public int getMinMergeDocs() { return minMergeDocs; } /** * Sets the property: volatileIdleTime * * @param volatileIdleTime idle time in seconds */ public void setVolatileIdleTime(int volatileIdleTime) { this.volatileIdleTime = volatileIdleTime; } /** * Returns the current value for volatileIdleTime. * * @return the current value for volatileIdleTime. */ public int getVolatileIdleTime() { return volatileIdleTime; } /** * The lucene index writer property: maxMergeDocs */ public void setMaxMergeDocs(int maxMergeDocs) { this.maxMergeDocs = maxMergeDocs; } /** * Returns the current value for maxMergeDocs. * * @return the current value for maxMergeDocs. */ public int getMaxMergeDocs() { return maxMergeDocs; } /** * The lucene index writer property: mergeFactor */ public void setMergeFactor(int mergeFactor) { this.mergeFactor = mergeFactor; } /** * Returns the current value for the merge factor. * * @return the current value for the merge factor. */ public int getMergeFactor() { return mergeFactor; } /** * @see VolatileIndex#setBufferSize(int) */ public void setBufferSize(int size) { bufferSize = size; } /** * Returns the current value for the buffer size. * * @return the current value for the buffer size. */ public int getBufferSize() { return bufferSize; } public void setRespectDocumentOrder(boolean docOrder) { documentOrder = docOrder; } public boolean getRespectDocumentOrder() { return documentOrder; } public void setForceConsistencyCheck(boolean b) { forceConsistencyCheck = b; } public boolean getForceConsistencyCheck() { return forceConsistencyCheck; } public void setAutoRepair(boolean b) { autoRepair = b; } public boolean getAutoRepair() { return autoRepair; } public void setCacheSize(int size) { cacheSize = size; } public int getCacheSize() { return cacheSize; } public void setMaxFieldLength(int length) { maxFieldLength = length; } public int getMaxFieldLength() { return maxFieldLength; } /** * Sets the list of text extractors (and text filters) to use for * extracting text content from binary properties. The list must be * comma (or whitespace) separated, and contain fully qualified class * names of the {@link TextExtractor} (and {@link org.apache.jackrabbit.core.query.TextFilter}) classes * to be used. The configured classes must all have a public default * constructor. * * @param filterClasses comma separated list of class names */ public void setTextFilterClasses(String filterClasses) { this.textFilterClasses = filterClasses; } /** * Returns the fully qualified class names of the text filter instances * currently in use. The names are comma separated. * * @return class names of the text filters in use. */ public String getTextFilterClasses() { return textFilterClasses; } /** * Tells the query handler how many result should be fetched initially when * a query is executed. * * @param size the number of results to fetch initially. */ public void setResultFetchSize(int size) { resultFetchSize = size; } /** * @return the number of results the query handler will fetch initially when * a query is executed. */ public int getResultFetchSize() { return resultFetchSize; } /** * The number of background threads for the extractor pool. * * @param numThreads the number of threads. */ public void setExtractorPoolSize(int numThreads) { if (numThreads < 0) { numThreads = 0; } extractorPoolSize = numThreads; } /** * @return the size of the thread pool which is used to run the text * extractors when binary content is indexed. */ public int getExtractorPoolSize() { return extractorPoolSize; } /** * The number of extractor jobs that are queued until a new job is executed * with the current thread instead of using the thread pool. * * @param backLog size of the extractor job queue. */ public void setExtractorBackLogSize(int backLog) { extractorBackLog = backLog; } /** * @return the size of the extractor queue back log. */ public int getExtractorBackLogSize() { return extractorBackLog; } /** * The timeout in milliseconds which is granted to the text extraction * process until fulltext indexing is deferred to a background thread. * * @param timeout the timeout in milliseconds. */ public void setExtractorTimeout(long timeout) { extractorTimeout = timeout; } /** * @return the extractor timeout in milliseconds. */ public long getExtractorTimeout() { return extractorTimeout; } /** * If set to <code>true</code> additional information is stored in the index * to support highlighting using the rep:excerpt pseudo property. * * @param b <code>true</code> to enable highlighting support. */ public void setSupportHighlighting(boolean b) { supportHighlighting = b; } /** * @return <code>true</code> if highlighting support is enabled. */ public boolean getSupportHighlighting() { return supportHighlighting; } /** * Sets the class name for the {@link ExcerptProvider} that should be used * for the rep:excerpt pseudo property in a query. * * @param className the name of a class that implements {@link * ExcerptProvider}. */ public void setExcerptProviderClass(String className) { try { Class clazz = Class.forName(className); if (ExcerptProvider.class.isAssignableFrom(clazz)) { excerptProviderClass = clazz; } else { log.warn("Invalid value for excerptProviderClass, {} does " + "not implement ExcerptProvider interface.", className); } } catch (ClassNotFoundException e) { log.warn("Invalid value for excerptProviderClass, class {} not " + "found.", className); } } /** * @return the class name of the excerpt provider implementation. */ public String getExcerptProviderClass() { return excerptProviderClass.getName(); } //----------------------------< internal >---------------------------------- /** * Checks if this <code>SearchIndex</code> is open, otherwise throws * an <code>IOException</code>. * * @throws IOException if this <code>SearchIndex</code> had been closed. */ private void checkOpen() throws IOException { if (closed) { throw new IOException("query handler closed and cannot be used anymore."); } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?