public static Version parse(String toParse, Version defaultValue) { if (Strings.hasLength(toParse)) { try { return Version.parseLeniently(toParse); } catch (ParseException e) { // pass to default } } return defaultValue; } }
/** * Initialize this factory via a set of key-value pairs. */ protected AbstractAnalysisFactory(Map<String,String> args) { originalArgs = Collections.unmodifiableMap(new HashMap<>(args)); String version = get(args, LUCENE_MATCH_VERSION_PARAM); if (version == null) { luceneMatchVersion = Version.LATEST; } else { try { luceneMatchVersion = Version.parseLeniently(version); } catch (ParseException pe) { throw new IllegalArgumentException(pe); } } args.remove(CLASS_NAME); // consume the class arg }
@SuppressWarnings("deprecation") private static Version parseLuceneVersionString(final String matchVersion) { final Version version = Version.parseLeniently(matchVersion); if (version == Version.LUCENE_CURRENT && !versionWarningAlreadyLogged.getAndSet(true)) { log.warn( "You should not use LATEST as luceneMatchVersion property: "+ "if you use this setting, and then Solr upgrades to a newer release of Lucene, "+ "sizable changes may happen. If precise back compatibility is important "+ "then you should instead explicitly specify an actual Lucene version." ); } return version; }
@SuppressWarnings("deprecation") private static Version parseLuceneVersionString(final String matchVersion) { final Version version = Version.parseLeniently(matchVersion); if (version == Version.LUCENE_CURRENT && !versionWarningAlreadyLogged.getAndSet(true)) { log.warn( "You should not use LATEST as luceneMatchVersion property: "+ "if you use this setting, and then Solr upgrades to a newer release of Lucene, "+ "sizable changes may happen. If precise back compatibility is important "+ "then you should instead explicitly specify an actual Lucene version." ); } return version; }
public static Version parse(String toParse, Version defaultValue) { if (Strings.hasLength(toParse)) { try { return Version.parseLeniently(toParse); } catch (ParseException e) { // pass to default } } return defaultValue; } }
public static Version parse(String toParse, Version defaultValue) { if (Strings.hasLength(toParse)) { try { return Version.parseLeniently(toParse); } catch (ParseException e) { // pass to default } } return defaultValue; } }
private static Version parseLuceneVersion(String versionString) { try { return Version.parseLeniently( versionString ); } catch (IllegalArgumentException | ParseException e) { throw log.illegalLuceneVersionFormat( versionString, e.getMessage(), e ); } } }
public static Version parse(String toParse, Version defaultValue) { if (Strings.hasLength(toParse)) { try { return Version.parseLeniently(toParse); } catch (ParseException e) { // pass to default } } return defaultValue; } }
public static Version parse(String toParse, Version defaultValue) { if (Strings.hasLength(toParse)) { try { return Version.parseLeniently(toParse); } catch (ParseException e) { // pass to default } } return defaultValue; } }
public static Version parse(String toParse, Version defaultValue) { if (Strings.hasLength(toParse)) { try { return Version.parseLeniently(toParse); } catch (ParseException e) { // pass to default } } return defaultValue; } }
/** * Used by provider only. */ private LuceneOptions(String name, Configurator configurator, String matchVersion, String luceneRoot, List<String> namespaces, TokenizerOptions options, TextFieldElements elements) { this.name = name; this.configurator = configurator; this.matchVersion = Version.parseLeniently(matchVersion); this.luceneRoot = new File(luceneRoot); this.namespaces = new ArrayList<NameSpace>(); for (String s : namespaces) { this.namespaces.add(NameSpace.getNameSpaceByName(s)); } this.options = options; this.elements = elements; }
/** * Initialize this factory via a set of key-value pairs. */ protected AbstractAnalysisFactory(Map<String,String> args) { originalArgs = Collections.unmodifiableMap(new HashMap<>(args)); String version = get(args, LUCENE_MATCH_VERSION_PARAM); if (version == null) { luceneMatchVersion = Version.LATEST; } else { try { luceneMatchVersion = Version.parseLeniently(version); } catch (ParseException pe) { throw new IllegalArgumentException(pe); } } args.remove(CLASS_NAME); // consume the class arg }
/** * Initialize this factory via a set of key-value pairs. */ protected AbstractAnalysisFactory(Map<String,String> args) { originalArgs = Collections.unmodifiableMap(new HashMap<>(args)); String version = get(args, LUCENE_MATCH_VERSION_PARAM); if (version == null) { luceneMatchVersion = Version.LATEST; } else { try { luceneMatchVersion = Version.parseLeniently(version); } catch (ParseException pe) { throw new IllegalArgumentException(pe); } } args.remove(CLASS_NAME); // consume the class arg }
@Override public StringNormalizer get(String name, Config config, Map<String, String> runtimeParams) throws ConfigurationException { if (!config.getString("type").equals("lucene")) { return null; } Version version = Version.parseLeniently(config.getString("version")); TokenizerOptions opts = new TokenizerOptions( config.getBoolean("caseInsensitive"), config.getBoolean("useStopWords"), config.getBoolean("useStem") ); return new LuceneStringNormalizer(opts, version); } }
private static Version getMinorLuceneVersion(String version) { try { return Version.parseLeniently(version.replaceFirst("^(\\d)\\.(\\d).*", "LUCENE_$1$2")); } catch (ParseException e) { throw new RuntimeException(e); } }
try { this.version = Version.parseLeniently(config.getVersion());
private Version getLuceneMatchVersion(SearchConfiguration cfg) { final Version version; String tmp = cfg.getProperty( Environment.LUCENE_MATCH_VERSION ); if ( StringHelper.isEmpty( tmp ) ) { log.recommendConfiguringLuceneVersion(); version = Environment.DEFAULT_LUCENE_MATCH_VERSION; } else { try { version = Version.parseLeniently( tmp ); if ( log.isDebugEnabled() ) { log.debug( "Setting Lucene compatibility to Version " + version ); } } catch (IllegalArgumentException e) { throw log.illegalLuceneVersionFormat( tmp, e.getMessage() ); } catch (ParseException e) { throw log.illegalLuceneVersionFormat( tmp, e.getMessage() ); } } return version; } }
private Version getLuceneMatchVersion(SearchConfiguration cfg) { final Version version; String tmp = cfg.getProperty( Environment.LUCENE_MATCH_VERSION ); if ( StringHelper.isEmpty( tmp ) ) { log.recommendConfiguringLuceneVersion(); version = Environment.DEFAULT_LUCENE_MATCH_VERSION; } else { try { version = Version.parseLeniently( tmp ); if ( log.isDebugEnabled() ) { log.debug( "Setting Lucene compatibility to Version " + version ); } } catch (IllegalArgumentException e) { throw log.illegalLuceneVersionFormat( tmp, e.getMessage() ); } catch (ParseException e) { throw log.illegalLuceneVersionFormat( tmp, e.getMessage() ); } } return version; }