Package org.apache.lucene.document

Examples of org.apache.lucene.document.EmbeddedSortField


          // extract sort field value and store it in term doc metadata obj
          for(String fieldName: sortFieldNames){
            Fieldable fieldable = doc.getFieldable(fieldName);
           
            if (fieldable instanceof EmbeddedSortField) {
              EmbeddedSortField sortField = (EmbeddedSortField) fieldable;

              int value = -1;
              if (sortField.stringValue() != null) {
                value = Integer.parseInt(sortField.stringValue());
              }
              int sortSlot = sortField.getSortSlot();

              sortValues.set(sortSlot - 1, new Integer(value));
            } else {
              // TODO: this logic is used for real time indexing.
              // hacky. depending on order of sort field names in array
View Full Code Here


              SchemaField sfield = schema.getFieldOrNull(fieldName);
             
              if (sfield.getType() instanceof EmbeddedIndexedIntField) {
                EmbeddedIndexedIntField eiif = (EmbeddedIndexedIntField)sfield.getType();
               
                EmbeddedSortField sf = new EmbeddedSortField(fieldName,
                                      tok.nextToken(),
                                      Field.Store.YES,
                                      Field.Index.NO,
                                      eiif.getFieldNumber());
                document.add(sf);
              } else {
                Field f = sfield.createField(tok.nextToken(), 1.0f);
                if (f != null) { // null fields are not added
                  document.add(f);
                }
              }
             
            } else {
              field = new Field(fieldName, tok.nextToken(), Store.YES, Index.ANALYZED);
              document.add(field);
            }
          }
        } else {
          // update logic
          if(schema != null){
            SchemaField sfield = schema.getFieldOrNull(fieldName);
           
            if (sfield.getType() instanceof EmbeddedIndexedIntField) {
              EmbeddedIndexedIntField eiif = (EmbeddedIndexedIntField)sfield.getType();
             
              EmbeddedSortField sf = new EmbeddedSortField(fieldName,
                                    fieldString,
                                    Field.Store.YES,
                                    Field.Index.NO,
                                    eiif.getFieldNumber());
              document.add(sf);
View Full Code Here

TOP

Related Classes of org.apache.lucene.document.EmbeddedSortField

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.