简体   繁体   English

高级搜索Java库

[英]Advanced Search Java Library

I am adding functionality of advanced search to JSF Based CMS product 我正在向基于JSF的CMS产品添加高级搜索功能

Search criteria : 搜索条件 :

If User Searches with keyword Assets then he should be able to get records containing Asset As well as Assets 如果用户使用关键字Assets搜索,则他应该能够获取包含Asset以及Assets的记录

I found that Lucene and Solr are the best way to do full text search out of which I had implemented Apache Lucene Search which does work fast than normal Query result but does not solve my Search criteria. 我发现Lucene和Solr是进行全文本搜索的最佳方法,其中我实现了Apache Lucene Search,该方法比普通的查询结果运行得快,但不能解决我的搜索条件。

Is there any other Java Library which will help me in this criteria ? 是否还有其他Java库可以帮助我达到这一标准?

PorterStemmer is a good choice for supporting this sort of stemming in Lucene. PorterStemmer是支持Lucene中此类阻止的好选择。 Particularly, incorporating a PorterStemFilter into your Analyzer would be the typical approach. 特别是,将PorterStemFilter集成到分析仪中将是典型的方法。 There is a simple example of that listed on the PorterStemFilter documentation linked, but may look something like (based on the StandardAnalyzer, in this case): 在链接的PorterStemFilter文档中有一个简单的示例,但可能看起来像(在这种情况下基于StandardAnalyzer):

class MyStemmerAnalyzer extends Analyzer {
    @override
    public TokenStream tokenStream(String fieldName, Reader reader) {
        TokenStream stream = new StandardTokenizer(reader);
        stream = new StandardFilter(stream);
        stream = new LowerCaseFilter(stream);
        stream = new PorterStemFilter(stream);
        stream = new StopFilter(stream, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
        return stream;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM