コード例 #1
0
 public Document next() throws IRException {
   if (count != document.size()) {
     //			throw new IRException("Collect document's field count is diffent from setting's. Check
     // field names. it's case sensitive. collect field size = "+count+",
     // document.size()="+document.size());
     logger.warn(
         "Collect document's field count is diffent from setting's. Check field names. it's case sensitive. collect field size = "
             + count
             + ", document.size()="
             + document.size());
     if (hasNext() == false) return null;
   }
   count = 0;
   return document;
 }
コード例 #2
0
  //	int limit = 0;
  public boolean hasNext() throws IRException {
    //		if(limit++ >= 1200000)
    //			return false;

    int size = fieldSettingList.size();
    String key = null;
    String value = null;
    String line = null;
    document = new Document(size);
    count = 0;
    while (count < size) {
      try {
        FieldSetting fs = fieldSettingList.get(count);
        line = br.readLine();
        //				logger.debug("line = "+line);
        if (line == null) return false;
        // if(line.startsWith(DBReader.BACKUP_HEADER) || line.startsWith("insert_fastcat_id_")){
        if (line.startsWith("insert_fastcat_id_")) {
          continue;
        }
        if (line.length() == 0) {
          continue;
        }
        int p = line.indexOf(":");
        if (p > 0) {
          key = line.substring(0, p);
          value = line.substring(p + 1);
        }

        if (key.equalsIgnoreCase(fs.name)) {
          document.set(count, fs.createField(value));
          count++;
        } else {
          logger.warn(
              "skip! "
                  + key
                  + "("
                  + fs.name
                  + ")count="
                  + key.equalsIgnoreCase(fs.name)
                  + ", fs.name="
                  + fs.name
                  + ", value="
                  + value);
        }

      } catch (IOException e) {
        logger.error(e.getMessage(), e);
      }
    }

    return true;
  }