public void remove( IndexingContext context, ArtifactContext ac ) throws IOException { if ( ac != null ) { String uinfo = ac.getArtifactInfo().getUinfo(); // add artifact deletion marker Document doc = new Document(); doc.add( new Field( ArtifactInfo.DELETED, uinfo, Field.Store.YES, Field.Index.NO ) ); doc.add( new Field( ArtifactInfo.LAST_MODIFIED, // Long.toString( System.currentTimeMillis() ), Field.Store.YES, Field.Index.NO ) ); IndexWriter w = context.getIndexWriter(); w.addDocument( doc ); w.deleteDocuments( new Term( ArtifactInfo.UINFO, uinfo ) ); w.commit(); context.updateTimestamp(); } }
static Document updateLegacyDocument( Document doc, IndexingContext context ) { ArtifactInfo ai = IndexUtils.constructArtifactInfo( doc, context ); if ( ai == null ) { return doc; } Document document = new Document(); document.add( new Field( ArtifactInfo.UINFO, ai.getUinfo(), Field.Store.YES, Field.Index.UN_TOKENIZED ) ); for ( IndexCreator ic : context.getIndexCreators() ) { if ( ic instanceof LegacyDocumentUpdater ) { ( (LegacyDocumentUpdater) ic ).updateLegacyDocument( ai, document ); } } return document; }
document.add( new Field( ArtifactInfo.UINFO, ai.getUinfo(), Field.Store.YES, Field.Index.UN_TOKENIZED ) );
public void update( IndexingContext context, ArtifactContext ac ) throws IOException { Document d = ac.createDocument( context ); if ( d != null ) { IndexWriter w = context.getIndexWriter(); w.updateDocument( new Term( ArtifactInfo.UINFO, ac.getArtifactInfo().getUinfo() ), d ); updateGroups( context, ac ); w.commit(); context.updateTimestamp(); } }
doc.add( new Field( ArtifactInfo.UINFO, getArtifactInfo().getUinfo(), Store.YES, Index.UN_TOKENIZED ) );
public void artifactDiscovered( ArtifactContext ac ) String uinfo = ac.getArtifactInfo().getUinfo();
gav.getClassifier() ); Term term = new Term( ArtifactInfo.UINFO, ai.getUinfo() );
String uinfo = ac.getArtifactInfo().getUinfo(); TopDocs d = s.search( new TermQuery( new Term( ArtifactInfo.UINFO, uinfo ) ), 1 ); if ( d.totalHits == 0 )