Package proj.zoie.api

Examples of proj.zoie.api.ZoieIndexReader


      retstr += readers.size() + " readers obtained\n";
      for (int readerid = 0; readerid < readers.size(); readerid++)
      {
        retstr += "reader: " + readerid + "\n";
        docstr += "reader: " + readerid + "\n";
        ZoieIndexReader reader = readers.get(readerid);
        DocIDMapper idmapper = reader.getDocIDMaper();
        try
        {
          Collection fieldnames = reader.getFieldNames(FieldOption.ALL);
          String fieldnamess = Arrays.toString(fieldnames.toArray());
          retstr += "fields: " + fieldnamess + "\n";
          searcher = new IndexSearcher(reader);
          TopDocs hits = searcher.search(q, 10);
          String docs = "";
          for (int i = 0; i < hits.scoreDocs.length; i++)
          {
            int docid = hits.scoreDocs[i].doc;
            float score = hits.scoreDocs[i].score;
            Explanation exp = searcher.explain(q, docid);
            Document doc = reader.document(docid);
            long uid = reader.getUID(docid);
            docs = docs + "UID: " + formatter.format(uid) + "\ndocid(in reader): " + formatter.format(docid) + "\nscore: " + score + "\n\n";
            docstr = docstr + "UID: " + formatter.format(uid) + "\ndocid(in reader): " + formatter.format(docid) + "\nscore: " + score + "\n" + doc + "\n" + exp + "\n\n";
          }
          retstr += hits.totalHits + " hits returned\n" + docs + "\n";
        } finally
View Full Code Here


      readers = zoie.getIndexReaders();
      retstr += readers.size() + " readers obtained\n";
      for (int readerid = 0; readerid < readers.size(); readerid++)
      {
        retstr += "reader: " + readerid + "\n";
        ZoieIndexReader reader = readers.get(readerid);
        DocIDMapper idmapper = reader.getDocIDMaper();
        int docid = idmapper.getDocID(UID);
        retstr += "docid(in reader): " + formatter.format(docid) + "\n";
        if (docid == DocIDMapper.NOT_FOUND)
        {
          retstr += "not found in this reader\n";
          continue;
        }
        if (docid==ZoieIndexReader.DELETED_UID || reader.isDeleted(docid))
        {
          retstr += "deleted\n";
        }
        Document doc = reader.document(docid);
        retstr += doc + "\n";
      }
    } catch (IOException e)
    {
      log.error(e);
View Full Code Here

    this.deletionListener = deletionListener;  
  }
 
  @Override
  public DocIdSet getDocIdSet(final IndexReader reader) throws IOException {   
    final ZoieIndexReader zoieIndexReader = (ZoieIndexReader)reader;
    return new DocIdSet() {
      public DocIdSetIterator iterator() throws IOException {
        return new DocIdSetIteratorWrapper(internal.getDocIdSet(reader).iterator()) {         
          @Override
          protected void handeDoc(int ret) {           
            deletionListener.onDelete(reader, zoieIndexReader.getUID(ret));           
          }
        };
      }
    };
  }
View Full Code Here

    String pathname = getDirPath();
    SenseiStarter.rmrf(new File("sensei-test"));
    dir = new File(pathname);
    dir.mkdirs();
   
    ZoieIndexReader reader =  EasyMock.createMock(ZoieIndexReader.class);
    EasyMock.expect(reader.getDocIDMaper()).andReturn(new DocIDMapperImpl(new long[] {105L, 107L})).anyTimes();
   
     zoie = org.easymock.EasyMock.createMock(Zoie.class);
    org.easymock.EasyMock.expect(zoie.getIndexReaders()).andReturn(Arrays.asList(reader)).anyTimes();
   
    zoie.returnIndexReaders(org.easymock.EasyMock.<List>notNull());
View Full Code Here

        for (String docid : docids){
          idList.add(Integer.parseInt(docid.trim()));
        }
        int[] idArray = idList.toIntArray();
        StringBuffer sbuf = new StringBuffer();
        ZoieIndexReader zoieReader = getZoieReader();
        boolean first = true;
        for (int docid : idArray){
          long uid;
          try{
            uid = zoieReader.getUID(docid);
          }
          catch(Exception e){
            uid=-1;
          }
          if (!first){
View Full Code Here

        for (String uid : uids){
          idList.add(Integer.parseInt(uid.trim()));
        }
        int[] idArray = idList.toIntArray();
        StringBuffer sbuf = new StringBuffer();
        ZoieIndexReader zoieReader = getZoieReader();
        DocIDMapper mapper = zoieReader.getDocIDMaper();
        boolean first = true;
        for (int uid : idArray){
          int docid;
          try{
            docid = mapper.getDocID(uid);
View Full Code Here

TOP

Related Classes of proj.zoie.api.ZoieIndexReader

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.