Package org.apache.lucene.index

Examples of org.apache.lucene.index.IndexReader$FieldOption


    if (DebugFile.trace)
      DebugFile.writeln("new IndexWriter(...)");

  if (!bNewIndex) {
      IndexReader oIRdr = IndexReader.open(sDirectory);
      oIRdr.deleteDocuments(new Term("guid",sGuid));
      oIRdr.close();
  }

    IndexWriter oIWrt = new IndexWriter(sDirectory, (Analyzer) oAnalyzer.newInstance(), bNewIndex);
 
  addNewsMessage(oIWrt, sGuid, sWorkArea, sContainer, sTitle, sAuthor, dtCreated, sText);
View Full Code Here


    Class oAnalyzer = Class.forName(oProps.getProperty("analyzer", DEFAULT_ANALYZER));

    if (DebugFile.trace)
      DebugFile.writeln("IndexReader.open("+sDirectory+")");

    IndexReader oIRdr = IndexReader.open(sDirectory);
    oIRdr.deleteDocuments(new Term("guid", sGuid));
    oIRdr.close();

    IndexWriter oIWrt = new IndexWriter(sDirectory, (Analyzer) oAnalyzer
        .newInstance(), bNewIndex);

    addDocument(oIWrt, sGuid, sWorkArea, oConn);
View Full Code Here

    File oDir = new File(sDirectory);
    if (oDir.exists()) {
      File[] aFiles = oDir.listFiles();
      if (null!=aFiles) {
        if (aFiles.length>0) {
          IndexReader oReader = IndexReader.open(sDirectory);     
          int iDeleted = oReader.deleteDocuments(new Term("workarea", sWorkArea));
          oReader.close();
        }
      }
    } else {
      FileSystem oFS = new FileSystem();
      try { oFS.mkdirs(sDirectory); } catch (Exception e) { throw new IOException(e.getClass().getName()+" "+e.getMessage()); }
View Full Code Here

    if (!oDir.exists()) {
      FileSystem oFS = new FileSystem();
      try { oFS.mkdirs(sDirectory); } catch (Exception e) { throw new IOException(e.getClass().getName()+" "+e.getMessage()); }
    } // fi

    IndexReader oReader = IndexReader.open(sDirectory);

    int iDeleted = oReader.deleteDocuments(new Term("guid", sGuid));

    oReader.close();

    return iDeleted;
  } // delete
View Full Code Here

    addDoc("2", new String[]{ "aa","bb"}, new String[]{"aaa","bbb"}, new int[]{200,200});
    addDoc("3", new String[]{ "aa","bb"}, new String[]{"bbb","aaa"}, new int[]{300,300});
    addDoc("3", new String[]{ "bb","aa"}, new String[]{"bbb","bbb"}, new int[]{300,400});
    addDoc("3", new String[]{ "bb","aa"}, new String[]{"aaa","ccc"}, new int[]{300,500});
    writer.commit();
    IndexReader reader = IndexReader.open(directory, true);
    searcher = new IndexSearcher(reader);
    IndexReader readerWithCache = new IndexReaderWithMetaDataCache(reader);
    searcherWithCache = new IndexSearcher(readerWithCache);
  }
View Full Code Here

    doc.add(field);
  }
 
  public void testSimpleSearch() throws Exception
  {
    IndexReader reader = searcher.getIndexReader();
   
    BooleanQuery bquery;
    SectionSearchQuery squery;
    Scorer scorer;
    int count;
View Full Code Here

    metaDataSearch(searcherWithCache);   
  }
 
  private void metaDataSearch(IndexSearcher searcher) throws Exception
  {
    IndexReader reader = searcher.getIndexReader();
   
    BooleanQuery bquery;
    SectionSearchQuery squery;
    Scorer scorer;
    int count;
View Full Code Here

    }
  }
 
  public void testFacetHandlerLoad() throws Exception
  {
    IndexReader reader = IndexReader.open(_ramDir,true);
   
    List<FacetHandler<?>> list = new LinkedList<FacetHandler<?>>();
    NoopFacetHandler h1 = new NoopFacetHandler("A");
    list.add(h1);
   
View Full Code Here

    browser.close();
  }
 
  public void testNegativeLoadTest() throws Exception
  {
    IndexReader reader = IndexReader.open(_ramDir,true);
   
    List<FacetHandler<?>> list = new LinkedList<FacetHandler<?>>();
    HashSet<String> s1 = new HashSet<String>();
    s1.add("C");
    NoopFacetHandler h1 = new NoopFacetHandler("A",s1);
View Full Code Here

   * @param termFile Der Ort, wo die Datei erstellt werden soll.
   *
   * @throws RegainException Wenn die Erstellung fehlgeschlagen ist.
   */
  private void writeTermFile(File indexDir, File termFile) throws RegainException {
    IndexReader reader = null;
    FileOutputStream stream = null;
    PrintWriter writer = null;
    try {
      reader = IndexReader.open(FSDirectory.open(indexDir), true);

      stream = new FileOutputStream(termFile);
      writer = new PrintWriter(stream);
      writer.println("This file was generated by the crawler and contains all " + "terms in the index.");
      writer.println("It's no error when endings like 'e', 'en', and so on " + "are missing.");
      writer.println("They have been cuttet by the GermanAnalyzer and will be " + "cuttet from a search query too.");
      writer.println();

      // Write the terms
      TermEnum termEnum = reader.terms();
      int termCount;
      if (WRITE_TERMS_SORTED) {
        termCount = writeTermsSorted(termEnum, writer);
      } else {
        termCount = writeTermsSimply(termEnum, writer);
      }

      mLog.info("Wrote " + termCount + " terms into " + termFile.getAbsolutePath());
    } catch (IOException exc) {
      throw new RegainException("Writing term file failed", exc);
    } finally {
      if (reader != null) {
        try {
          reader.close();
        } catch (IOException exc) {
        }
      }
      if (writer != null) {
        writer.close();
View Full Code Here

TOP

Related Classes of org.apache.lucene.index.IndexReader$FieldOption

Copyright © 2018 www.massapicom. 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.