亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? indexmodifier.java

?? lucene完整源碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package org.apache.lucene.index;/** * Copyright 2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *     http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */import org.apache.lucene.analysis.Analyzer;import org.apache.lucene.document.Document;import org.apache.lucene.store.Directory;import org.apache.lucene.store.FSDirectory;import java.io.File;import java.io.IOException;import java.io.PrintStream;/** * A class to modify an index, i.e. to delete and add documents. This * class hides {@link IndexReader} and {@link IndexWriter} so that you * do not need to care about implementation details such as that adding * documents is done via IndexWriter and deletion is done via IndexReader. *  * <p>Note that you cannot create more than one <code>IndexModifier</code> object * on the same directory at the same time. *  * <p>Example usage: * <!-- ======================================================== --><!-- = Java Sourcecode to HTML automatically converted code = --><!-- =   Java2Html Converter V4.1 2004 by Markus Gebhard  markus@jave.de   = --><!-- =     Further information: http://www.java2html.de     = --><div align="left" class="java"><table border="0" cellpadding="3" cellspacing="0" bgcolor="#ffffff">   <tr>  <!-- start source code -->   <td nowrap="nowrap" valign="top" align="left">    <code><font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">Analyzer&nbsp;analyzer&nbsp;=&nbsp;</font><font color="#7f0055"><b>new&nbsp;</b></font><font color="#000000">StandardAnalyzer</font><font color="#000000">()</font><font color="#000000">;</font><br/><font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#3f7f5f">//&nbsp;create&nbsp;an&nbsp;index&nbsp;in&nbsp;/tmp/index,&nbsp;overwriting&nbsp;an&nbsp;existing&nbsp;one:</font><br/><font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">IndexModifier&nbsp;indexModifier&nbsp;=&nbsp;</font><font color="#7f0055"><b>new&nbsp;</b></font><font color="#000000">IndexModifier</font><font color="#000000">(</font><font color="#2a00ff">&#34;/tmp/index&#34;</font><font color="#000000">,&nbsp;analyzer,&nbsp;</font><font color="#7f0055"><b>true</b></font><font color="#000000">)</font><font color="#000000">;</font><br/><font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">Document&nbsp;doc&nbsp;=&nbsp;</font><font color="#7f0055"><b>new&nbsp;</b></font><font color="#000000">Document</font><font color="#000000">()</font><font color="#000000">;</font><br/><font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">doc.add</font><font color="#000000">(</font><font color="#7f0055"><b>new&nbsp;</b></font><font color="#000000">Field</font><font color="#000000">(</font><font color="#2a00ff">&#34;id&#34;</font><font color="#000000">,&nbsp;</font><font color="#2a00ff">&#34;1&#34;</font><font color="#000000">,&nbsp;Field.Store.YES,&nbsp;Field.Index.UN_TOKENIZED</font><font color="#000000">))</font><font color="#000000">;</font><br/><font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">doc.add</font><font color="#000000">(</font><font color="#7f0055"><b>new&nbsp;</b></font><font color="#000000">Field</font><font color="#000000">(</font><font color="#2a00ff">&#34;body&#34;</font><font color="#000000">,&nbsp;</font><font color="#2a00ff">&#34;a&nbsp;simple&nbsp;test&#34;</font><font color="#000000">,&nbsp;Field.Store.YES,&nbsp;Field.Index.TOKENIZED</font><font color="#000000">))</font><font color="#000000">;</font><br/><font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">indexModifier.addDocument</font><font color="#000000">(</font><font color="#000000">doc</font><font color="#000000">)</font><font color="#000000">;</font><br/><font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>int&nbsp;</b></font><font color="#000000">deleted&nbsp;=&nbsp;indexModifier.delete</font><font color="#000000">(</font><font color="#7f0055"><b>new&nbsp;</b></font><font color="#000000">Term</font><font color="#000000">(</font><font color="#2a00ff">&#34;id&#34;</font><font color="#000000">,&nbsp;</font><font color="#2a00ff">&#34;1&#34;</font><font color="#000000">))</font><font color="#000000">;</font><br/><font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">System.out.println</font><font color="#000000">(</font><font color="#2a00ff">&#34;Deleted&nbsp;&#34;&nbsp;</font><font color="#000000">+&nbsp;deleted&nbsp;+&nbsp;</font><font color="#2a00ff">&#34;&nbsp;document&#34;</font><font color="#000000">)</font><font color="#000000">;</font><br/><font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">indexModifier.flush</font><font color="#000000">()</font><font color="#000000">;</font><br/><font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">System.out.println</font><font color="#000000">(</font><font color="#000000">indexModifier.docCount</font><font color="#000000">()&nbsp;</font><font color="#000000">+&nbsp;</font><font color="#2a00ff">&#34;&nbsp;docs&nbsp;in&nbsp;index&#34;</font><font color="#000000">)</font><font color="#000000">;</font><br/><font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">indexModifier.close</font><font color="#000000">()</font><font color="#000000">;</font></code>   </td>  <!-- end source code -->   </tr></table></div><!-- =       END of automatically generated HTML code       = --><!-- ======================================================== --> * * <p>Not all methods of IndexReader and IndexWriter are offered by this * class. If you need access to additional methods, either use those classes * directly or implement your own class that extends <code>IndexModifier</code>. * * <p>Although an instance of this class can be used from more than one * thread, you will not get the best performance. You might want to use * IndexReader and IndexWriter directly for that (but you will need to * care about synchronization yourself then). * * <p>While you can freely mix calls to add() and delete() using this class, * you should batch you calls for best performance. For example, if you * want to update 20 documents, you should first delete all those documents, * then add all the new documents. * * @author Daniel Naber */public class IndexModifier {  protected IndexWriter indexWriter = null;  protected IndexReader indexReader = null;  protected Directory directory = null;  protected Analyzer analyzer = null;  protected boolean open = false;  // Lucene defaults:  protected PrintStream infoStream = null;  protected boolean useCompoundFile = true;  protected int maxBufferedDocs = IndexWriter.DEFAULT_MAX_BUFFERED_DOCS;  protected int maxFieldLength = IndexWriter.DEFAULT_MAX_FIELD_LENGTH;  protected int mergeFactor = IndexWriter.DEFAULT_MERGE_FACTOR;  /**   * Open an index with write access.   *   * @param directory the index directory   * @param analyzer the analyzer to use for adding new documents   * @param create <code>true</code> to create the index or overwrite the existing one;   * 	<code>false</code> to append to the existing index   */  public IndexModifier(Directory directory, Analyzer analyzer, boolean create) throws IOException {    init(directory, analyzer, create);  }  /**   * Open an index with write access.   *   * @param dirName the index directory   * @param analyzer the analyzer to use for adding new documents   * @param create <code>true</code> to create the index or overwrite the existing one;   * 	<code>false</code> to append to the existing index   */  public IndexModifier(String dirName, Analyzer analyzer, boolean create) throws IOException {    Directory dir = FSDirectory.getDirectory(dirName, create);    init(dir, analyzer, create);  }  /**   * Open an index with write access.   *   * @param file the index directory   * @param analyzer the analyzer to use for adding new documents   * @param create <code>true</code> to create the index or overwrite the existing one;   * 	<code>false</code> to append to the existing index   */  public IndexModifier(File file, Analyzer analyzer, boolean create) throws IOException {    Directory dir = FSDirectory.getDirectory(file, create);    init(dir, analyzer, create);  }  /**   * Initialize an IndexWriter.   * @throws IOException   */  protected void init(Directory directory, Analyzer analyzer, boolean create) throws IOException {    this.directory = directory;    synchronized(this.directory) {      this.analyzer = analyzer;      indexWriter = new IndexWriter(directory, analyzer, create);      open = true;    }  }  /**   * Throw an IllegalStateException if the index is closed.   * @throws IllegalStateException   */  protected void assureOpen() {    if (!open) {      throw new IllegalStateException("Index is closed");    }  }  /**   * Close the IndexReader and open an IndexWriter.   * @throws IOException   */  protected void createIndexWriter() throws IOException {    if (indexWriter == null) {      if (indexReader != null) {        indexReader.close();        indexReader = null;      }      indexWriter = new IndexWriter(directory, analyzer, false);      indexWriter.setInfoStream(infoStream);      indexWriter.setUseCompoundFile(useCompoundFile);      indexWriter.setMaxBufferedDocs(maxBufferedDocs);      indexWriter.setMaxFieldLength(maxFieldLength);      indexWriter.setMergeFactor(mergeFactor);    }  }  /**   * Close the IndexWriter and open an IndexReader.   * @throws IOException   */  protected void createIndexReader() throws IOException {    if (indexReader == null) {      if (indexWriter != null) {        indexWriter.close();        indexWriter = null;      }      indexReader = IndexReader.open(directory);    }  }  /**   * Make sure all changes are written to disk.   * @throws IOException   */  public void flush() throws IOException {    synchronized(directory) {      assureOpen();      if (indexWriter != null) {        indexWriter.close();        indexWriter = null;        createIndexWriter();      } else {        indexReader.close();        indexReader = null;        createIndexReader();      }    }  }  /**   * Adds a document to this index, using the provided analyzer instead of the   * one specific in the constructor.  If the document contains more than   * {@link #setMaxFieldLength(int)} terms for a given field, the remainder are   * discarded.   * @see IndexWriter#addDocument(Document, Analyzer)   * @throws IllegalStateException if the index is closed   */  public void addDocument(Document doc, Analyzer docAnalyzer) throws IOException {    synchronized(directory) {      assureOpen();      createIndexWriter();      if (docAnalyzer != null)        indexWriter.addDocument(doc, docAnalyzer);      else        indexWriter.addDocument(doc);    }  }  /**   * Adds a document to this index.  If the document contains more than   * {@link #setMaxFieldLength(int)} terms for a given field, the remainder are   * discarded.   * @see IndexWriter#addDocument(Document)   * @throws IllegalStateException if the index is closed   */  public void addDocument(Document doc) throws IOException {    addDocument(doc, null);  }  /**   * Deletes all documents containing <code>term</code>.   * This is useful if one uses a document field to hold a unique ID string for   * the document.  Then to delete such a document, one merely constructs a   * term with the appropriate field and the unique ID string as its text and   * passes it to this method.  Returns the number of documents deleted.   * @return the number of documents deleted   * @see IndexReader#deleteDocuments(Term)   * @throws IllegalStateException if the index is closed   */  public int deleteDocuments(Term term) throws IOException {    synchronized(directory) {      assureOpen();      createIndexReader();

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品乱人伦| 天堂一区二区在线| 视频精品一区二区| 丁香亚洲综合激情啪啪综合| 欧美人妖巨大在线| 国产精品青草久久| 91玉足脚交白嫩脚丫在线播放| 亚洲视频一区二区在线观看| 欧美日韩成人一区二区| 欧美剧情片在线观看| 国产精品久久久久aaaa樱花| 美女视频一区二区| 欧美日韩高清在线| 亚洲精品欧美综合四区| 国产ts人妖一区二区| www一区二区| 日本v片在线高清不卡在线观看| 在线视频中文字幕一区二区| 国产精品毛片a∨一区二区三区| 国产清纯美女被跳蛋高潮一区二区久久w | 亚洲妇熟xx妇色黄| 欧美久久久久久蜜桃| 亚洲精品国产精品乱码不99 | 美女在线视频一区| 91麻豆免费看| 日日摸夜夜添夜夜添精品视频| 欧美本精品男人aⅴ天堂| 久久精品视频在线免费观看| 日韩欧美一级二级三级久久久| 欧美一区二区高清| 欧美专区日韩专区| 91啪亚洲精品| 91在线一区二区三区| 韩国精品在线观看| 国产在线视频一区二区| 韩国一区二区三区| aa级大片欧美| 国产真实乱子伦精品视频| 亚洲福利视频一区| 国产精品久久久久婷婷| 4438亚洲最大| 粉嫩aⅴ一区二区三区四区| 夜夜精品浪潮av一区二区三区| 欧美福利一区二区| 97se亚洲国产综合自在线观| 国产美女一区二区| 男女视频一区二区| 成人欧美一区二区三区小说| 国产无人区一区二区三区| 欧美一区二区三区精品| 国产精品一区不卡| 激情久久久久久久久久久久久久久久| 久久99精品久久久久| 欧美精品123区| 99久久精品免费精品国产| 日韩主播视频在线| 精品久久国产97色综合| 国产成人免费xxxxxxxx| 日韩国产精品久久| 五月婷婷久久丁香| 国产精品初高中害羞小美女文 | 欧美精选一区二区| 国产精华液一区二区三区| 亚洲蜜臀av乱码久久精品| 欧美视频完全免费看| 亚洲国产va精品久久久不卡综合| 久久婷婷国产综合精品青草| 91免费版pro下载短视频| 亚洲免费观看高清完整| 欧美日韩精品一区二区三区四区| 日韩激情av在线| 亚洲色图制服丝袜| 久久婷婷一区二区三区| 国产日韩欧美制服另类| 亚洲国产精品成人综合| 麻豆一区二区在线| 久久国产日韩欧美精品| 在线一区二区视频| 国产精品福利在线播放| 国产sm精品调教视频网站| 欧美一区二区三区电影| 欧美亚洲一区二区在线| 国产日韩v精品一区二区| 午夜不卡在线视频| 色综合色综合色综合| 欧美精品日日鲁夜夜添| 欧美一区二区三区白人| 精品奇米国产一区二区三区| 久久午夜羞羞影院免费观看| 日本一区二区在线不卡| 一色屋精品亚洲香蕉网站| 亚洲成人资源在线| 毛片不卡一区二区| 国产精一品亚洲二区在线视频| 94色蜜桃网一区二区三区| 欧美日韩的一区二区| 4hu四虎永久在线影院成人| 国产片一区二区| 国产主播一区二区三区| 麻豆精品在线视频| 另类综合日韩欧美亚洲| 亚洲国产精品精华液网站| 日韩经典中文字幕一区| 久久精品国产99| 色婷婷av一区二区三区gif | 捆绑紧缚一区二区三区视频| 欧美亚洲一区三区| 亚洲国产一区二区三区| 欧美日韩一卡二卡三卡| 日韩不卡一区二区| wwwwxxxxx欧美| www.亚洲色图| 午夜日韩在线观看| 日韩美女主播在线视频一区二区三区| 天天综合天天做天天综合| 国产成人精品一区二区三区四区 | 欧美日韩综合不卡| 91精品欧美一区二区三区综合在| 久久婷婷一区二区三区| 日韩电影免费在线| 在线一区二区视频| 国产日韩欧美精品在线| 国产自产v一区二区三区c| 亚洲电影视频在线| 亚洲日本青草视频在线怡红院| 亚洲精品在线三区| 制服丝袜亚洲精品中文字幕| 欧美日韩精品二区第二页| 亚洲超碰97人人做人人爱| 久久久久久麻豆| 亚洲一级二级三级在线免费观看| 91视视频在线观看入口直接观看www| 欧美日韩高清在线播放| 日韩电影免费在线观看网站| 日韩一区二区精品| 久久国产精品区| 国产成人免费视频| 伊人色综合久久天天| 久久尤物电影视频在线观看| 欧美视频一区二区三区四区| 成人sese在线| 国产在线日韩欧美| 麻豆精品一二三| 午夜私人影院久久久久| 亚洲欧美韩国综合色| 中文字幕巨乱亚洲| 欧美一区二区三区日韩| 国产成人免费av在线| 国产精品第13页| 亚洲人吸女人奶水| 日韩亚洲国产中文字幕欧美| 国产一区不卡在线| 亚洲色图欧美在线| 欧美一区二区视频网站| 国产精品亚洲一区二区三区在线| 国产无人区一区二区三区| 色综合久久六月婷婷中文字幕| 日本美女一区二区| 亚洲三级在线免费观看| 欧美二区三区的天堂| 国产精品一品二品| 国产乱子伦视频一区二区三区| 极品瑜伽女神91| 国产永久精品大片wwwapp| 国产高清视频一区| 成人网页在线观看| av亚洲精华国产精华精华| 色综合天天综合网天天看片| 在线观看一区不卡| 欧美老肥妇做.爰bbww| 91精品中文字幕一区二区三区| 日韩精品在线一区| 久久久国产综合精品女国产盗摄| 国产视频一区在线播放| 中文字幕一区二区三区精华液 | 成人一区二区三区视频在线观看 | 蜜桃av一区二区在线观看| 精品综合免费视频观看| 亚洲国产一区二区三区青草影视| 亚洲六月丁香色婷婷综合久久| 1024亚洲合集| 亚洲一区二区中文在线| 久久九九国产精品| 在线成人午夜影院| 91麻豆福利精品推荐| 国产超碰在线一区| 国产精品中文字幕欧美| 国产一区二区调教| 国产福利91精品一区| 日韩一区二区免费在线电影| 国产欧美日韩激情| 亚洲国产精品久久久久婷婷884| 麻豆精品国产传媒mv男同| 国产不卡在线视频| 欧美日韩国产高清一区二区三区| 久久午夜羞羞影院免费观看| 亚洲香肠在线观看| 成人高清伦理免费影院在线观看| 欧美精品色综合| 亚洲色图欧洲色图|