Package org.apache.solr.common

Examples of org.apache.solr.common.ResourceLoader


  public String getSolrConfigFile() {
    return "solrconfig.xml";
  }

  public void testInform() throws Exception {
    ResourceLoader loader = solrConfig.getResourceLoader();
    assertTrue("loader is null and it shouldn't be", loader != null);
    CommonGramsQueryFilterFactory factory = new CommonGramsQueryFilterFactory();
    Map<String, String> args = new HashMap<String, String>();
    args.put("words", "stop-1.txt");
    args.put("ignoreCase", "true");
View Full Code Here


  public String getSolrConfigFile() {
    return "solrconfig.xml";
  }

  public void testInform() throws Exception {
    ResourceLoader loader = solrConfig.getResourceLoader();
    assertTrue("loader is null and it shouldn't be", loader != null);
    KeepWordFilterFactory factory = new KeepWordFilterFactory();
    Map<String, String> args = new HashMap<String, String>();
    args.put("words", "keep-1.txt");
    args.put("ignoreCase", "true");
View Full Code Here

  public String getSolrConfigFile() {
    return "solrconfig.xml";
  }

  public void testInform() throws Exception {
    ResourceLoader loader = solrConfig.getResourceLoader();
    assertTrue("loader is null and it shouldn't be", loader != null);
    CommonGramsFilterFactory factory = new CommonGramsFilterFactory();
    Map<String, String> args = new HashMap<String, String>();
    args.put("words", "stop-1.txt");
    args.put("ignoreCase", "true");
View Full Code Here

  public void testEncoder() throws Exception {
    Map<String,String> args = new HashMap<String, String>();
    args.put(DelimitedPayloadTokenFilterFactory.ENCODER_ATTR, "float");
    DelimitedPayloadTokenFilterFactory factory = new DelimitedPayloadTokenFilterFactory();
    factory.init(args);
    ResourceLoader loader = h.getCore().getResourceLoader();
    factory.inform(loader);

    TokenStream input = new WhitespaceTokenizer(new StringReader("the|0.1 quick|0.1 red|0.1"));
    DelimitedPayloadTokenFilter tf = factory.create(input);
    while (tf.incrementToken()){
View Full Code Here

    Map<String,String> args = new HashMap<String, String>();
    args.put(DelimitedPayloadTokenFilterFactory.ENCODER_ATTR, FloatEncoder.class.getName());
    args.put(DelimitedPayloadTokenFilterFactory.DELIMITER_ATTR, "*");
    DelimitedPayloadTokenFilterFactory factory = new DelimitedPayloadTokenFilterFactory();
    factory.init(args);
    ResourceLoader loader = h.getCore().getResourceLoader();
    factory.inform(loader);

    TokenStream input = new WhitespaceTokenizer(new StringReader("the*0.1 quick*0.1 red*0.1"));
    DelimitedPayloadTokenFilter tf = factory.create(input);
    while (tf.incrementToken()){
View Full Code Here

    final int length = analyzerDef.filters().length;
    final int charLength = analyzerDef.charFilters().length;
    TokenFilterFactory[] filters = new TokenFilterFactory[length];
    CharFilterFactory[] charFilters = new CharFilterFactory[charLength];
    ResourceLoader resourceLoader = new HibernateSearchResourceLoader();
    for ( int index = 0; index < length; index++ ) {
      TokenFilterDef filterDef = analyzerDef.filters()[index];
      filters[index] = ( TokenFilterFactory ) instantiate( filterDef.factory() );
      filters[index].init( getMapOfParameters( filterDef.params(), luceneMatchVersion ) );
      if ( filters[index] instanceof ResourceLoaderAware ) {
View Full Code Here

    TokenizerFactory tokenFactory = ( TokenizerFactory ) instantiate( token.factory() );
    tokenFactory.init( getMapOfParameters( token.params() ) );

    final int length = analyzerDef.filters().length;
    TokenFilterFactory[] filters = new TokenFilterFactory[length];
    ResourceLoader resourceLoader = new HibernateSearchResourceLoader();
    for ( int index = 0 ; index < length ; index++ ) {
      TokenFilterDef filterDef = analyzerDef.filters()[index];
      filters[index] = (TokenFilterFactory) instantiate( filterDef.factory() );
      filters[index].init( getMapOfParameters( filterDef.params() ) );
      if ( filters[index] instanceof ResourceLoaderAware ) {
View Full Code Here

   * @param analyzerDef The <code>AnalyzerDef</code> annotation as found in the annotated domain class.
   * @param luceneMatchVersion The lucene version (required since Lucene 3.x)
   * @return a Lucene <code>Analyzer</code>
   */
  public static Analyzer buildAnalyzer(AnalyzerDef analyzerDef, Version luceneMatchVersion) {
    ResourceLoader defaultResourceLoader = new HibernateSearchResourceLoader();
    TokenizerDef token = analyzerDef.tokenizer();
    TokenizerFactory tokenFactory = instanceFromClass( TokenizerFactory.class, token.factory(), "Tokenizer factory" );
    final Map<String, String> tokenMapsOfParameters = getMapOfParameters( token.params(), luceneMatchVersion );
    tokenFactory.init( tokenMapsOfParameters );
    injectResourceLoader( tokenFactory, defaultResourceLoader, tokenMapsOfParameters );
View Full Code Here

  }

  private static void injectResourceLoader(Object processor, ResourceLoader defaultResourceLoader, Map<String, String> mapOfParameters) {
    if ( processor instanceof ResourceLoaderAware ) {
      String charset = mapOfParameters.get( Environment.RESOURCE_CHARSET );
      final ResourceLoader localResourceLoader;
      if ( charset != null ) {
        localResourceLoader = new HibernateSearchResourceLoader( charset );
      }
      else {
        localResourceLoader = defaultResourceLoader;
View Full Code Here

    final int length = analyzerDef.filters().length;
    final int charLength = analyzerDef.charFilters().length;
    TokenFilterFactory[] filters = new TokenFilterFactory[length];
    CharFilterFactory[] charFilters = new CharFilterFactory[charLength];
    ResourceLoader resourceLoader = new HibernateSearchResourceLoader();
    for ( int index = 0 ; index < length ; index++ ) {
      TokenFilterDef filterDef = analyzerDef.filters()[index];
      filters[index] = (TokenFilterFactory) instantiate( filterDef.factory() );
      filters[index].init( getMapOfParameters( filterDef.params() ) );
      if ( filters[index] instanceof ResourceLoaderAware ) {
View Full Code Here

TOP

Related Classes of org.apache.solr.common.ResourceLoader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.