Java 类org.hibernate.search.annotations.Factory 实例源码

项目:maven-framework-project    文件:SearchMappingFactory.java   
@Factory
public SearchMapping getSearchMapping() {
    SearchMapping searchMapping = new SearchMapping();

    searchMapping
    .entity(App.class)
        .indexed()
        .property("id", ElementType.METHOD).documentId()
        .property("name", ElementType.METHOD).field()
        .property("description", ElementType.METHOD).field()
        .property("supportedDevices", ElementType.METHOD).indexEmbedded().depth(1)
        .property("customerReviews", ElementType.METHOD).indexEmbedded().depth(1)

    .entity(Device.class)
        .property("manufacturer", ElementType.METHOD).field()
        .property("name", ElementType.METHOD).field()
        .property("supportedApps", ElementType.METHOD).containedIn()

    .entity(CustomerReview.class)
        .property("stars", ElementType.METHOD).field()
        .property("comments", ElementType.METHOD).field();

    return searchMapping;               
}
项目:document-management-system    文件:ReadAccessFilterFactory.java   
@Factory
public Filter buildFilter() {
    log.debug("buildFilter()");

    if (SearchDAO.SEARCH_LUCENE.equals(Config.SECURITY_SEARCH_EVALUATION)) {
        String user = PrincipalUtils.getUser();
        Set<String> roles = PrincipalUtils.getRoles();

        if (roles.contains(Config.DEFAULT_ADMIN_ROLE)) {
            // An user with AdminRole has total access
            return null;
        } else if (Config.ADMIN_USER.equals(user) || Config.SYSTEM_USER.equals(user)) {
            // An "okmAdmin" or "system" user has total access
            return null;
        } else {
            BooleanQuery query = new BooleanQuery();
            Term termUser = new Term("userPermission", user);
            query.add(new TermQuery(termUser), BooleanClause.Occur.SHOULD);

            for (String role : roles) {
                Term termRole = new Term("rolePermission", role);
                query.add(new TermQuery(termRole), BooleanClause.Occur.SHOULD);
            }

            log.info("buildFilter: {}", query);
            Filter filter = new QueryWrapperFilter(query);
            return filter;
        }
    } else {
        return null;
    }
}
项目:site    文件:DefaultSearchMapping.java   
@Factory
public SearchMapping getSearchMapping() {
    final SearchMapping mapping = new SearchMapping();
    mapping
            .analyzerDef("english", StandardTokenizerFactory.class)
                .filter(LowerCaseFilterFactory.class)
                .filter(SnowballPorterFilterFactory.class)
            .analyzerDef("german", StandardTokenizerFactory.class)
                .filter(LowerCaseFilterFactory.class)
                .filter(GermanStemFilterFactory.class);
    return mapping;
}
项目:site    文件:DefaultSearchMapping.java   
@Factory
public SearchMapping getSearchMapping() {
    final SearchMapping mapping = new SearchMapping();
    mapping
            .analyzerDef("english", StandardTokenizerFactory.class)
                .filter(LowerCaseFilterFactory.class)
                .filter(SnowballPorterFilterFactory.class)
            .analyzerDef("german", StandardTokenizerFactory.class)
                .filter(LowerCaseFilterFactory.class)
                .filter(GermanStemFilterFactory.class);
    return mapping;
}
项目:cia    文件:DataSearchMappingFactory.java   
/**
 * Gets the search mapping.
 *
 * @return the search mapping
 */
@Factory
public SearchMapping getSearchMapping() {
    final SearchMapping mapping = new SearchMapping();
    mapping.analyzerDef("ngram", StandardTokenizerFactory.class).filter(LowerCaseFilterFactory.class)
            .filter(NGramFilterFactory.class).param("minGramSize", "3").param("maxGramSize", "3")
            .analyzerDef("se", StandardTokenizerFactory.class).filter(LowerCaseFilterFactory.class)
            .filter(SwedishLightStemFilterFactory.class).analyzerDef("en", StandardTokenizerFactory.class)
            .filter(LowerCaseFilterFactory.class).filter(PorterStemFilterFactory.class)
            .entity(DocumentContentData.class).indexed().property("hjid", ElementType.FIELD).documentId().property("content", ElementType.METHOD).field().analyzer("se").store(Store.NO).analyze(Analyze.YES).property("id", ElementType.METHOD).field()
            .entity(DocumentElement.class).indexed().property("id", ElementType.FIELD).documentId().property("title", ElementType.METHOD).field().analyzer("se").store(Store.NO).analyze(Analyze.YES).property("subTitle", ElementType.METHOD).field().analyzer("se").store(Store.NO).analyze(Analyze.YES)
            .entity(DocumentStatusContainer.class).indexed().property("hjid", ElementType.FIELD).documentId().property("documentCategory", ElementType.METHOD).field().analyzer("se").store(Store.NO).analyze(Analyze.YES);

    return mapping;
}
项目:hapi-fhir    文件:LuceneSearchMappingFactory.java   
@Factory
public SearchMapping getSearchMapping() {
    SearchMapping mapping = new SearchMapping();

    mapping.analyzerDef("autocompleteEdgeAnalyzer", PatternTokenizerFactory.class)
            .tokenizerParam("pattern", "(.*)")
            .tokenizerParam("group", "1")
            .filter(LowerCaseFilterFactory.class)
            .filter(StopFilterFactory.class)
            .filter(EdgeNGramFilterFactory.class)
            .param("minGramSize", "3")
            .param("maxGramSize", "50")
        .analyzerDef("autocompletePhoneticAnalyzer", StandardTokenizerFactory.class)
            .filter(StandardFilterFactory.class)
            .filter(StopFilterFactory.class)
            .filter(PhoneticFilterFactory.class)
            .param("encoder", "DoubleMetaphone")
            .filter(SnowballPorterFilterFactory.class)
            .param("language", "English")
        .analyzerDef("autocompleteNGramAnalyzer", StandardTokenizerFactory.class)
            .filter(WordDelimiterFilterFactory.class)
            .filter(LowerCaseFilterFactory.class)
            .filter(NGramFilterFactory.class)
            .param("minGramSize", "3")
            .param("maxGramSize", "20")
        .analyzerDef("standardAnalyzer", StandardTokenizerFactory.class)
            .filter(LowerCaseFilterFactory.class)
        .analyzerDef("exactAnalyzer", StandardTokenizerFactory.class)
        .analyzerDef("conceptParentPidsAnalyzer", WhitespaceTokenizerFactory.class);

    return mapping;
}
项目:maven-framework-project    文件:DeviceFilterFactory.java   
/**
 * When a @FullTextFilterDef annotation associates this factory class with a given name, and a "FullTextQuery.enableFullTextFilter()" is 
 * called with that name as its input parameter, then this method is used to return a Filter with the actual filtering logic.  It is 
 * the @Factory annotation that designates this method as having that responsibility for this factory class. 
 */
@Factory
public Filter getFilter() {
    StringTokenizer tokenzier = new StringTokenizer(deviceName.toLowerCase());
    PhraseQuery query = new PhraseQuery();
    while(tokenzier.hasMoreTokens()) {
        // By default, field values were converted to lower-case when indexed by Lucene.  So be sure to 
        // convert search terms to lower-case in order to make them match.
        Term term = new Term("supportedDevices.name", tokenzier.nextToken().toLowerCase());
        query.add(term);
    }
    Filter filter = new QueryWrapperFilter(query);
    return new CachingWrapperFilter(filter);
}
项目:maven-framework-project    文件:DeviceFilterFactory.java   
/**
 * When a @FullTextFilterDef annotation associates this factory class with a given name, and a "FullTextQuery.enableFullTextFilter()" is 
 * called with that name as its input parameter, then this method is used to return a Filter with the actual filtering logic.  It is 
 * the @Factory annotation that designates this method as having that responsibility for this factory class. 
 */
@Factory
public Filter getFilter() {
    StringTokenizer tokenzier = new StringTokenizer(deviceName.toLowerCase());
    PhraseQuery query = new PhraseQuery();
    while(tokenzier.hasMoreTokens()) {
        // By default, field values were converted to lower-case when indexed by Lucene.  So be sure to 
        // convert search terms to lower-case in order to make them match.
        Term term = new Term("supportedDevices.name", tokenzier.nextToken().toLowerCase());
        query.add(term);
    }
    Filter filter = new QueryWrapperFilter(query);
    return new CachingWrapperFilter(filter);
}
项目:maven-framework-project    文件:DeviceFilterFactory.java   
/**
 * When a @FullTextFilterDef annotation associates this factory class with a given name, and a "FullTextQuery.enableFullTextFilter()" is 
 * called with that name as its input parameter, then this method is used to return a Filter with the actual filtering logic.  It is 
 * the @Factory annotation that designates this method as having that responsibility for this factory class. 
 */
@Factory
public Filter getFilter() {
    StringTokenizer tokenzier = new StringTokenizer(deviceName.toLowerCase());
    PhraseQuery query = new PhraseQuery();
    while(tokenzier.hasMoreTokens()) {
        // By default, field values were converted to lower-case when indexed by Lucene.  So be sure to 
        // convert search terms to lower-case in order to make them match.
        Term term = new Term("supportedDevices.name", tokenzier.nextToken().toLowerCase());
        query.add(term);
    }
    Filter filter = new QueryWrapperFilter(query);
    return new CachingWrapperFilter(filter);
}
项目:windup-rulesets    文件:SecurityFilterFactory.java   
@Factory
public Filter getFilter() {
    Query query = new TermQuery( new Term("level", level.toString() ) );
    return new CachingWrapperFilter( new QueryWrapperFilter(query) );
}