Package org.apache.lucene.queryParser.standard.config

Examples of org.apache.lucene.queryParser.standard.config.StandardQueryConfigHandler.addAttribute()


  @Test
  public void testAttributes() {
    StandardQueryConfigHandler config = new StandardQueryConfigHandler();

    AnalyzerAttribute analyzerAttr = config
        .addAttribute(AnalyzerAttribute.class);

    Assert.assertTrue(null == analyzerAttr.getAnalyzer());
    Assert.assertTrue(null == config.get(ConfigurationKeys.ANALYZER));
    Analyzer analyzer = new KeywordAnalyzer();
View Full Code Here


    Analyzer analyzer = new KeywordAnalyzer();
    analyzerAttr.setAnalyzer(analyzer);
    Assert.assertTrue(analyzer == analyzerAttr.getAnalyzer());
    Assert.assertTrue(analyzer == config.get(ConfigurationKeys.ANALYZER));

    DateResolutionAttribute dateResAttr = config
        .addAttribute(DateResolutionAttribute.class);

    Assert.assertTrue(null == dateResAttr.getDateResolution());
    Assert.assertTrue(null == config.get(ConfigurationKeys.DATE_RESOLUTION));
    DateTools.Resolution dateRes = DateTools.Resolution.HOUR;
View Full Code Here

    DateTools.Resolution dateRes = DateTools.Resolution.HOUR;
    dateResAttr.setDateResolution(dateRes);
    Assert.assertTrue(dateRes == dateResAttr.getDateResolution());
    Assert.assertTrue(dateRes == config.get(ConfigurationKeys.DATE_RESOLUTION));

    DefaultPhraseSlopAttribute defaultPhraseSlopAttr = config
        .addAttribute(DefaultPhraseSlopAttribute.class);

    Assert.assertEquals(0, defaultPhraseSlopAttr.getDefaultPhraseSlop());
    Assert
        .assertEquals(0, config.get(ConfigurationKeys.PHRASE_SLOP).intValue());
View Full Code Here

    Assert.assertEquals(phraseSlop, defaultPhraseSlopAttr
        .getDefaultPhraseSlop());
    Assert.assertEquals(phraseSlop, config.get(ConfigurationKeys.PHRASE_SLOP)
        .intValue());

    FieldBoostMapAttribute fieldBoostMapAttr = config
        .addAttribute(FieldBoostMapAttribute.class);

    Assert.assertEquals(new LinkedHashMap<String, Float>(), fieldBoostMapAttr
        .getFieldBoostMap());
    Assert.assertEquals(new LinkedHashMap<String, Float>(), config
View Full Code Here

    fieldBoostMapAttr.setFieldBoostMap(fieldBoostMap);
    Assert.assertEquals(fieldBoostMap, fieldBoostMapAttr.getFieldBoostMap());
    Assert.assertEquals(fieldBoostMap, config
        .get(ConfigurationKeys.FIELD_BOOST_MAP));

    FieldDateResolutionMapAttribute fieldDateResolutionMapAttr = config
        .addAttribute(FieldDateResolutionMapAttribute.class);

    Assert.assertEquals(new HashMap<CharSequence, DateTools.Resolution>(),
        fieldDateResolutionMapAttr.getFieldDateResolutionMap());
    Assert.assertEquals(new HashMap<CharSequence, DateTools.Resolution>(),
View Full Code Here

    fieldDateResolutionMapAttr.setFieldDateResolutionMap(fieldDateResMap);
    Assert.assertEquals(fieldDateResMap, fieldDateResolutionMapAttr.getFieldDateResolutionMap());
    Assert.assertEquals(fieldDateResMap, config
        .get(ConfigurationKeys.FIELD_DATE_RESOLUTION_MAP));

    LocaleAttribute localeAttr = config.addAttribute(LocaleAttribute.class);

    Assert.assertEquals(Locale.getDefault(), localeAttr.getLocale());
    Assert.assertEquals(Locale.getDefault(), config
        .get(ConfigurationKeys.LOCALE));
    Locale locale = Locale.CHINA;
View Full Code Here

    Locale locale = Locale.CHINA;
    localeAttr.setLocale(locale);
    Assert.assertEquals(locale, localeAttr.getLocale());
    Assert.assertEquals(locale, config.get(ConfigurationKeys.LOCALE));

    LowercaseExpandedTermsAttribute lowercaseExpandedTermsAttr = config
        .addAttribute(LowercaseExpandedTermsAttribute.class);

    Assert.assertEquals(true, lowercaseExpandedTermsAttr
        .isLowercaseExpandedTerms());
    Assert.assertEquals(true, config.get(
View Full Code Here

    Assert.assertEquals(lowercaseEnabled, lowercaseExpandedTermsAttr
        .isLowercaseExpandedTerms());
    Assert.assertEquals(lowercaseEnabled, config.get(
        ConfigurationKeys.LOWERCASE_EXPANDED_TERMS).booleanValue());

    MultiTermRewriteMethodAttribute multiTermRewriteMethodAttr = config
        .addAttribute(MultiTermRewriteMethodAttribute.class);

    Assert
        .assertTrue(MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT == multiTermRewriteMethodAttr
            .getMultiTermRewriteMethod());
View Full Code Here

    Assert.assertTrue(rewriteMethod == multiTermRewriteMethodAttr
        .getMultiTermRewriteMethod());
    Assert.assertTrue(rewriteMethod == config
        .get(ConfigurationKeys.MULTI_TERM_REWRITE_METHOD));

    PositionIncrementsAttribute positionIncrementsAttr = config
        .addAttribute(PositionIncrementsAttribute.class);

    Assert.assertEquals(false, positionIncrementsAttr
        .isPositionIncrementsEnabled());
    Assert.assertEquals(false, config.get(
View Full Code Here

    Assert.assertEquals(posIncrEnabled, positionIncrementsAttr
        .isPositionIncrementsEnabled());
    Assert.assertEquals(posIncrEnabled, config.get(
        ConfigurationKeys.ENABLE_POSITION_INCREMENTS).booleanValue());

    RangeCollatorAttribute rangeCollatorAttr = config
        .addAttribute(RangeCollatorAttribute.class);

    Assert.assertTrue(null == rangeCollatorAttr.getRangeCollator());
    Assert.assertTrue(null == config.get(ConfigurationKeys.RANGE_COLLATOR));
    Collator collator = new Collator() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.