Package org.apache.lucene.store

Examples of org.apache.lucene.store.SimpleFSDirectory$SimpleFSIndexInput$Descriptor


        listOfPatches = detector.getDescriptors(ColorVQFloatDescriptor.class, bfImg.getSubimage(0, move, bfImg.getWidth(), deltaMove));       
      }
      for(ColorVQFloatDescriptor i : listOfPatches)
      {
        //the descriptor
        Descriptor cvqfd = new ColorVQFloatDescriptor();
        cvqfd.setXmin(i.getXmin());
        cvqfd.setXmax(i.getXmax());
        cvqfd.setYmin(i.getYmin());
        cvqfd.setYmax(i.getYmax());
        cvqfd.setShape(i.getShape());
        float[] d = new float[quantizer.getBinNumber()];
     
        float surf = (i.getXmax() - i.getXmin())*(i.getYmax()-i.getYmin());
        for(int x = i.getXmin(); x < i.getXmax(); ++x)
          for(int y = i.getYmin(); y < i.getYmax(); ++y)
          {
            int[] color = r.getPixel(x, y, (int[])null);
            int index = quantizer.getBin(color);
            if(index >= 0 && index < d.length)
            {
              if(normalize)
                d[index] += 1.0f/surf;
              else
                d[index] += 1.0f;
            }
          }
     
        cvqfd.setD(d);
     
        list.add(cvqfd);
      }
    }
    if(DEBUG)
View Full Code Here


   
    ArrayList<Descriptor> list = new ArrayList<Descriptor>();
   
    while(!line.startsWith("</image"))
    {     
      Descriptor d = null;
     
      //1. head
      String head = line.substring(line.indexOf("<")+1, line.indexOf(">"));
      String[] arguments = head.split(" ");
      Class c = Descriptor.class;
     
      for(String p : arguments)
      {
        if(p.startsWith("<"))
        {
         
        }
        else if(p.startsWith("class"))
        {
          String[] s = p.split("=");
          if(s.length > 1)
          {
            String descriptorClass = s[1].trim().replaceAll("\"", "");
            c = XMLReader.class.getClassLoader().loadClass(descriptorClass);
           
            d = (Descriptor<?>) c.newInstance();
          }
        }
        else if(p.startsWith("xmin"))
        {
          String[] s = p.split("=");
          if(s.length > 1)
          {
            String xmin = s[1].trim().replaceAll("\"", "");
            d.setXmin(Integer.parseInt(xmin));
           
          }
        }
        else if(p.startsWith("xmax"))
        {
          String[] s = p.split("=");
          if(s.length > 1)
          {
            String xmax = s[1].trim().replaceAll("\"", "");
            d.setXmax(Integer.parseInt(xmax));
           
          }
        }
        else if(p.startsWith("ymin"))
        {
          String[] s = p.split("=");
          if(s.length > 1)
          {
            String ymin = s[1].trim().replaceAll("\"", "");
            d.setYmin(Integer.parseInt(ymin));
           
          }
        }
        else if(p.startsWith("ymax"))
        {
          String[] s = p.split("=");
          if(s.length > 1)
          {
            String ymax = s[1].trim().replaceAll("\"", "");
            d.setYmax(Integer.parseInt(ymax));
           
          }
        }
        else if(p.startsWith("shape"))
        {
          String[] s = p.split("=");
          if(s.length > 1)
          {
            String shape = s[1].trim().replaceAll("\"", "");
            d.setShape(shape);
           
          }
        }
      }
     
     
      //2. body
      String body = line.substring(line.indexOf('>')+1, line.lastIndexOf('<')).trim();
      String[] values = body.split(",");
      try {
        d.initD();
        String dClass = d.getD().getClass().toString();
        //double
        if(dClass.equalsIgnoreCase("class [D"))
        {
          double[] v = new double[values.length];
          for(int i = 0 ; i < v.length; i++)
            v[i] = Double.parseDouble(values[i]);
         
          d.setD(v);
        }
        //float
        else if(dClass.equalsIgnoreCase("class [F"))
        {
          float[] v = new float[values.length];
          for(int i = 0 ; i < v.length; i++)
            v[i] = Float.parseFloat(values[i]);
         
          d.setD(v);   
        }
        else
        {
          System.out.println("NOT VALID CLASS");
        }
View Full Code Here

    System.out.println(Arrays.toString(args));
    String filename = "/Users/xgu/lucene29test/caches/people-search-index";
    if (args.length>0) filename ="/Users/xgu/lucene29test/caches/people-search-index";
    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())
//    {
View Full Code Here

**/
public class SimpleFSDirectoryFactory extends DirectoryFactory {

  @Override
  public Directory open(String path) throws IOException {
    return new SimpleFSDirectory(new File(path));
  }
View Full Code Here

    @Override
    public void setUp() throws Exception {
       super.setUp();
       File file = _TestUtil.getTempDir("testIndex");
       // use a simple FSDir here, to be sure to have SimpleFSInputs
       dir = new SimpleFSDirectory(file,null);
    }
View Full Code Here

    }

    @Test
    public void testUpdateCodec() throws IOException {

        Directory dir = new SimpleFSDirectory(new File(indexdir));
        writeTestIndex(dir);

        Query q1 = new TermQuery(new Term("tag", "exampletag"));
        Query q2 = new TermQuery(new Term("tag", "updatedtag"));
View Full Code Here

    @Override
    public void setUp() throws Exception {
       super.setUp();
       File file = _TestUtil.getTempDir("testIndex");
       // use a simple FSDir here, to be sure to have SimpleFSInputs
       dir = new SimpleFSDirectory(file,null);
    }
View Full Code Here

                    throw new IOException("Unable to create directory: '" + dir + "'");
                }
            }
            LockFactory lockFactory = new NativeFSLockFactory(dir);
            if (simpleFS) {
                directory = new SimpleFSDirectory(dir, lockFactory);
            } else {
                directory = FSDirectory.open(dir, lockFactory);
            }
        }
View Full Code Here

        return false;
      }
    });
    assertEquals(1, files.length);
    File snapDir = files[0];
    Directory dir = new SimpleFSDirectory(snapDir.getAbsoluteFile());
    IndexSearcher searcher = new IndexSearcher(dir, true);
    TopDocs hits = searcher.search(new MatchAllDocsQuery(), 1);

    assertEquals(nDocs, hits.totalHits);
    searcher.close();
    dir.close();
  }
View Full Code Here

      }
    });
    assertEquals(1, files.length);
    File snapDir = files[0];

    IndexSearcher searcher = new IndexSearcher(new SimpleFSDirectory(snapDir.getAbsoluteFile(), null), true);
    TopDocs hits = searcher.search(new MatchAllDocsQuery(), 1);

    assertEquals(500, hits.totalHits);
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.store.SimpleFSDirectory$SimpleFSIndexInput$Descriptor

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.