Package org.apache.lucene.document

Examples of org.apache.lucene.document.Fieldable.stringValue()


    String[] fields = new String[docFields.size()];
    String[] values = new String[docFields.size()];
    for (int i = 0; i < docFields.size(); i++) {
      Fieldable field = docFields.get(i);
      fields[i] = field.name();
      values[i] = field.stringValue();
    }

    return new HitDetails(fields, values);
  }
View Full Code Here


        {
          Reader reader;        // find or make Reader
          if (field.readerValue() != null)
            reader = field.readerValue();
          else if (field.stringValue() != null)
            reader = new StringReader(field.stringValue());
          else
            throw new IllegalArgumentException
                    ("field must have either String or Reader value");

          // Tokenize field and add to postingTable
View Full Code Here

      if (length>0) position+=analyzer.getPositionIncrementGap(fieldName);
      int offset = fieldOffsets[fieldNumber];       // offset field

      if (field.isIndexed()) {
        if (!field.isTokenized()) {      // un-tokenized field
          String stringValue = field.stringValue();
          if(field.isStoreOffsetWithTermVector())
            addPosition(fieldName, stringValue, position++, new TermVectorOffsetInfo(offset, offset + stringValue.length()));
          else
            addPosition(fieldName, stringValue, position++, null);
          offset += stringValue.length();
View Full Code Here

        } else
        {
          Reader reader;        // find or make Reader
          if (field.readerValue() != null)
            reader = field.readerValue();
          else if (field.stringValue() != null)
            reader = new StringReader(field.stringValue());
          else
            throw new IllegalArgumentException
                    ("field must have either String or Reader value");
View Full Code Here

  }

  @Override
  public Object get(String name, Document document) {
    Fieldable field = document.getFieldable( name );
    String stringValue = field.stringValue();
    if ( nullMarker.equals( stringValue ) ) {
      return null;
    }
    else {
      return fieldBridge.get( name, document );
View Full Code Here

    this.nullMarker = nullMarker;
  }

  public Object get(String name, Document document) {
    Fieldable field = document.getFieldable( name );
    String stringValue = field.stringValue();
    if ( nullMarker.equals( stringValue ) ) {
      return null;
    }
    else {
      return fieldBridge.get( name, document );
View Full Code Here

  private MemoryIndex createMemoryIndex(Document doc) {
    MemoryIndex index = new MemoryIndex();
    Iterator<Fieldable> iter = doc.getFields().iterator();
    while (iter.hasNext()) {
      Fieldable field = iter.next();
      index.addField(field.name(), field.stringValue(), analyzer);
    }
    return index;
  }
 
  private RAMDirectory createRAMIndex(Document doc) {
View Full Code Here

            //that number is the row number of the decorated
            //table model row that we are mapping to
            for (int t=0; t<hits.length; t++){
                Document document = searcher.doc(hits[t].doc);
                Fieldable field = document.getField(ROW_NUMBER);
                rowToModelIndex.add(Integer.valueOf(field.stringValue()));
            }
        } catch (Exception e){
            e.printStackTrace();
        }
    }
View Full Code Here

            //that number is the row number of the decorated
            //table model row that we are mapping to
            for (int t=0; t<hits.length; t++){
                Document document = searcher.doc(hits[t].doc);
                Fieldable field = document.getField(ROW_NUMBER);
                rowToModelIndex.add(Integer.valueOf(field.stringValue()));
            }
        } catch (Exception e){
            e.printStackTrace();
        }
    }
View Full Code Here

          final TokenStream tokenStream;
          // todo readerValue(), binaryValue()
          if (field.tokenStreamValue() != null) {
            tokenStream = field.tokenStreamValue();
          } else {
            tokenStream = analyzer.reusableTokenStream(field.name(), new StringReader(field.stringValue()));
          }

          // reset the TokenStream to the first token         
          tokenStream.reset();
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.