Package org.apache.lucene.index

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


    final IndexWriterConfig config = new IndexWriterConfig(
        ConstResolver.VERSION, analyzer);

    final IndexWriter writer = new IndexWriter(getDirectory(), config);

    writer.updateDocument(Status.TERM, doc);

    writer.close();

  }
View Full Code Here

 
  public void index(T item) throws CorruptIndexException, IOException, ItemException {
    FSDirectory directory = FSDirectory.open(new File(Application.getApplication().getNoteIndexPath()));
    IndexWriter writer = new IndexWriter(directory, new StandardAnalyzer(Version.LUCENE_30), IndexWriter.MaxFieldLength.LIMITED);

    writer.updateDocument(new Term(type + "_id", item.getId().toString()), item.getDocument());
    writer.optimize();
    writer.close();
    directory.close();
  }
 
View Full Code Here

  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

      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

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

              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

    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

    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

    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

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.