Package org.apache.solr.common

Examples of org.apache.solr.common.ResourceLoader


   */
  public void testHyphenationOnly() throws Exception {
    Reader reader = new StringReader("basketballkurv");
    Tokenizer tokenizer = new WhitespaceTokenizer(DEFAULT_VERSION, reader);
    HyphenationCompoundWordTokenFilterFactory factory = new HyphenationCompoundWordTokenFilterFactory();
    ResourceLoader loader = new SolrResourceLoader(null, null);
    Map<String,String> args = new HashMap<String,String>(DEFAULT_VERSION_PARAM);
    args.put("hyphenator", "da_UTF8.xml");
    args.put("minSubwordSize", "2");
    args.put("maxSubwordSize", "4");
    factory.init(args);
View Full Code Here


*
**/
public class TestKeepFilterFactory extends BaseTokenTestCase{

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

  /**
   * Test the protected words mechanism of SnowballPorterFilterFactory
   */
  public void testProtected() throws Exception {
    SnowballPorterFilterFactory factory = new SnowballPorterFilterFactory();
    ResourceLoader loader = new SolrResourceLoader(null, null);
    Map<String,String> args = new HashMap<String,String>(DEFAULT_VERSION_PARAM);
    args.put("protected", "protwords.txt");
    args.put("language", "English");
    factory.init(args);
    factory.inform(loader);
View Full Code Here

* so this won't break if stop filter test files change
**/
public class CommonGramsQueryFilterFactoryTest extends BaseTokenTestCase {

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

 
  /**
   * If no words are provided, then a set of english default stopwords is used.
   */
  public void testDefaults() throws Exception {
    ResourceLoader loader = new SolrResourceLoader(null, null);
    assertTrue("loader is null and it shouldn't be", loader != null);
    CommonGramsQueryFilterFactory factory = new CommonGramsQueryFilterFactory();
    Map<String, String> args = new HashMap<String, String>(DEFAULT_VERSION_PARAM);
    factory.init(args);
    factory.inform(loader);
View Full Code Here

  public void testKeywords() throws IOException {
    Reader reader = new StringReader("dogs cats");
    Tokenizer tokenizer = new WhitespaceTokenizer(DEFAULT_VERSION, reader);
    KeywordMarkerFilterFactory factory = new KeywordMarkerFilterFactory();
    Map<String,String> args = new HashMap<String,String>(DEFAULT_VERSION_PARAM);
    ResourceLoader loader = new SolrResourceLoader(null, null);
    args.put("protected", "protwords.txt");
    factory.init(args);
    factory.inform(loader);
   
    TokenStream ts = new PorterStemFilter(factory.create(tokenizer));
View Full Code Here

  public void testKeywordsCaseInsensitive() throws IOException {
    Reader reader = new StringReader("dogs cats Cats");
    Tokenizer tokenizer = new WhitespaceTokenizer(DEFAULT_VERSION, reader);
    KeywordMarkerFilterFactory factory = new KeywordMarkerFilterFactory();
    Map<String,String> args = new HashMap<String,String>(DEFAULT_VERSION_PARAM);
    ResourceLoader loader = new SolrResourceLoader(null, null);
    args.put("protected", "protwords.txt");
    args.put("ignoreCase", "true");
    factory.init(args);
    factory.inform(loader);
   
View Full Code Here

        // create an instance of TransformerFactory
        TransformerFactory transFact = TransformerFactory.newInstance();
        final SolrCore core = context.getSolrCore();
        final StreamSource xsltSource;
        if (core != null) {
          final ResourceLoader loader = core.getResourceLoader();
          transFact.setURIResolver(new SystemIdResolver(loader).asURIResolver());
          xsltSource = new StreamSource(loader.openResource(xslt),
            SystemIdResolver.createSystemIdFromResourceName(xslt));
        } else {
          // fallback for tests
          xsltSource = new StreamSource(xslt);
        }
View Full Code Here

      IOUtils.closeQuietly(is.getByteStream());
    }
  }
 
  public void testResolving() throws Exception {
    final ResourceLoader loader = new SolrResourceLoader(SolrTestCaseJ4.TEST_HOME(), this.getClass().getClassLoader());
    final SystemIdResolver resolver = new SystemIdResolver(loader);
    final String fileUri = new File(SolrTestCaseJ4.TEST_HOME()+"/crazy-path-to-config.xml").toURI().toASCIIString();
   
    assertEquals("solrres:/test.xml", SystemIdResolver.createSystemIdFromResourceName("test.xml"));
    assertEquals("solrres://@/usr/local/etc/test.xml", SystemIdResolver.createSystemIdFromResourceName("/usr/local/etc/test.xml"));
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);
    StopFilterFactory factory = new StopFilterFactory();
    Map<String, String> args = new HashMap<String, String>();
    args.put("words", "stop-1.txt");
    args.put("ignoreCase", "true");
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.