Package net.sf.clairv.index.document

Examples of net.sf.clairv.index.document.Field


  public void setIndicatorField(String field) {
    this.indicatorField = field;
  }

  public void documentExtracted(Document doc) {
    Field field = doc.getField(indicatorField);
    if (field != null) {
      try {
        long gmtTime = DateTools.stringToTime(field.getValue());
        long localTime = gmtTime + CURRENT_TIME_ZONE.getOffset(gmtTime);
        float boost = calculateBoost(localTime);
        log.info("Boosting document with value " + boost);
        doc.setBoost(boost);
      } catch (ParseException e) {
View Full Code Here


  }
 
  public void documentExtracted(Document doc) {
    Collection fields = doc.getFields();
    for (Iterator itr = fields.iterator(); itr.hasNext();) {
      Field f = (Field)itr.next();
      Float boost = (Float)fieldBoosts.get(f.getName());
      if (boost != null) {
        f.setBoost(boost.floatValue());
      }
    }
  }
View Full Code Here

    String text = urlPattern;
    if (variables != null) {
      for (int i = 0; i < variables.length; i++) {
        String v = variables[i];
        String variable = v.substring(2, v.length() - 1);
        Field f = doc.getField(variable);
        if (f.getStoreOption() == StoreOption.YES
            || f.getStoreOption() == StoreOption.COMPRESS) {
          text = text.replaceAll(Pattern.quote(v), f.getValue());
        } else {
          log.warn("Not replacing variable " + variable
              + " since corresponding field is not stored");
        }
      }
View Full Code Here

      }
    } else {
      log.info("Searchable fields not configured; trying to guess...");
      Collection fields = doc.getFields();
      for (Iterator itr = fields.iterator(); itr.hasNext(); ) {
        Field field = (Field)itr.next();
        StoreOption store = field.getStoreOption();
        IndexOption index = field.getIndexOption();
        if ((store == StoreOption.YES || store == StoreOption.COMPRESS)
            && (index == IndexOption.TOKENIZED || index == IndexOption.UN_TOKENIZED)) {
          log.info("Field " + field.getName()
              + " is added to the synthetic field");
          if (builder == null) {
            builder = new StringBuilder();
          }
          builder.append(field.getValue()).append(fieldDelimiter);
        }
      }
    }
    if (builder != null) {
      String name = syntheticField;
View Full Code Here

TOP

Related Classes of net.sf.clairv.index.document.Field

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.