Package org.apache.lucene.index

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


    }
 
  public void testLuceneSort() throws IOException
  {
   
    IndexReader srcReader=IndexReader.open(_indexDir,true);
      try{
        List<FacetHandler<?>> facetHandlers = new ArrayList<FacetHandler<?>>();
        facetHandlers.add(new SimpleFacetHandler("id"));
       
        BoboIndexReader reader= BoboIndexReader.getInstance(srcReader,facetHandlers, null);       // not facet handlers to help
        BoboBrowser browser = new BoboBrowser(reader);
       
        BrowseRequest browseRequest = new BrowseRequest();
        browseRequest.setCount(10);
        browseRequest.setOffset(0);
        browseRequest.addSortField(new SortField("date",SortField.STRING));
       

        doTest(browser,browseRequest,7,null,new String[]{"1","3","5","2","4","7","6"});
       
      }
      catch(IOException ioe){
        if (srcReader!=null){
          srcReader.close();
        }
        throw ioe;
      }
  }
View Full Code Here


    IndexWriter writer = new IndexWriter(idxDir,new StandardAnalyzer(Version.LUCENE_29),MaxFieldLength.UNLIMITED);
    writer.addDocument(docs[0]);
    writer.optimize();
    writer.commit();
   
    IndexReader idxReader = IndexReader.open(idxDir,true);
    BoboIndexReader boboReader = BoboIndexReader.getInstance(idxReader,_fconf);

   
    for (int i=1;i<docs.length;++i){
      Document doc = docs[i];
View Full Code Here

      d.add(buildMetaField("timeinmillis", df.format(now - l*3500000)));
      writer.addDocument(d);
      writer.optimize();
      writer.commit();
    }
    IndexReader idxReader = IndexReader.open(idxDir,true);
    BoboIndexReader boboReader = BoboIndexReader.getInstance(idxReader,facetHandlers);
    BoboBrowser browser = new BoboBrowser(boboReader);
    List<String> ranges = new ArrayList<String>();
    ranges.add("000000001");
    ranges.add("000010000");// one hour
View Full Code Here

    return new Long[]{uidArray[id]};
  }

  @Override
  public long[] load(BoboIndexReader reader) throws IOException {
    IndexReader innerReader = reader.getInnerReader();
    if (innerReader instanceof ZoieSegmentReader){
      ZoieSegmentReader zoieReader = (ZoieSegmentReader)innerReader;
      return zoieReader.getUIDArray();
    }
    else{
View Full Code Here

 
  SegmentInfos infos=new SegmentInfos();
  infos.read(targetDir);
  System.out.println("result segment count: "+infos.size());
 
  IndexReader r = IndexReader.open(targetDir,true);
  System.out.println("num docs: "+r.numDocs());
  r.close();
  }
View Full Code Here

  {
    File file = new File("/Users/jwang/dataset/facet_idx_2/beef");

    FSDirectory idxDir = FSDirectory.open(file);
   
    IndexReader reader = IndexReader.open(idxDir,true);
   
    long start =System.currentTimeMillis();
    BoboIndexReader boboReader = BoboIndexReader.getInstance(reader);

    long end =System.currentTimeMillis();
View Full Code Here

      PathFacetHandler pathHandler = new PathFacetHandler("path",true);
      facetHandlers.add(pathHandler);
  }
 
  public void testMultiValPath() throws Exception{
    IndexReader reader = IndexReader.open(directory,true);
    BoboIndexReader boboReader = BoboIndexReader.getInstance(reader, facetHandlers);
   
    BoboBrowser browser = new BoboBrowser(boboReader);
    BrowseRequest req = new BrowseRequest();
   
View Full Code Here

   */
  public static void main(String[] args) throws Exception{
    File idx = new File("/Users/jwang/dataset/people-search-index-norm/beef");
   
    Directory idxDir = FSDirectory.open(idx);
    IndexReader reader=IndexReader.open(idxDir,true);
   
    BoboIndexReader boboReader=BoboIndexReader.getInstance(reader);
    BoboBrowser browser=new BoboBrowser(boboReader);
    int iter=1000000;
    for (int i=0;i<iter;++i)
View Full Code Here

    System.out.println(filename);
    File file = new File(filename);
    FSDirectory directory = new SimpleFSDirectory(file);
//    FSDirectory directory = FSDirectory.getDirectory(file);
    System.out.println(directory.getClass().getName());
    IndexReader reader = IndexReader.open(directory, true);
    loadFile();
//    TermEnum termEnum = reader.terms(new Term("b", ""));
//    while(termEnum.next())
//    {
//      Term t = termEnum.term();
View Full Code Here

    File oDir = new File(sDirectory);
    if (oDir.exists()) {
      File[] aSegments = oDir.listFiles();
      if (null!=aSegments) {
      if (aSegments.length>0) {
          IndexReader oReader = IndexReader.open(sDirectory);
          int iDeleted = oReader.deleteDocuments(new Term("container", sFolder));
          oReader.close();
      } // fi
      } // fi
    } else {
      FileSystem oFS = new FileSystem();
      try { oFS.mkdirs(sDirectory); } catch (Exception e) { throw new IOException(e.getClass().getName()+" "+e.getMessage()); }
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.