Package org.apache.solr.common

Examples of org.apache.solr.common.SolrInputField


  }

  private void compareDocs(SolrInputDocument docA, SolrInputDocument docB) {
    Assert.assertEquals(docA.getDocumentBoost(), docB.getDocumentBoost());
    for (String s : docA.getFieldNames()) {
      SolrInputField fldA = docA.getField(s);
      SolrInputField fldB = docB.getField(s);
      Assert.assertEquals(fldA.getValue(), fldB.getValue());
      Assert.assertEquals(fldA.getBoost(), fldB.getBoost());
    }
  }
View Full Code Here


    item.id = "aaa";
    item.categories = new String[] { "aaa", "bbb", "ccc" };
    SolrInputDocument out = binder.toSolrInputDocument( item );

    Assert.assertEquals( item.id, out.getFieldValue( "id" ) );
    SolrInputField catfield = out.getField( "cat" );
    Assert.assertEquals( 3, catfield.getValueCount() );
    Assert.assertEquals( "[aaa, bbb, ccc]", catfield.getValue().toString() );

    // Test the error on not settable stuff...
    NotGettableItem ng = new NotGettableItem();
    ng.setInStock( false );
    try {
View Full Code Here

    item.id = "aaa";
    item.categories = new String[] { "aaa", "bbb", "ccc" };
    SolrInputDocument out = binder.toSolrInputDocument( item );

    Assert.assertEquals( item.id, out.getFieldValue( "id" ) );
    SolrInputField catfield = out.getField( "cat" );
    Assert.assertEquals( 3, catfield.getValueCount() );
    Assert.assertEquals( "[aaa, bbb, ccc]", catfield.getValue().toString() );
 
    // Test the error on not settable stuff...
    NotGettableItem ng = new NotGettableItem();
    ng.setInStock( false );
    try {
View Full Code Here

           schema.getUniqueKeyField();
           Field storedId = doc.getField(sf.getName());
           indexedId = sf.getType().storedToIndexed(storedId);
         }
         if (solrDoc != null) {
           SolrInputField field = solrDoc.getField(sf.getName());
           if (field != null) {
             indexedId = sf.getType().toInternal( field.getFirstValue().toString() );
           }
         }
       }
     }
     return indexedId;
View Full Code Here

     if (doc != null) {
       return schema.printableUniqueKey(doc);
     }

     if (solrDoc != null) {
       SolrInputField field = solrDoc.getField(sf.getName());
       if (field != null) {
         return field.getFirstValue().toString();
       }
     }
     return "(null)";
   }
View Full Code Here

    for (String fieldName : doc.getFieldNames()) {
      if (!fieldName.contains(".")) {
        continue;
      }
      SolrInputField field = doc.getField(fieldName);
      String rawColumnName = fieldName.substring(fieldName.indexOf(".") + 1, fieldName.length());

      if (field.getValueCount() > 1) {
        for (Object fieldVal : field.getValues()) {
          record.addToColumns(new Column(rawColumnName, fieldVal.toString()));
        }
      } else {
        record.addToColumns(new Column(rawColumnName, field.getFirstValue().toString()));
      }
    }
    recordMutation.setRecord(record);
    return recordMutation;
  }
View Full Code Here

           schema.getUniqueKeyField();
           Field storedId = doc.getField(sf.getName());
           indexedId = sf.getType().storedToIndexed(storedId);
         }
         if (solrDoc != null) {
           SolrInputField field = solrDoc.getField(sf.getName());
           if (field != null) {
             indexedId = sf.getType().toInternal( field.getFirstValue().toString() );
           }
         }
       }
     }
     return indexedId;
View Full Code Here

     if (doc != null) {
       return schema.printableUniqueKey(doc);
     }

     if (solrDoc != null) {
       SolrInputField field = solrDoc.getField(sf.getName());
       if (field != null) {
         return field.getFirstValue().toString();
       }
     }
     return "(null)";
   }
View Full Code Here

        Signature sig = (Signature) req.getCore().getResourceLoader().newInstance(signatureClass);
        sig.init(params);

        for (String field : sigFields) {
          SolrInputField f = doc.getField(field);
          if (f != null) {
            sig.add(field);
            Object o = f.getValue();
            if (o instanceof String) {
              sig.add((String)o);
            } else if (o instanceof Collection) {
              for (Object oo : (Collection)o) {
                if (oo instanceof String) {
View Full Code Here

    nl.add("boost", doc.getDocumentBoost() == 1.0f ? null : doc.getDocumentBoost());
    l.add(nl);
    Iterator<SolrInputField> it = doc.iterator();
    while (it.hasNext()) {
      nl = new NamedList();
      SolrInputField field = it.next();
      nl.add("name", field.getName());
      nl.add("val", field.getValue());
      nl.add("boost", field.getBoost() == 1.0f ? null : field.getBoost());
      l.add(nl);
    }
    return l;
  }
View Full Code Here

TOP

Related Classes of org.apache.solr.common.SolrInputField

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.