Java 类org.apache.lucene.search.regex.RegexQuery 实例源码

项目:community-edition-old    文件:AbstractLuceneQueryParser.java   
@Override
protected Query newWildcardQuery(Term t)
{
    if (t.text().contains("\\"))
    {
        String regexp = SearchLanguageConversion.convert(SearchLanguageConversion.DEF_LUCENE, SearchLanguageConversion.DEF_REGEX, t.text());
        return new RegexQuery(new Term(t.field(), regexp));
    }
    else
    {
        return super.newWildcardQuery(t);
    }
}
项目:community-edition-old    文件:AbstractLuceneQueryParser.java   
@Override
protected Query newPrefixQuery(Term prefix)
{
    if (prefix.text().contains("\\"))
    {
        String regexp = SearchLanguageConversion.convert(SearchLanguageConversion.DEF_LUCENE, SearchLanguageConversion.DEF_REGEX, prefix.text());
        return new RegexQuery(new Term(prefix.field(), regexp));
    }
    else
    {
        return super.newPrefixQuery(prefix);
    }

}
项目:t4f-data    文件:RegexQueryTest.java   
public void testRegexQuery() throws Exception {
  Directory directory = TestUtil.getBookIndexDirectory();
  IndexSearcher searcher = new IndexSearcher(directory);
  RegexQuery q = new RegexQuery(new Term("title", ".*st.*"));
  TopDocs hits = searcher.search(q, 10);
  assertEquals(2, hits.totalHits);
  assertTrue(TestUtil.hitsIncludeTitle(searcher, hits,
                                       "Tapestry in Action"));
  assertTrue(TestUtil.hitsIncludeTitle(searcher, hits,
                                       "Mindstorms: Children, Computers, And Powerful Ideas"));
  searcher.close();
  directory.close();
}
项目:drftpd3    文件:LuceneEngine.java   
private RegexQuery makeFullPathRegexQueryFromString(String regex) {
    return new RegexQuery(TERM_FULL.createTerm(regex));
}
项目:drftpd3    文件:LuceneEngine.java   
private RegexQuery makeFullPathRegexQueryFromString(String regex) {
    return new RegexQuery(TERM_FULL.createTerm(regex));
}
项目:drftpd3-extended    文件:LuceneEngine.java   
private RegexQuery makeFullPathRegexQueryFromString(String regex) {
    return new RegexQuery(TERM_FULL.createTerm(regex));
}