当前位置: 首页>>代码示例>>Java>>正文


Java Document.getValues方法代码示例

本文整理汇总了Java中org.apache.lucene.document.Document.getValues方法的典型用法代码示例。如果您正苦于以下问题:Java Document.getValues方法的具体用法?Java Document.getValues怎么用?Java Document.getValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.lucene.document.Document的用法示例。


在下文中一共展示了Document.getValues方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deletePrimary

import org.apache.lucene.document.Document; //导入方法依赖的package包/类
protected static Set<String> deletePrimary(Collection<String> nodeRefs, IndexReader reader, boolean delete)
        throws LuceneIndexException
{

    Set<String> refs = new LinkedHashSet<String>();

    for (String nodeRef : nodeRefs)
    {

        try
        {
            TermDocs td = reader.termDocs(new Term("PRIMARYPARENT", nodeRef));
            while (td.next())
            {
                int doc = td.doc();
                Document document = reader.document(doc);
                String[] ids = document.getValues("ID");
                refs.add(ids[ids.length - 1]);
                if (delete)
                {
                    reader.deleteDocument(doc);
                }
            }
            td.close();
        }
        catch (IOException e)
        {
            throw new LuceneIndexException("Failed to delete node by primary parent for " + nodeRef, e);
        }
    }

    return refs;

}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:35,代码来源:AbstractLuceneIndexerImpl.java

示例2: deleteReference

import org.apache.lucene.document.Document; //导入方法依赖的package包/类
protected static Set<String> deleteReference(Collection<String> nodeRefs, IndexReader reader, boolean delete)
        throws LuceneIndexException
{

    Set<String> refs = new LinkedHashSet<String>();

    for (String nodeRef : nodeRefs)
    {

        try
        {
            TermDocs td = reader.termDocs(new Term("PARENT", nodeRef));
            while (td.next())
            {
                int doc = td.doc();
                Document document = reader.document(doc);
                String[] ids = document.getValues("ID");
                refs.add(ids[ids.length - 1]);
                if (delete)
                {
                    reader.deleteDocument(doc);
                }
            }
            td.close();
        }
        catch (IOException e)
        {
            throw new LuceneIndexException("Failed to delete node by parent for " + nodeRef, e);
        }
    }

    return refs;

}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:35,代码来源:AbstractLuceneIndexerImpl.java

示例3: deleteContainerAndBelow

import org.apache.lucene.document.Document; //导入方法依赖的package包/类
protected static Set<String> deleteContainerAndBelow(String nodeRef, IndexReader reader, boolean delete,
        boolean cascade) throws LuceneIndexException
{
    Set<String> refs = new LinkedHashSet<String>();

    try
    {
        if (delete)
        {
            reader.deleteDocuments(new Term("ID", nodeRef));
        }
        refs.add(nodeRef);
        if (cascade)
        {
            TermDocs td = reader.termDocs(new Term("ANCESTOR", nodeRef));
            while (td.next())
            {
                int doc = td.doc();
                Document document = reader.document(doc);
                String[] ids = document.getValues("ID");
                refs.add(ids[ids.length - 1]);
                if (delete)
                {
                    reader.deleteDocument(doc);
                }
            }
            td.close();
        }
    }
    catch (IOException e)
    {
        throw new LuceneIndexException("Failed to delete container and below for " + nodeRef, e);
    }
    return refs;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:36,代码来源:AbstractLuceneIndexerImpl.java

示例4: getLinkAspects

import org.apache.lucene.document.Document; //导入方法依赖的package包/类
public String[] getLinkAspects(int n) throws IOException
{
    // return getStringValues(n, "LINKASPECT");
    Document d = document(n, new SingleFieldSelector("LINKASPECT", false));
    return d.getValues("LINKASPECT");
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:7,代码来源:ReferenceCountingReadOnlyIndexReaderFactory.java

示例5: getParents

import org.apache.lucene.document.Document; //导入方法依赖的package包/类
public String[] getParents(int n) throws IOException
{
    // return getStringValues(n, "PARENT");
    Document d = document(n, new SingleFieldSelector("PARENT", false));
    return d.getValues("PARENT");
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:7,代码来源:ReferenceCountingReadOnlyIndexReaderFactory.java


注:本文中的org.apache.lucene.document.Document.getValues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。