Package org.apache.lucene.util

Examples of org.apache.lucene.util.Version


    return 1;
  }
 
  public static IndexWriterConfig createWriterConfig(Config config, PerfRunData runData, OpenMode mode, IndexCommit commit) {
    // :Post-Release-Update-Version.LUCENE_XY:
    Version version = Version.valueOf(config.get("writer.version", Version.LUCENE_48.toString()));
    IndexWriterConfig iwConf = new IndexWriterConfig(version, runData.getAnalyzer());
    iwConf.setOpenMode(mode);
    IndexDeletionPolicy indexDeletionPolicy = getIndexDeletionPolicy(config);
    iwConf.setIndexDeletionPolicy(indexDeletionPolicy);
    if(commit != null)
View Full Code Here


    Analyzer a = new Analyzer() {
      @Override
      protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
        Tokenizer tokenizer = new KeywordTokenizer(reader);
        final boolean updateOffsets = random().nextBoolean();
        final Version version = updateOffsets ? Version.LUCENE_43 : TEST_VERSION_CURRENT;
        return new TokenStreamComponents(tokenizer, new TrimFilter(version, tokenizer, updateOffsets));
      }
    };
    checkOneTerm(a, "", "");
  }
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.instanceInitalizer = instanceInitializer;
    this.entityState = EntityState.CONTAINED_IN_ONLY;
    this.beanXClass = xClass;
View Full Code Here

   * @param directory the Directory to initialize
   * @throws SearchException in case of lock acquisition timeouts, IOException, or if a corrupt index is found
   */
  public static void initializeIndexIfNeeded(Directory directory) {
    //version doesn't really matter as we won't use the Analyzer
    Version version =  Environment.DEFAULT_LUCENE_MATCH_VERSION;
    SimpleAnalyzer analyzer = new SimpleAnalyzer( version );
    try {
      if ( ! IndexReader.indexExists( directory ) ) {
        IndexWriterConfig iwriterConfig = new IndexWriterConfig( version, analyzer ).setOpenMode( OpenMode.CREATE );
        IndexWriter iw = new IndexWriter( directory, iwriterConfig );
View Full Code Here

   * @param directory the Directory to initialize
   * @throws SearchException in case of lock acquisition timeouts, IOException, or if a corrupt index is found
   */
  public static void initializeIndexIfNeeded(Directory directory) {
    //version doesn't really matter as we won't use the Analyzer
    Version version = Environment.DEFAULT_LUCENE_MATCH_VERSION;
    SimpleAnalyzer analyzer = new SimpleAnalyzer( version );
    try {
      if ( ! IndexReader.indexExists( directory ) ) {
        IndexWriterConfig iwriterConfig = new IndexWriterConfig( version, analyzer ).setOpenMode( OpenMode.CREATE );
        IndexWriter iw = new IndexWriter( directory, iwriterConfig );
View Full Code Here

    }

    public Builder(Class<?> indexedType, ConfigContext configContext, ScopedAnalyzer scopedAnalyzer) {
      this.indexedType = indexedType;
      this.scopedAnalyzer = scopedAnalyzer;
      Version luceneVersion = configContext.getLuceneMatchVersion();
      this.passThroughAnalyzer = new PassThroughAnalyzer( luceneVersion );
    }
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 ) ) {
      log.recommendConfiguringLuceneVersion();
      version = Environment.DEFAULT_LUCENE_MATCH_VERSION;
    }
    else {
      try {
        version = Version.valueOf( tmp );
        if ( log.isDebugEnabled() ) {
          log.debug( "Setting Lucene compatibility to Version " + version.name() );
        }
      }
      catch (IllegalArgumentException e) {
        StringBuilder msg = new StringBuilder( tmp );
        msg.append( " is a invalid value for the Lucene match version. Possible values are: " );
View Full Code Here

   * @param directory the Directory to initialize
   * @throws SearchException in case of lock acquisition timeouts, IOException, or if a corrupt index is found
   */
  public static void initializeIndexIfNeeded(Directory directory) {
    //version doesn't really matter as we won't use the Analyzer
    Version version = Version.LUCENE_31;
    SimpleAnalyzer analyzer = new SimpleAnalyzer( version );
    try {
      if ( ! IndexReader.indexExists( directory ) ) {
        IndexWriterConfig iwriterConfig = new IndexWriterConfig( version, analyzer ).setOpenMode( OpenMode.CREATE );
        IndexWriter iw = new IndexWriter( directory, iwriterConfig );
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 ) ) {
      log.recommendConfiguringLuceneVersion();
      version = DEFAULT_LUCENE_MATCH_VERSION;
    }
    else {
      try {
        version = Version.valueOf( tmp );
        if ( log.isDebugEnabled() ) {
          log.debug( "Setting Lucene compatibility to Version " + version.name() );
        }
      }
      catch ( IllegalArgumentException e ) {
        StringBuilder msg = new StringBuilder( tmp );
        msg.append( " is a invalid value for the Lucene match version. Possible values are: " );
View Full Code Here

*/
public class LucenePatternAnalyzerFactory implements SenseiPluginFactory<Analyzer> {

    @Override
    public Analyzer getBean(Map<String, String> initProperties, String fullPrefix, SenseiPluginRegistry pluginRegistry) {
        Version matchVersion = Version.valueOf(MapUtils.getString(initProperties, "matchVersion", "LUCENE_35"));
        Pattern pattern = Pattern.compile(MapUtils.getString(initProperties, "pattern", "\\s+"));
        boolean toLowerCase = MapUtils.getBoolean(initProperties, "toLowerCase", true);
        String stopWordsStr = MapUtils.getString(initProperties, "stopWords", "");
        Set<String> stopWords = new HashSet<String>(Arrays.asList(stopWordsStr.split("\\s*,\\s*")));
        return new PatternAnalyzer(matchVersion, pattern, toLowerCase, stopWords);
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.