Package org.apache.lucene.index

Examples of org.apache.lucene.index.IndexModifier


          if(this.isClosed.get())
            throw new IllegalStateException("StorageController is already closed -- server is shutting down");
          if (LOG.isInfoEnabled())
              LOG.info("new IndexModifier created - release to StorageModifier");
       
            return new IndexModifier(this.storageDir, new StandardAnalyzer(),
                    false);
        }finally{
            try{
                this.closeCondition.signalAll();
                }catch (Throwable e) {/**/}
 
View Full Code Here


            }
        }
    }

    public void testIndexWriterLockRelease() throws IOException {
        IndexModifier im;

        try {
            im = new IndexModifier(this.__test_dir, new org.apache.lucene.analysis.standard.StandardAnalyzer(), false);
        } catch (FileNotFoundException e) {
            try {
                im = new IndexModifier(this.__test_dir, new org.apache.lucene.analysis.standard.StandardAnalyzer(), false);
            } catch (FileNotFoundException e1) {
            }
        }
    }
View Full Code Here

    }

    public void modifyRecords( Collection records )
        throws RepositoryIndexException
    {
        IndexModifier indexModifier = null;
        try
        {
            indexModifier = new IndexModifier( indexLocation, indexHandlers.getAnalyzer(), !exists() );
            indexModifier.setMaxFieldLength( MAX_FIELD_LENGTH );

            for ( Iterator i = records.iterator(); i.hasNext(); )
            {
                LuceneRepositoryContentRecord record = (LuceneRepositoryContentRecord) i.next();

                if ( record != null )
                {
                    Term term = new Term( LuceneDocumentMaker.PRIMARY_KEY, record.getPrimaryKey() );

                    indexModifier.deleteDocuments( term );

                    Document document = indexHandlers.getConverter().convert( record );

                    indexModifier.addDocument( document );
                }
            }
            indexModifier.optimize();
        }
        catch ( IOException e )
        {
            throw new RepositoryIndexException( "Error updating index: " + e.getMessage(), e );
        }
View Full Code Here

    }

    public void modifyRecord( LuceneRepositoryContentRecord record )
        throws RepositoryIndexException
    {
        IndexModifier indexModifier = null;
        try
        {
            indexModifier = new IndexModifier( indexLocation, indexHandlers.getAnalyzer(), !exists() );
            indexModifier.setMaxFieldLength( MAX_FIELD_LENGTH );

            if ( record != null )
            {
                Term term = new Term( LuceneDocumentMaker.PRIMARY_KEY, record.getPrimaryKey() );

                indexModifier.deleteDocuments( term );

                Document document = indexHandlers.getConverter().convert( record );

                indexModifier.addDocument( document );
            }
            indexModifier.optimize();
        }
        catch ( IOException e )
        {
            throw new RepositoryIndexException( "Error updating index: " + e.getMessage(), e );
        }
View Full Code Here

    }

    public void indexArtifacts( List artifacts, RepositoryIndexRecordFactory factory )
        throws RepositoryIndexException
    {
        IndexModifier indexModifier = null;
        try
        {
            indexModifier = new IndexModifier( indexLocation, getAnalyzer(), !exists() );

            for ( Iterator i = artifacts.iterator(); i.hasNext(); )
            {
                Artifact artifact = (Artifact) i.next();
                RepositoryIndexRecord record = factory.createRecord( artifact );

                if ( record != null )
                {
                    Term term = new Term( FLD_PK, record.getPrimaryKey() );

                    indexModifier.deleteDocuments( term );

                    Document document = converter.convert( record );
                    document.add(
                        new Field( FLD_PK, record.getPrimaryKey(), Field.Store.NO, Field.Index.UN_TOKENIZED ) );

                    indexModifier.addDocument( document );
                }
            }
            indexModifier.optimize();
        }
        catch ( IOException e )
        {
            throw new RepositoryIndexException( "Error updating index: " + e.getMessage(), e );
        }
View Full Code Here

    }
   
    public void indexArtifact( Artifact artifact, RepositoryIndexRecordFactory factory )
        throws RepositoryIndexException
    {
        IndexModifier indexModifier = null;
        try
        {
            indexModifier = new IndexModifier( indexLocation, getAnalyzer(), !exists() );

            RepositoryIndexRecord record = factory.createRecord( artifact );

            if ( record != null )
            {
                Term term = new Term( FLD_PK, record.getPrimaryKey() );

                indexModifier.deleteDocuments( term );

                Document document = converter.convert( record );
                document.add( new Field( FLD_PK, record.getPrimaryKey(), Field.Store.NO, Field.Index.UN_TOKENIZED ) );

                indexModifier.addDocument( document );
            }
            indexModifier.optimize();
        }
        catch ( IOException e )
        {
            throw new RepositoryIndexException( "Error updating index: " + e.getMessage(), e );
        }
View Full Code Here

                try {
                    //## LUCENE2 begin ##
                    boolean recreate = !IndexReader.indexExists(path);
                    Analyzer analyzer = new StandardAnalyzer();
                    access = new IndexAccess();
                    access.modifier = new IndexModifier(path, analyzer, recreate);
                    //## LUCENE2 end ##
                    /*## LUCENE3 begin ##
                    File f = new File(path);
                    Directory indexDir = FSDirectory.open(f);
                    boolean recreate = !IndexReader.indexExists(indexDir);
View Full Code Here

TOP

Related Classes of org.apache.lucene.index.IndexModifier

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.