Example usage for org.apache.lucene.queryparser.ext ExtendableQueryParser ExtendableQueryParser

List of usage examples for org.apache.lucene.queryparser.ext ExtendableQueryParser ExtendableQueryParser

Introduction

In this page you can find the example usage for org.apache.lucene.queryparser.ext ExtendableQueryParser ExtendableQueryParser.

Prototype

public ExtendableQueryParser(final String f, final Analyzer a) 

Source Link

Document

Creates a new ExtendableQueryParser instance

Usage

From source file:org.codelibs.fess.helper.QueryHelperTest.java

License:Apache License

@Override
public void setUp() throws Exception {
    super.setUp();
    queryHelper = new QueryHelper() {
        protected QueryParser getQueryParser() {
            ExtendableQueryParser queryParser = new ExtendableQueryParser(Constants.DEFAULT_FIELD,
                    new WhitespaceAnalyzer());
            queryParser.setAllowLeadingWildcard(true);
            queryParser.setDefaultOperator(QueryParser.Operator.AND);
            return queryParser;
        }/*from w  w  w  . jav a 2  s  .  c  o m*/
    };
    File file = File.createTempFile("test", ".properties");
    file.deleteOnExit();
    FileUtil.writeBytes(file.getAbsolutePath(),
            "ldap.security.principal=%s@fess.codelibs.local".getBytes("UTF-8"));
    DynamicProperties systemProps = new DynamicProperties(file);
    ComponentUtil.register(systemProps, "systemProperties");
    ComponentUtil.register(new SystemHelper(), "systemHelper");
    ComponentUtil.register(new VirtualHostHelper(), "virtualHostHelper");
    ComponentUtil.register(new KeyMatchHelper(), "keyMatchHelper");
    inject(queryHelper);
    queryHelper.init();
}