Package org.apache.lucene.util

Examples of org.apache.lucene.util.Version


    }
  }

  /** */
  public final void testKeywordAttrTokens() throws IOException {
    final Version version = TEST_VERSION_CURRENT;

    Analyzer a = new MorfologikAnalyzer(version) {
      @Override
      protected TokenStreamComponents createComponents(String field, Reader reader) {
        final CharArraySet keywords = new CharArraySet(version, 1, false);
View Full Code Here


    Object aVersion = app.find(myUi, "aVersion");
    app.removeAll(aVersion);
    int i=0;
    for (Field field : Version.class.getDeclaredFields()) {
    if (Modifier.isStatic(field.getModifiers()) && field.getType() == Version.class) {
      Version v = (Version)field.get(Version.class);
      Object choice = app.create("choice");
      app.setString(choice, "text", v.toString());
      app.putProperty(choice, "version", v);
      app.add(aVersion, choice);
      if (v.equals(Luke.LV)) {
        app.setInteger(aVersion, "selected", i);
      }
    }
    i++;
    }
View Full Code Here

      Object combobox = app.find(myUi, "analyzers");
      Object resultsList = app.find(myUi, "resultsList");
      Object inputText = app.find(myUi, "inputText");
      String classname = app.getString(combobox, "text");
      Object choice = app.getSelectedItem(app.find(myUi, "aVersion"));
      Version v = (Version)app.getProperty(choice, "version");
      Class clazz = Class.forName(classname);
      Analyzer analyzer = null;
      try {
        Constructor<Analyzer> c = clazz.getConstructor(Version.class);
        analyzer = c.newInstance(v);
View Full Code Here

      ReflectionManager reflectionManager, Set<XClass> optimizationBlackList, InstanceInitializer instanceInitializer) {

    if ( xClass == null ) {
      throw new AssertionFailure( "Unable to build a DocumentBuilderContainedEntity with a null class" );
    }
    final Version luceneVersion = context.getLuceneMatchVersion();

    this.passThroughAnalyzer = new PassThroughAnalyzer( luceneVersion );
    this.instanceInitializer = instanceInitializer;
    this.entityState = EntityState.CONTAINED_IN_ONLY;
    this.beanXClass = xClass;
View Full Code Here

        try {
          // first try to use a ctor with version parameter
          // (needed for many new Analyzers that have no default one anymore)
          Constructor<? extends Analyzer> cnstr = clazz.getConstructor(Version.class);
          final String matchVersionStr = DOMUtil.getAttr(attrs, LUCENE_MATCH_VERSION_PARAM);
          final Version luceneMatchVersion = (matchVersionStr == null) ?
            solrConfig.luceneMatchVersion : Config.parseLuceneVersionString(matchVersionStr);
          if (luceneMatchVersion == null) {
            throw new SolrException
              ( SolrException.ErrorCode.SERVER_ERROR,
                "Configuration Error: Analyzer '" + clazz.getName() +
View Full Code Here

    String parsedMatchVersion = matchVersion.toUpperCase(Locale.ENGLISH);
   
    // be lenient with the supplied version parameter
    parsedMatchVersion = parsedMatchVersion.replaceFirst("^(\\d)\\.(\\d)$", "LUCENE_$1$2");
   
    final Version version;
    try {
      version = Version.valueOf(parsedMatchVersion);
    } catch (IllegalArgumentException iae) {
      throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
        "Invalid luceneMatchVersion '" + matchVersion +
View Full Code Here

    return new Analyzer() {

      @Override
      protected TokenStreamComponents createComponents(final String fieldName,
                                                       final Reader reader) {
        final Version matchVersion = Version.LUCENE_40;
        final JsonTokenizer src = new JsonTokenizer(reader);
        TokenStream tok = new DatatypeAnalyzerFilter(matchVersion, src,
          new StandardAnalyzer(matchVersion),
          new StandardAnalyzer(matchVersion));
        tok = new LowerCaseFilter(matchVersion, tok);
View Full Code Here

        try {
          // first try to use a ctor with version parameter (needed for many new Analyzers that have no default one anymore)
          final Constructor<? extends Analyzer> cnstr = clazz.getConstructor(Version.class);
          final String matchVersionStr = DOMUtil.getAttr(attrs, LUCENE_MATCH_VERSION_PARAM);
          final Version matchVersion = (matchVersionStr == null) ?
            luceneMatchVersion : Config.parseLuceneVersionString(matchVersionStr);
          if (matchVersion == null) {
            throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,
              "Configuration Error: Analyzer '" + clazz.getName() +
              "' needs a 'luceneMatchVersion' parameter");
View Full Code Here

    return new TokenizerChain(charFilters.toArray(new CharFilterFactory[charFilters.size()]),
        tokenizers.get(0), filters.toArray(new TokenFilterFactory[filters.size()]));
  }

  private static Version parseConfiguredVersion(final String configuredVersion, final String pluginClassName, final Version luceneMatchVersion) {
    final Version version = (configuredVersion != null) ?
      Config.parseLuceneVersionString(configuredVersion) : luceneMatchVersion;

    if (!version.onOrAfter(Version.LUCENE_40)) {
      logger.warn(pluginClassName + " is using deprecated " + version +
        " emulation. You should at some point declare and reindex to at least 4.0, because " +
        "3.x emulation is deprecated and will be removed in 5.0");
    }
View Full Code Here

      return false;
    }
  }

  private Version getLuceneMatchVersion(SearchConfiguration cfg) {
    Version version;
    String tmp = cfg.getProperty( Environment.LUCENE_MATCH_VERSION );
    if ( StringHelper.isEmpty( tmp ) ) {
      version = DEFAULT_LUCENE_MATCH_VERSION;
    }
    else {
View Full Code Here

TOP

Related Classes of org.apache.lucene.util.Version

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.