本文整理汇总了Java中org.apache.lucene.index.IndexWriter.MaxFieldLength类的典型用法代码示例。如果您正苦于以下问题:Java MaxFieldLength类的具体用法?Java MaxFieldLength怎么用?Java MaxFieldLength使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MaxFieldLength类属于org.apache.lucene.index.IndexWriter包,在下文中一共展示了MaxFieldLength类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: rollback
import org.apache.lucene.index.IndexWriter.MaxFieldLength; //导入依赖的package包/类
@Override
public void rollback(Xid xid) throws XAException {
logger.finest("Rolling back Lucene index writer");
changeState(xid, EnumSet.of(TransactionState.IDLE,
TransactionState.PREPARED, TransactionState.ROLLBACK_ONLY), null);
try {
Directory directory = writer.getDirectory();
Analyzer analyzer = writer.getAnalyzer();
MaxFieldLength maxfieldLength = new MaxFieldLength(writer.getMaxFieldLength());
writer.rollback();
// IndexWriter.rollback() automatically closes the writer so reopen it.
logger.finest("Opening new Lucene index writer after rollback");
writer = new IndexWriter(directory, analyzer, maxfieldLength);
listener.afterRollback(writer);
} catch (Exception e) {
logger.log(Level.WARNING, "Failed to rollback and reopen Lucene index writer", e);
throw newXAException(XAException.XAER_RMERR, e);
} finally {
clearXid();
}
}
开发者ID:Novartis,项目名称:ontobrowser,代码行数:26,代码来源:LuceneIndexWriterXAResource.java
示例2: makeDeltaIndexWriter
import org.apache.lucene.index.IndexWriter.MaxFieldLength; //导入依赖的package包/类
/**
* Make a lucene index writer
*
* @param location File
* @param analyzer Analyzer
* @return IndexWriter
* @throws IOException
*/
private IndexWriter makeDeltaIndexWriter(File location, Analyzer analyzer) throws IOException
{
IndexWriter writer;
if (!IndexReader.indexExists(location))
{
writer = new IndexWriter(location, analyzer, true, MaxFieldLength.LIMITED);
}
else
{
writer = new IndexWriter(location, analyzer, false, MaxFieldLength.LIMITED);
}
writer.setUseCompoundFile(writerUseCompoundFile);
writer.setMaxBufferedDocs(writerMaxBufferedDocs);
writer.setRAMBufferSizeMB(writerRamBufferSizeMb);
writer.setMergeFactor(writerMergeFactor);
writer.setMaxMergeDocs(writerMaxMergeDocs);
writer.setWriteLockTimeout(writeLockTimeout);
writer.setMaxFieldLength(maxFieldLength);
writer.setTermIndexInterval(termIndexInterval);
writer.setMergeScheduler(new SerialMergeScheduler());
writer.setMergePolicy(new LogDocMergePolicy());
return writer;
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:33,代码来源:IndexInfo.java
示例3: getIndexWriter
import org.apache.lucene.index.IndexWriter.MaxFieldLength; //导入依赖的package包/类
private IndexWriter getIndexWriter(String name) {
try {
if (!indexWriters.containsKey(name)) {
synchronized (this) {
File root = new File(DATA_PATH, name);
if (!root.exists())
root.mkdirs();
if (new File(root, "write.lock").exists())
new File(root, "write.lock").delete();
IndexWriter writer = new IndexWriter(FSDirectory.open(root), Search.getAnalyser(), MaxFieldLength.UNLIMITED);
indexWriters.put(name, writer);
}
}
return indexWriters.get(name);
} catch (Exception e) {
throw new UnexpectedException(e);
}
}
开发者ID:eBay,项目名称:restcommander,代码行数:19,代码来源:FilesystemStore.java
示例4: run
import org.apache.lucene.index.IndexWriter.MaxFieldLength; //导入依赖的package包/类
public IStatus run(IProgressMonitor monitor)
{
IndexWriter writer = null;
IStatus status = Status.OK_STATUS;
try {
monitor.beginTask(EclipseNSISPlugin.getResourceString("nsis.help.indexer.task.title"),IProgressMonitor.UNKNOWN); //$NON-NLS-1$
if(mIndexLocation.exists()) {
mIndexLocation.mkdirs();
}
writer = new IndexWriter(new SimpleFSDirectory(mIndexLocation),
mAnalyzer, true, MaxFieldLength.LIMITED);
writer.setMaxFieldLength(1000000);
status = indexDocs(monitor, writer, mDocumentRoot);
if(status.isOK()) {
writer.optimize();
}
}
catch(Exception ex) {
EclipseNSISPlugin.getDefault().log(ex);
status = new Status(IStatus.ERROR, INSISConstants.PLUGIN_ID, IStatus.ERROR, ex.getMessage(), ex);
IOUtility.deleteDirectory(mIndexLocation);
}
finally {
if(writer != null) {
try {
writer.close();
}
catch (IOException e) {
EclipseNSISPlugin.getDefault().log(e);
}
}
monitor.done();
if(monitor.isCanceled()) {
status = Status.CANCEL_STATUS;
IOUtility.deleteDirectory(mIndexLocation);
}
}
return status;
}
开发者ID:henrikor2,项目名称:eclipsensis,代码行数:41,代码来源:NSISHelpIndexer.java
示例5: SpatialLuceneExample
import org.apache.lucene.index.IndexWriter.MaxFieldLength; //导入依赖的package包/类
SpatialLuceneExample() throws IOException {
directory = new RAMDirectory();
writer = new IndexWriter(directory, new WhitespaceAnalyzer(Version.LUCENE_41),
MaxFieldLength.UNLIMITED);
}
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:6,代码来源:SpatialLuceneExample.java
注:本文中的org.apache.lucene.index.IndexWriter.MaxFieldLength类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论