creatorsById.put( creator.getId(), creator ); dag.addVertex( creator.getId() ); for ( String depId : creator.getCreatorDependencies() ) dag.addEdge( creator.getId(), depId );
indexCreator.populateArtifactInfo( this ); indexCreator.updateDocument( getArtifactInfo(), doc );
public static ArtifactInfo constructArtifactInfo( Document doc, IndexingContext context ) { // if no UINFO can't create, must be a different type of record if ( doc.get( ArtifactInfo.UINFO ) == null ) { return null; } boolean res = false; ArtifactInfo artifactInfo = new ArtifactInfo(); for ( IndexCreator ic : context.getIndexCreators() ) { res |= ic.updateArtifactInfo( doc, artifactInfo ); } return res ? artifactInfo : null; }
try { for (IndexCreator creator : embedder.lookupList(IndexCreator.class)) { if (OsgiArtifactIndexCreator.ID.equals(creator.getId())) { continue; //we are no interested in osgi related content in lucene documents or ArtifactInfo objects.
public static Document updateDocument( Document doc, IndexingContext context, boolean updateLastModified, ArtifactInfo ai ) { if ( ai == null ) { ai = constructArtifactInfo( doc, context ); if ( ai == null ) { return doc; } } Document document = new Document(); // unique key document.add( new Field( ArtifactInfo.UINFO, ai.getUinfo(), Field.Store.YES, Field.Index.NOT_ANALYZED ) ); if ( updateLastModified || doc.getField( ArtifactInfo.LAST_MODIFIED ) == null ) { document.add( new Field( ArtifactInfo.LAST_MODIFIED, // Long.toString( System.currentTimeMillis() ), Field.Store.YES, Field.Index.NO ) ); } else { document.add( doc.getField( ArtifactInfo.LAST_MODIFIED ) ); } for ( IndexCreator ic : context.getIndexCreators() ) { ic.updateDocument( ai, document ); } return document; }
private DefaultIndexingContext( String id, String repositoryId, File repository, // String repositoryUrl, String indexUpdateUrl, List<? extends IndexCreator> indexCreators, Directory indexDirectory, boolean reclaimIndex ) throws ExistingLuceneIndexMismatchException, IOException { this.id = id; this.searchable = true; this.repositoryId = repositoryId; this.repository = repository; this.repositoryUrl = repositoryUrl; this.indexUpdateUrl = indexUpdateUrl; this.indexWriter = null; this.searcherManager = null; this.indexCreators = indexCreators; this.indexDirectory = indexDirectory; // eh? // Guice does NOT initialize these, and we have to do manually? // While in Plexus, all is well, but when in guice-shim, // these objects are still LazyHintedBeans or what not and IndexerFields are NOT registered! for ( IndexCreator indexCreator : indexCreators ) { indexCreator.getIndexerFields(); } this.gavCalculator = new M2GavCalculator(); prepareIndex( reclaimIndex ); setIndexDirectoryFile( null ); }
public static Document updateDocument( Document doc, IndexingContext context, boolean updateLastModified ) { ArtifactInfo ai = constructArtifactInfo( doc, context ); if ( ai == null ) { return doc; } Document document = new Document(); // unique key document.add( new Field( ArtifactInfo.UINFO, ai.getUinfo(), Field.Store.YES, Field.Index.NOT_ANALYZED ) ); if ( updateLastModified || doc.getField( ArtifactInfo.LAST_MODIFIED ) == null ) { document.add( new Field( ArtifactInfo.LAST_MODIFIED, // Long.toString( System.currentTimeMillis() ), Field.Store.YES, Field.Index.NO ) ); } else { document.add( doc.getField( ArtifactInfo.LAST_MODIFIED ) ); } for ( IndexCreator ic : context.getIndexCreators() ) { ic.updateDocument( ai, document ); } return document; }
indexCreator.getIndexerFields();
creatorsById.put( creator.getId(), creator ); dag.addVertex( creator.getId() ); for ( String depId : creator.getCreatorDependencies() ) dag.addEdge( creator.getId(), depId );
indexCreator.populateArtifactInfo( this ); indexCreator.updateDocument( getArtifactInfo(), doc );
res |= ic.updateArtifactInfo( doc, artifactInfo );
public static Document updateDocument( Document doc, IndexingContext context, boolean updateLastModified, ArtifactInfo ai ) { if ( ai == null ) { ai = constructArtifactInfo( doc, context ); if ( ai == null ) { return doc; } } Document document = new Document(); // unique key document.add( new Field( ArtifactInfo.UINFO, ai.getUinfo(), Field.Store.YES, Field.Index.NOT_ANALYZED ) ); if ( updateLastModified || doc.getField( ArtifactInfo.LAST_MODIFIED ) == null ) { document.add( new Field( ArtifactInfo.LAST_MODIFIED, // Long.toString( System.currentTimeMillis() ), Field.Store.YES, Field.Index.NO ) ); } else { document.add( doc.getField( ArtifactInfo.LAST_MODIFIED ) ); } for ( IndexCreator ic : context.getIndexCreators() ) { ic.updateDocument( ai, document ); } return document; }
indexCreator.getIndexerFields();
creatorsById.put( creator.getId(), creator ); dag.addVertex( creator.getId() ); for ( String depId : creator.getCreatorDependencies() ) dag.addEdge( creator.getId(), depId );
indexCreator.populateArtifactInfo( this ); indexCreator.updateDocument( getArtifactInfo(), doc );
res |= ic.updateArtifactInfo( doc, artifactInfo );