mirror of
https://github.com/apache/archiva.git
synced 2025-03-06 16:39:13 +00:00
[MRM-127] notes, and skip indexing of null records
git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@425936 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
436d0b75ca
commit
ab0ca9f0f0
@ -151,11 +151,12 @@ private RepositoryMetadata buildMetadata( String repo, String metadataPath )
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a RepositoryMetadata object from a Metadata object and its path
|
||||
* Builds a RepositoryMetadata object from a Metadata object and its path.
|
||||
*
|
||||
* @param m Metadata
|
||||
* @param metadataPath path
|
||||
* @return RepositoryMetadata if the parameters represent one; null if not
|
||||
* @todo should we just be using the path information, and loading it later when it is needed? (for reporting, etc)
|
||||
*/
|
||||
private RepositoryMetadata buildMetadata( Metadata m, String metadataPath )
|
||||
{
|
||||
|
@ -94,10 +94,14 @@ private void addRecords( List records )
|
||||
{
|
||||
RepositoryIndexRecord record = (RepositoryIndexRecord) i.next();
|
||||
|
||||
Document document = converter.convert( record );
|
||||
document.add( new Field( FLD_PK, record.getPrimaryKey(), Field.Store.NO, Field.Index.UN_TOKENIZED ) );
|
||||
if ( record != null )
|
||||
{
|
||||
Document document = converter.convert( record );
|
||||
document.add(
|
||||
new Field( FLD_PK, record.getPrimaryKey(), Field.Store.NO, Field.Index.UN_TOKENIZED ) );
|
||||
|
||||
indexWriter.addDocument( document );
|
||||
indexWriter.addDocument( document );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( IOException e )
|
||||
@ -128,7 +132,7 @@ private void close( IndexWriter indexWriter )
|
||||
|
||||
private Analyzer getAnalyzer()
|
||||
{
|
||||
// TODO: investigate why changed in original!
|
||||
// TODO: investigate why changed in original! Probably for MD5 and number querying.
|
||||
return new StandardAnalyzer();
|
||||
}
|
||||
|
||||
@ -146,9 +150,12 @@ private void deleteRecords( List records )
|
||||
{
|
||||
RepositoryIndexRecord record = (RepositoryIndexRecord) artifacts.next();
|
||||
|
||||
Term term = new Term( FLD_PK, record.getPrimaryKey() );
|
||||
if ( record != null )
|
||||
{
|
||||
Term term = new Term( FLD_PK, record.getPrimaryKey() );
|
||||
|
||||
indexReader.deleteDocuments( term );
|
||||
indexReader.deleteDocuments( term );
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
Loading…
x
Reference in New Issue
Block a user