• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PerFieldAnalyzerWrapper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.lucene.analysis.PerFieldAnalyzerWrapper的典型用法代码示例。如果您正苦于以下问题:Java PerFieldAnalyzerWrapper类的具体用法?Java PerFieldAnalyzerWrapper怎么用?Java PerFieldAnalyzerWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PerFieldAnalyzerWrapper类属于org.apache.lucene.analysis包,在下文中一共展示了PerFieldAnalyzerWrapper类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testAnalyzer

import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入依赖的package包/类
public void testAnalyzer() throws Exception {
  Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_41);
  String queryString = "category:/philosophy/eastern";

  Query query = new QueryParser(Version.LUCENE_41,
                                "contents",
                                analyzer).parse(queryString);
  assertEquals("path got split, yikes!",
               "category:\"philosophy eastern\"",
               query.toString("contents"));

  PerFieldAnalyzerWrapper perFieldAnalyzer =
                          new PerFieldAnalyzerWrapper(analyzer);
  perFieldAnalyzer.addAnalyzer("category",
                                     new WhitespaceAnalyzer(Version.LUCENE_41));
  query = new QueryParser(Version.LUCENE_41,
                          "contents",
                          perFieldAnalyzer).parse(queryString);
  assertEquals("leave category field alone",
               "category:/philosophy/eastern",
               query.toString("contents"));
}
 
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:23,代码来源:AnalysisParalysisTest.java


示例2: createAnalyzer

import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入依赖的package包/类
public static Analyzer createAnalyzer() {
    final PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new KeywordAnalyzer());
    analyzer.addAnalyzer(DocumentUtil.FIELD_IDENTS, new WhitespaceAnalyzer());
    analyzer.addAnalyzer(DocumentUtil.FIELD_FEATURE_IDENTS, new WhitespaceAnalyzer());
    analyzer.addAnalyzer(DocumentUtil.FIELD_CASE_INSENSITIVE_FEATURE_IDENTS, new DocumentUtil.LCWhitespaceAnalyzer());
    return analyzer;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:DocumentUtil.java


示例3: getServerAnalyzer

import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入依赖的package包/类
private Analyzer getServerAnalyzer() {
    PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new
            NGramAnalyzer(min_ngram, max_ngram));
    analyzer.addAnalyzer("checkin", new KeywordAnalyzer());
    analyzer.addAnalyzer("registered", new KeywordAnalyzer());
    analyzer.addAnalyzer("ram", new KeywordAnalyzer());
    analyzer.addAnalyzer("swap", new KeywordAnalyzer());
    analyzer.addAnalyzer("cpuMHz", new KeywordAnalyzer());
    analyzer.addAnalyzer("cpuNumberOfCpus", new KeywordAnalyzer());


    return analyzer;
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:14,代码来源:IndexManager.java


示例4: getErrataAnalyzer

import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入依赖的package包/类
private Analyzer getErrataAnalyzer() {
    PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new
            NGramAnalyzer(min_ngram, max_ngram));
    analyzer.addAnalyzer("advisoryName", new KeywordAnalyzer());
    analyzer.addAnalyzer("synopsis", new StandardAnalyzer());
    analyzer.addAnalyzer("description", new StandardAnalyzer());
    analyzer.addAnalyzer("topic", new StandardAnalyzer());
    analyzer.addAnalyzer("solution", new StandardAnalyzer());

    return analyzer;
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:12,代码来源:IndexManager.java


示例5: getSnapshotTagAnalyzer

import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入依赖的package包/类
private Analyzer getSnapshotTagAnalyzer() {
    PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new
            NGramAnalyzer(min_ngram, max_ngram));
    analyzer.addAnalyzer("id", new KeywordAnalyzer());
    analyzer.addAnalyzer("snapshotId", new KeywordAnalyzer());
    analyzer.addAnalyzer("orgId", new KeywordAnalyzer());
    analyzer.addAnalyzer("serverId", new KeywordAnalyzer());
    analyzer.addAnalyzer("tagNameId", new KeywordAnalyzer());
    analyzer.addAnalyzer("created", new KeywordAnalyzer());
    analyzer.addAnalyzer("modified", new KeywordAnalyzer());
    return analyzer;
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:13,代码来源:IndexManager.java


示例6: getHardwareDeviceAnalyzer

import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入依赖的package包/类
private Analyzer getHardwareDeviceAnalyzer() {
    PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new
            NGramAnalyzer(min_ngram, max_ngram));
    analyzer.addAnalyzer("id", new KeywordAnalyzer());
    analyzer.addAnalyzer("serverId", new KeywordAnalyzer());
    analyzer.addAnalyzer("pciType", new KeywordAnalyzer());
    return analyzer;
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:9,代码来源:IndexManager.java


示例7: getServerCustomInfoAnalyzer

import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入依赖的package包/类
private Analyzer getServerCustomInfoAnalyzer() {
    PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new
            NGramAnalyzer(min_ngram, max_ngram));
    analyzer.addAnalyzer("id", new KeywordAnalyzer());
    analyzer.addAnalyzer("serverId", new KeywordAnalyzer());
    analyzer.addAnalyzer("created", new KeywordAnalyzer());
    analyzer.addAnalyzer("modified", new KeywordAnalyzer());
    analyzer.addAnalyzer("createdBy", new KeywordAnalyzer());
    analyzer.addAnalyzer("lastModifiedBy", new KeywordAnalyzer());
    return analyzer;
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:12,代码来源:IndexManager.java


示例8: getDefaultAnalyzer

import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入依赖的package包/类
private Analyzer getDefaultAnalyzer() {
    PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new
            NGramAnalyzer(min_ngram, max_ngram));
    analyzer.addAnalyzer("id", new KeywordAnalyzer());
    analyzer.addAnalyzer("arch", new KeywordAnalyzer());
    analyzer.addAnalyzer("epoch", new KeywordAnalyzer());
    analyzer.addAnalyzer("version", new KeywordAnalyzer());
    analyzer.addAnalyzer("release", new KeywordAnalyzer());
    analyzer.addAnalyzer("filename", new KeywordAnalyzer());
    return analyzer;
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:12,代码来源:IndexManager.java


示例9: createPerFieldAnalyzer

import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入依赖的package包/类
public void createPerFieldAnalyzer(){
	Map<String, Analyzer> fieldAnalyzerMap = new HashMap<String, Analyzer>();
	for(Language language : languages) {
		String topicContentFieldName = MultiLingualAbstractOTDFLucDocCreator.Fields.getLanguageTopicContentField(language);
		Analyzer analyzer = getAnalyzer(language);
		if(analyzer!=null)
			fieldAnalyzerMap.put(topicContentFieldName, analyzer);
	}
	analyzers = new PerFieldAnalyzerWrapper(new StandardAnalyzer(Version.LUCENE_36), fieldAnalyzerMap);
}
 
开发者ID:kasooja,项目名称:cl-esa,代码行数:11,代码来源:MultiLingualAbstractsOTDFIndexer.java


示例10: createPerFieldAnalyzer

import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入依赖的package包/类
public void createPerFieldAnalyzer(Set<Language> languagesDone){
	Map<String, Analyzer> fieldAnalyzerMap = new HashMap<String, Analyzer>();
	for(Language language : languagesDone) {
		String topicContentFieldName = MultiLingualArticleOTDFLucDocCreator.Fields.getLanguageTopicContentField(language);
		Analyzer analyzer = getAnalyzer(language);
		if(analyzer!=null)
			fieldAnalyzerMap.put(topicContentFieldName, analyzer);
	}		
	analyzers = new PerFieldAnalyzerWrapper(new StandardAnalyzer(Version.LUCENE_36), fieldAnalyzerMap);
}
 
开发者ID:kasooja,项目名称:cl-esa,代码行数:11,代码来源:IndexCompressor.java


示例11: testPerFieldAnalyzer

import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入依赖的package包/类
public void testPerFieldAnalyzer() throws Exception {
  PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(
                                            new SimpleAnalyzer());
  analyzer.addAnalyzer("partnum", new KeywordAnalyzer());

  Query query = new QueryParser(Version.LUCENE_41,
                                "description", analyzer).parse(
              "partnum:Q36 AND SPACE");

  assertEquals("Q36 kept as-is",
            "+partnum:Q36 +space", query.toString("description"));  
  assertEquals("doc found!", 1, TestUtil.hitCount(searcher, query));
}
 
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:14,代码来源:KeywordAnalyzerTest.java


示例12: convertCanonicOutput

import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入依赖的package包/类
private void convertCanonicOutput(CanonicOutput canonicOutput,Document document,LuceneOptions luceneOptions)
{
    SimilarityForms sf = SimilarityFormConverterWrapper.getConverter().process(canonicOutput);             
            
    document.add(newField("co.configuration.id", 
            canonicOutput.getApplicationRun().getConfiguration().getId().toString(), 
            luceneOptions, 
            new StandardAnalyzer(Version.LUCENE_36)
        )
    );
    
    document.add(newField("co.revision.id", 
            canonicOutput.getApplicationRun().getRevision().getId().toString(), 
            luceneOptions, 
            new StandardAnalyzer(Version.LUCENE_36)
        )
    );
    
    document.add(newField("co.applicationrun.id", 
            canonicOutput.getApplicationRun().getId().toString(), 
            luceneOptions, 
            new StandardAnalyzer(Version.LUCENE_36)
        )
    );
    
    if(canonicOutput.getAnnotations() != null && !canonicOutput.getAnnotations().isEmpty())
    {
        for(Annotation a : canonicOutput.getAnnotations())
        {
            document.add(newField("co.annotation", a.getAnnotationContent(), luceneOptions, new StandardAnalyzer(Version.LUCENE_36)));
        }
    }        
    
    // mathml is converted into Single String representation
    // which is stored in co.distanceForm
    document.add(newField("co.distanceForm",sf.getDistanceForm(),luceneOptions,null));
    
    PerFieldAnalyzerWrapper keywordAnalyzer = new PerFieldAnalyzerWrapper(new KeywordAnalyzer());
    
    for(String s : sf.getCountForm().keySet())
    {
        document.add(newField("co.element", s+"="+sf.getCountForm().get(s), luceneOptions, keywordAnalyzer)); 
    }
    
    logger.info("Canonic output ["+canonicOutput.getId()+"] indexed.");
}
 
开发者ID:michal-ruzicka,项目名称:MathMLCanEval,代码行数:47,代码来源:CanonicOutputBridge.java


示例13: build

import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入依赖的package包/类
/**
     * Método para construir el índice con la colección por defecto
     *
     * @param operación a realizar: MAKE o ADD
     */
    private long build(int operation) throws IndexException {
        long indexedFiles = 0;
        String message = "Lucene index will be created at [" + this.indexPath + "]";
        OutputMonitor.printLine(message, OutputMonitor.INFORMATION_MESSAGE);
        this.notifyTaskProgress(INFORMATION_MESSAGE, message);
        //inicia la indexacion
        try {
            if (safeToBuildIndex(this.indexPath, operation)) {
                setStartTimeOfIndexation(new Date());
                // this.analyzer = new NGramAnalyzer();

                //TODO I changed theses lines 2012-11-12
//                this.setFieldAnalyzer(new PerFieldAnalyzerWrapper(new NGramAnalyzer()));
//                this.getFieldAnalyzer().addAnalyzer(getDocumentField(FIELD_CODE_ALL_COMMENTS), new StopStemAnalyzer());
                if (this.appendIndex) {
                    //Adding: new docs
                    this.writer = new IndexWriter(FSDirectory.open(this.indexPath), this.getFieldAnalyzer(), false, IndexWriter.MaxFieldLength.UNLIMITED);
                    if (applyLSI) {
                        this.writerLSI = new IndexWriter(FSDirectory.open(this.indexLSIPath), new PerFieldAnalyzerWrapper(new StopStemAnalyzer()), false, IndexWriter.MaxFieldLength.UNLIMITED);
                    }

                    // ("number "+writer.getReader().maxDoc());
                } else {
                    //create or overwrite index
                    this.writer = new IndexWriter(FSDirectory.open(this.indexPath), this.getFieldAnalyzer(), true, IndexWriter.MaxFieldLength.UNLIMITED);
                    if (applyLSI) {
                        this.writerLSI = new IndexWriter(FSDirectory.open(this.indexLSIPath), new PerFieldAnalyzerWrapper(new StopStemAnalyzer()), true, IndexWriter.MaxFieldLength.UNLIMITED);
                    }

                }

                indexedFiles = indexDocs(this.writer, this.writerLSI, this.collectionPath, operation);

                message = "Optimizing...";
                OutputMonitor.printLine(message, OutputMonitor.INFORMATION_MESSAGE);
                this.notifyTaskProgress(INFORMATION_MESSAGE, message);
                this.writer.optimize();
                this.writer.close();
                if (applyLSI) {
                    this.writerLSI.optimize();
                    this.writerLSI.close();
                }

                setEndTimeOfIndexation(new Date());
                message = "Indexation Time " + this.getIndexationTime() + " milliseconds.";
                OutputMonitor.printLine(message, OutputMonitor.INFORMATION_MESSAGE);
                this.notifyTaskProgress(INFORMATION_MESSAGE, message);
            }
        } catch (IOException e) {
            message = " caught a " + e.getClass() + "\n with message: " + e.getMessage() + ".";
            this.notifyTaskProgress(ERROR_MESSAGE, message);
            throw new IndexException(message);
        }

        initLSIManager(); // inicializar la matriz de LSI

        return indexedFiles;
    }
 
开发者ID:jcrcano,项目名称:DrakkarKeel,代码行数:64,代码来源:LuceneContext.java


示例14: getFieldAnalyzer

import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入依赖的package包/类
/**
 * @return the fieldAnalyzer
 */
public PerFieldAnalyzerWrapper getFieldAnalyzer() {
    return fieldAnalyzer;
}
 
开发者ID:jcrcano,项目名称:DrakkarKeel,代码行数:7,代码来源:LuceneContext.java


示例15: setFieldAnalyzer

import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入依赖的package包/类
/**
 * @param fieldAnalyzer the fieldAnalyzer to set
 */
public void setFieldAnalyzer(PerFieldAnalyzerWrapper fieldAnalyzer) {
    this.fieldAnalyzer = fieldAnalyzer;
}
 
开发者ID:jcrcano,项目名称:DrakkarKeel,代码行数:7,代码来源:LuceneContext.java


示例16: getFieldAnalyzerCS

import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入依赖的package包/类
/**
 * @return the fieldAnalyzerCS
 */
public PerFieldAnalyzerWrapper getFieldAnalyzerCS() {
    return fieldAnalyzerCS;
}
 
开发者ID:jcrcano,项目名称:DrakkarKeel,代码行数:7,代码来源:LuceneContext.java


示例17: setFieldAnalyzerCS

import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入依赖的package包/类
/**
 * @param fieldAnalyzerCS the fieldAnalyzerCS to set
 */
public void setFieldAnalyzerCS(PerFieldAnalyzerWrapper fieldAnalyzerCS) {
    this.fieldAnalyzerCS = fieldAnalyzerCS;
}
 
开发者ID:jcrcano,项目名称:DrakkarKeel,代码行数:7,代码来源:LuceneContext.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Position类代码示例发布时间:2022-05-22
下一篇:
Java MetaData类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap