Package org.apache.lucene.index

Examples of org.apache.lucene.index.IndexableField.stringValue()


  }
 
  @Override
  protected PrintWriter lineFileOut(Document doc) {
    IndexableField titleField = doc.getField(DocMaker.TITLE_FIELD);
    if (titleField!=null && titleField.stringValue().startsWith("Category:")) {
      return categoryLineFileOut;
    }
    return super.lineFileOut(doc);
  }
 
View Full Code Here


    sb.setLength(0);

    boolean sufficient = !checkSufficientFields;
    for (int i=0; i<fieldsToWrite.length; i++) {
      IndexableField f = doc.getField(fieldsToWrite[i]);
      String text = f == null ? "" : matcher.reset(f.stringValue()).replaceAll(" ").trim();
      sb.append(text).append(SEP);
      sufficient |= text.length()>0 && sufficientFields[i];
    }
    if (sufficient) {
      sb.setLength(sb.length()-1); // remove redundant last separator
View Full Code Here

        currentWeight = getWeight(currentDocId);
       
        IndexableField fieldVal = doc.getField(field);
        if (fieldVal == null) {
          throw new IllegalArgumentException(field + " does not exist");
        } else if(fieldVal.stringValue() == null) {
          throw new IllegalArgumentException(field + " does not have string value");
        }
       
        return new BytesRef(fieldVal.stringValue());
      }
View Full Code Here

          throw new IllegalArgumentException(field + " does not exist");
        } else if(fieldVal.stringValue() == null) {
          throw new IllegalArgumentException(field + " does not have string value");
        }
       
        return new BytesRef(fieldVal.stringValue());
      }
      return null;
    }

    @Override
View Full Code Here

    List<String> invalidDocTerms = res.getKey();
    Random rand = random();
    List<String> termsToDel = new ArrayList<String>();
    for(Document doc : docs.values()) {
      IndexableField f = doc.getField(FIELD_NAME);
      if(rand.nextBoolean() && f != null && !invalidDocTerms.contains(f.stringValue())) {
        termsToDel.add(doc.get(FIELD_NAME));
      }
      writer.addDocument(doc);
    }
    writer.commit();
View Full Code Here

        BytesRef tempPayload = null;
        BytesRef tempTerm = null;
       
        if (hasPayloads) {
          IndexableField payload = doc.getField(payloadField);
          if (payload == null || (payload.binaryValue() == null && payload.stringValue() == null)) {
            continue;
          }
          tempPayload = (payload.binaryValue() != null) ? payload.binaryValue() : new BytesRef(payload.stringValue());
        }
       
View Full Code Here

        if (hasPayloads) {
          IndexableField payload = doc.getField(payloadField);
          if (payload == null || (payload.binaryValue() == null && payload.stringValue() == null)) {
            continue;
          }
          tempPayload = (payload.binaryValue() != null) ? payload.binaryValue() : new BytesRef(payload.stringValue());
        }
       
        IndexableField fieldVal = doc.getField(field);
        if (fieldVal == null || (fieldVal.binaryValue() == null && fieldVal.stringValue() == null)) {
          continue;
View Full Code Here

          }
          tempPayload = (payload.binaryValue() != null) ? payload.binaryValue() : new BytesRef(payload.stringValue());
        }
       
        IndexableField fieldVal = doc.getField(field);
        if (fieldVal == null || (fieldVal.binaryValue() == null && fieldVal.stringValue() == null)) {
          continue;
        }
        tempTerm = (fieldVal.stringValue() != null) ? new BytesRef(fieldVal.stringValue()) : fieldVal.binaryValue();
       
        currentPayload = tempPayload;
View Full Code Here

       
        IndexableField fieldVal = doc.getField(field);
        if (fieldVal == null || (fieldVal.binaryValue() == null && fieldVal.stringValue() == null)) {
          continue;
        }
        tempTerm = (fieldVal.stringValue() != null) ? new BytesRef(fieldVal.stringValue()) : fieldVal.binaryValue();
       
        currentPayload = tempPayload;
        currentWeight = getWeight(doc, currentDocId);
       
        return tempTerm;
View Full Code Here

       
        IndexableField fieldVal = doc.getField(field);
        if (fieldVal == null || (fieldVal.binaryValue() == null && fieldVal.stringValue() == null)) {
          continue;
        }
        tempTerm = (fieldVal.stringValue() != null) ? new BytesRef(fieldVal.stringValue()) : fieldVal.binaryValue();
       
        currentPayload = tempPayload;
        currentWeight = getWeight(doc, currentDocId);
       
        return tempTerm;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.