Package org.apache.lucene.store

Examples of org.apache.lucene.store.Directory


                    access = new IndexAccess();
                    access.modifier = new IndexModifier(path, analyzer, recreate);
                    ## LUCENE2 end ##*/
                    //## LUCENE3 begin ##
                    File f = new File(path);
                    Directory indexDir = FSDirectory.open(f);
                    boolean recreate = !IndexReader.indexExists(indexDir);
                    Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_30);
                    IndexWriter writer = new IndexWriter(indexDir, analyzer,
                            recreate, IndexWriter.MaxFieldLength.UNLIMITED);
                    //see http://wiki.apache.org/lucene-java/NearRealtimeSearch
View Full Code Here


 
  int numReps = Integer.parseInt(args[2]);
  int numsegs = Integer.parseInt(args[3]);
 
 
  Directory srcDir = FSDirectory.open(srcIdx);
  Directory targetDir = FSDirectory.open(targetIndx);
  int timesReplicatePerSeg = numReps/numsegs;
  IndexWriter writer = new IndexWriter(targetDir,new StandardAnalyzer(Version.LUCENE_CURRENT),MaxFieldLength.UNLIMITED);
  writer.setMaxMergeDocs(Integer.MAX_VALUE);
  writer.setMergeFactor(Integer.MAX_VALUE);
 
View Full Code Here

   * @param args
   */
  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;
View Full Code Here

    doTest(req,7,answer,null);

  }
 
  public void testIndexReaderReopen() throws Exception{
    Directory idxDir = new RAMDirectory();
    Document[] docs = buildData();
   
    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];
      int numDocs = boboReader.numDocs();
      BoboIndexReader reader = (BoboIndexReader)boboReader.reopen(true);
      assertSame(boboReader,reader);
     
      Directory tmpDir = new RAMDirectory();
      IndexWriter subWriter = new IndexWriter(tmpDir,new StandardAnalyzer(Version.LUCENE_29),MaxFieldLength.UNLIMITED);
      subWriter.addDocument(doc);
      subWriter.optimize();
      subWriter.close();
      writer.addIndexesNoOptimize(new Directory[]{tmpDir});
View Full Code Here

  public void testTime() throws Exception
  {
    List<FacetHandler<?>> facetHandlers = new ArrayList<FacetHandler<?>>();
    /* Underlying time facet for DynamicTimeRangeFacetHandler */
    facetHandlers.add(new RangeFacetHandler("timeinmillis", new PredefinedTermListFactory(Long.class, DynamicTimeRangeFacetHandler.NUMBER_FORMAT),null));
    Directory idxDir = new RAMDirectory();
    IndexWriter writer = new IndexWriter(idxDir,new StandardAnalyzer(Version.LUCENE_29),MaxFieldLength.UNLIMITED);
   
    long now = System.currentTimeMillis();
    DecimalFormat df = new DecimalFormat(DynamicTimeRangeFacetHandler.NUMBER_FORMAT);
    for(long l=0; l<53; l++)
View Full Code Here

     
      return dataList.toArray(new Document[dataList.size()]);
  }
 
  private Directory createIndexTwo(){
    Directory dir = new RAMDirectory();
    try {
      Document[] data= createDataTwo();
     
      TestDataDigester testDigester=new TestDataDigester(_facetHandlers,data);
      BoboIndexer indexer=new BoboIndexer(testDigester,dir);
View Full Code Here

    return dir;
  }
 
 
  private Directory createIndex(){
    Directory dir = new RAMDirectory();
    try {
      Document[] data= createData();
     
      TestDataDigester testDigester=new TestDataDigester(_facetHandlers,data);
      BoboIndexer indexer=new BoboIndexer(testDigester,dir);
View Full Code Here

    BrowseResult result = null;
    BoboBrowser boboBrowser=null;
    int expectedHitNum = (_documentSize/2) - 1;
    try {
      Directory ramIndexDir = createIndex();
      IndexReader srcReader=IndexReader.open(ramIndexDir,true);
      boboBrowser = new BoboBrowser(BoboIndexReader.getInstance(srcReader,_facetHandlers, null));
      result = boboBrowser.browse(br);
     
      assertEquals(expectedHitNum,result.getNumHits());
View Full Code Here

    System.out.println("testNotValuesForRangeFacetHandler");
    BrowseResult result = null;
    BoboBrowser boboBrowser=null;
   
    try {
      Directory ramIndexDir = createIndexTwo();
      IndexReader srcReader=IndexReader.open(ramIndexDir,true);
      boboBrowser = new BoboBrowser(BoboIndexReader.getInstance(srcReader,_facetHandlers, null));
     
      BrowseRequest br=new BrowseRequest();
      br.setCount(20);
View Full Code Here

    }
    return dataList.toArray(new Document[dataList.size()]);
}
 
  private Directory createIndex(){
    Directory dir = new RAMDirectory();
    try {
      Document[] data= createData();
     
      TestDataDigester testDigester=new TestDataDigester(_facetHandlers,data);
      BoboIndexer indexer=new BoboIndexer(testDigester,dir);
View Full Code Here

TOP

Related Classes of org.apache.lucene.store.Directory

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.