congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
IndexWriter.deleteDocuments
Code IndexAdd Tabnine to your IDE (free)

How to use
deleteDocuments
method
in
org.apache.lucene.index.IndexWriter

Best Java code snippets using org.apache.lucene.index.IndexWriter.deleteDocuments (Showing top 20 results out of 1,008)

origin: neo4j/neo4j

@Override
public void deleteDocuments( Query query ) throws IOException
{
  writer.deleteDocuments( query );
}
origin: neo4j/neo4j

@Override
public void deleteDocuments( Term term ) throws IOException
{
  writer.deleteDocuments( term );
}
origin: stanfordnlp/CoreNLP

@Override
public void update(List<CoreLabel> tokens, String sentid) {
 try {
  setIndexWriter();
  indexWriter.deleteDocuments(new TermQuery(new Term("sentid",sentid)));
  add(tokens, sentid, true);
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
}
origin: neo4j/neo4j

@Override
public void deleteDocuments( Term term ) throws IOException
{
  List<AbstractIndexPartition> partitions = index.getPartitions();
  for ( AbstractIndexPartition partition : partitions )
  {
    partition.getIndexWriter().deleteDocuments( term );
  }
}
origin: neo4j/neo4j

@Override
public void deleteDocuments( Query query ) throws IOException
{
  List<AbstractIndexPartition> partitions = index.getPartitions();
  for ( AbstractIndexPartition partition : partitions )
  {
    partition.getIndexWriter().deleteDocuments( query );
  }
}
origin: neo4j/neo4j

@Override
public void updateOrAdd( long entityId, Map<String, Object> properties )
{
  try
  {
    removeFromCache( entityId );
    writer.deleteDocuments( type.idTermQuery( entityId ) );
    add( entityId, properties );
  }
  catch ( IOException e )
  {
    throw new RuntimeException( e );
  }
}
origin: oracle/opengrok

/**
 * Writes a document to contain the serialized version of {@code settings},
 * with a {@link QueryBuilder#OBJUID} value set to
 * {@link #INDEX_ANALYSIS_SETTINGS_OBJUID}. An existing version of the
 * document is first deleted.
 * @param writer a defined, target instance
 * @param settings a defined instance
 * @throws IOException if I/O error occurs while writing Lucene
 */
public void write(IndexWriter writer, IndexAnalysisSettings settings)
    throws IOException {
  byte[] objser = settings.serialize();
  writer.deleteDocuments(new Term(QueryBuilder.OBJUID,
    INDEX_ANALYSIS_SETTINGS_OBJUID));
  Document doc = new Document();
  StringField uidfield = new StringField(QueryBuilder.OBJUID,
    INDEX_ANALYSIS_SETTINGS_OBJUID, Field.Store.NO);
  doc.add(uidfield);
  doc.add(new StoredField(QueryBuilder.OBJSER, objser));
  doc.add(new StoredField(QueryBuilder.OBJVER,
    INDEX_ANALYSIS_SETTINGS_OBJVER));
  writer.addDocument(doc);
}
origin: com.h2database/h2

/**
 * Delete a row from the index.
 *
 * @param row the row
 * @param commitIndex whether to commit the changes to the Lucene index
 */
protected void delete(Object[] row, boolean commitIndex) throws SQLException {
  String query = getQuery(row);
  try {
    Term term = new Term(LUCENE_FIELD_QUERY, query);
    indexAccess.writer.deleteDocuments(term);
    if (commitIndex) {
      commitIndex();
    }
  } catch (IOException e) {
    throw convertException(e);
  }
}
origin: apache/geode

@Override
public void delete(Object key) throws IOException {
 long start = stats.startUpdate();
 try {
  Term keyTerm = SerializerUtil.toKeyTerm(key);
  writer.deleteDocuments(keyTerm);
 } finally {
  stats.endUpdate(start);
 }
}
origin: neo4j/neo4j

private void applyDocuments( IndexWriter writer, IndexType type, LongObjectMap<DocumentContext> documents ) throws IOException
{
  for ( DocumentContext context : documents )
  {
    if ( context.exists )
    {
      if ( LuceneDataSource.documentIsEmpty( context.document ) )
      {
        writer.deleteDocuments( type.idTerm( context.entityId ) );
      }
      else
      {
        writer.updateDocument( type.idTerm( context.entityId ), context.document );
      }
    }
    else
    {
      writer.addDocument( context.document );
    }
  }
}
origin: apache/ignite

/**
 * Removes entry for given key from this index.
 *
 * @param key Key.
 * @throws IgniteCheckedException If failed.
 */
public void remove(CacheObject key) throws IgniteCheckedException {
  try {
    writer.deleteDocuments(new Term(KEY_FIELD_NAME,
      new BytesRef(key.valueBytes(objectContext()))));
  }
  catch (IOException e) {
    throw new IgniteCheckedException(e);
  }
  finally {
    updateCntr.incrementAndGet();
  }
}
origin: apache/nifi

indexWriter.getIndexWriter().deleteDocuments(query);
origin: apache/nifi

try {
  final IndexWriter indexWriter = writer.getIndexWriter();
  indexWriter.deleteDocuments(term);
  indexWriter.commit();
  final int docsLeft = indexWriter.numDocs();
origin: apache/ignite

writer.deleteDocuments(term);
origin: neo4j/neo4j

@Override
void remove( TxDataHolder holder, EntityId entityId, String key, Object value )
{
  try
  {
    ensureLuceneDataInstantiated();
    long id = entityId.id();
    Document document = findDocument( id );
    if ( document != null )
    {
      index.type.removeFromDocument( document, key, value );
      if ( LuceneDataSource.documentIsEmpty( document ) )
      {
        writer.deleteDocuments( index.type.idTerm( id ) );
      }
      else
      {
        writer.updateDocument( index.type.idTerm( id ), document );
      }
    }
    invalidateSearcher();
  }
  catch ( IOException e )
  {
    throw new RuntimeException( e );
  }
}
origin: oracle/opengrok

/**
 * Remove a stale file (uidIter.term().text()) from the index database and
 * history cache, and queue the removal of xref.
 *
 * @param removeHistory if false, do not remove history cache for this file
 * @throws java.io.IOException if an error occurs
 */
private void removeFile(boolean removeHistory) throws IOException {
  String path = Util.uid2url(uidIter.term().utf8ToString());
  for (IndexChangedListener listener : listeners) {
    listener.fileRemove(path);
  }
  writer.deleteDocuments(new Term(QueryBuilder.U, uidIter.term()));
  removeXrefFile(path);
  if (removeHistory) {
    removeHistoryFile(path);
  }
  setDirty();
  for (IndexChangedListener listener : listeners) {
    listener.fileRemoved(path);
  }
}
origin: org.elasticsearch/elasticsearch

@Override
public long deleteDocuments(Term... terms) throws IOException {
  assert softDeleteEnabled == false : "Call #deleteDocuments but soft-deletes is enabled";
  return super.deleteDocuments(terms);
}
@Override
origin: linkedin/indextank-engine

/**
 *@inheritDoc
 */
public synchronized void del(final String docId) {
  try {
    writer.deleteDocuments(docIdTerm(docId));
  } catch (IOException e) {
    logger.error(e);
  }
}
origin: larsga/Duke

private void delete(Record record) {
 // removes previous copy of this record from the index, if it's there
 Property idprop = config.getIdentityProperties().iterator().next();
 Query q = parseTokens(idprop.getName(), record.getValue(idprop.getName()));
 try {
  iwriter.deleteDocuments(q);
 } catch (IOException e) {
  throw new DukeException(e);
 }
}
origin: org.elasticsearch/elasticsearch

indexWriter.deleteDocuments(delete.uid());
org.apache.lucene.indexIndexWriterdeleteDocuments

Javadoc

Deletes the document(s) containing term.

Popular methods of IndexWriter

  • <init>
    Expert: constructs an IndexWriter with a custom IndexDeletionPolicy, for the index in d. Text will b
  • close
    Closes the index with or without waiting for currently running merges to finish. This is only meanin
  • addDocument
    Adds a document to this index, using the provided analyzer instead of the value of #getAnalyzer(). I
  • commit
  • updateDocument
    Updates a document by first deleting the document(s) containing term and then adding the new documen
  • forceMerge
    Just like #forceMerge(int), except you can specify whether the call should block until all merging c
  • deleteAll
    Delete all documents in the index. This method will drop all buffered documents and will remove all
  • optimize
    Just like #optimize(), except you can specify whether the call should block until the optimize compl
  • rollback
    Close the IndexWriter without committing any changes that have occurred since the last commit (or si
  • addIndexes
    Merges all segments from an array of indexes into this index.
  • getConfig
    Returns a LiveIndexWriterConfig, which can be used to query the IndexWriter current settings, as wel
  • getDirectory
    Returns the Directory used by this index.
  • getConfig,
  • getDirectory,
  • addDocuments,
  • isOpen,
  • isLocked,
  • numDocs,
  • unlock,
  • flush,
  • forceMergeDeletes

Popular in Java

  • Finding current android device location
  • getSharedPreferences (Context)
  • findViewById (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now