Examples of updateDocument()


Examples of org.apache.lucene.index.IndexWriter.updateDocument()

  public static List<Tag> extractTag(List<? extends Indexable> list) throws CorruptIndexException, LockObtainFailedException, IOException, ItemException {
    RAMDirectory directory = new RAMDirectory();
    IndexWriter writer = new IndexWriter(directory, new StandardAnalyzer(Version.LUCENE_30), IndexWriter.MaxFieldLength.LIMITED);

    for (Indexable item : list) {
      writer.updateDocument(item.getTerm(),item.getDocument());
    }
   
    writer.optimize();
    writer.close();
   
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.updateDocument()

      Field field = new TextField("content", strs[i] , Field.Store.YES);
      doc.add(field);
      if (writer.getConfig().getOpenMode() == OpenMode.CREATE) {
        writer.addDocument(doc);
      } else {
        writer.updateDocument(new Term("content",strs[i]), doc);
      }
    }
    writer.close();
   
    //!!这句话是不是漏了
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.updateDocument()

        IndexWriter writer = null;
       
        try
        {
            writer = openIndex(false);
            writer.updateDocument(t, doc);
        }
        catch(Exception e)
        {
            log.error(e.getMessage(),e);
        }
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.updateDocument()

              doc.removeFields(ArtifactInfo.LAST_MODIFIED);

              doc.add(new Field(ArtifactInfo.LAST_MODIFIED, Long.toString(lm), Field.Store.YES,
                  Field.Index.NO));

              iw.updateDocument(new Term(ArtifactInfo.UINFO, doc.get(ArtifactInfo.UINFO)), doc);
            }
          }
        }

        ctx.optimize();
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.updateDocument()

    public void setRootGroups( IndexingContext context, Collection<String> groups )
        throws IOException
    {
        IndexWriter w = context.getIndexWriter();

        w.updateDocument(
            new Term( ArtifactInfo.ROOT_GROUPS, ArtifactInfo.ROOT_GROUPS_VALUE ),
            createRootGroupsDocument( groups ) );

        w.flush();
    }
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.updateDocument()

    public void setAllGroups( IndexingContext context, Collection<String> groups )
        throws IOException
    {
        IndexWriter w = context.getIndexWriter();

        w.updateDocument(
            new Term( ArtifactInfo.ALL_GROUPS, ArtifactInfo.ALL_GROUPS_VALUE ),
            createAllGroupsDocument( groups ) );

        w.flush();
    }
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.updateDocument()

    public void update( IndexingContext context, ArtifactContext ac )
        throws IOException
    {
        IndexWriter w = context.getIndexWriter();

        w.updateDocument( getKeyTerm( ac ), createDocument( context, ac ) );
       
        w.flush();
       
        context.updateTimestamp();
    }
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.updateDocument()

            final List<Document> documents = myparser.parse(file);

            for (final Document doc : documents) {
                logger.debug("Document " + doc.get(conf.getID()));
                final Term docid = new Term(conf.getID(), doc.get(conf.getID()));
                writer.updateDocument(docid, doc);
            }
        }
        writer.close();
    }
}
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.updateDocument()

                if (threadRandom.nextDouble() <= addChance) {
                  String id = String.format(Locale.ROOT, "%d_%04x", threadID, threadRandom.nextInt(idCount));
                  Integer field = threadRandom.nextInt(Integer.MAX_VALUE);
                  doc.add(new StringField("id", id, Field.Store.YES));
                  doc.add(new IntField("field", field.intValue(), Field.Store.YES));
                  w.updateDocument(new Term("id", id), doc);
                  rt.add(id, field);
                  if (values.put(id, field) == null) {
                    allIDs.add(id);
                  }
                }
View Full Code Here

Examples of org.apache.lucene.index.RandomIndexWriter.updateDocument()

    w.addDocument(doc);
    w.commit();
    doc = new Document();
    doc.add(makeIDField("id", 17));
    // Replaces the doc we just indexed:
    w.updateDocument(new Term("id", "id"), doc);
    w.forceMerge(1);
    w.close();
    dir.close();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.