1 package org.apache.maven.repository.indexing;
4 * Copyright 2001-2005 The Apache Software Foundation.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 import java.io.IOException;
21 import org.apache.lucene.analysis.Analyzer;
23 import org.apache.lucene.analysis.standard.StandardAnalyzer;
24 import org.apache.lucene.index.IndexReader;
25 import org.apache.lucene.index.IndexWriter;
29 * @author Edwin Punzalan
31 public abstract class AbstractRepositoryIndexer
32 implements RepositoryIndexer
34 protected String indexPath;
35 protected IndexReader indexReader;
36 protected IndexWriter indexWriter;
38 protected void getIndexWriter()
41 if ( indexWriter == null )
43 indexWriter = new IndexWriter( indexPath, getAnalyzer(), true );
47 protected void getIndexReader()
50 if ( indexReader == null )
52 indexReader = IndexReader.open( indexPath );
56 protected Analyzer getAnalyzer()
58 return new StandardAnalyzer();