Advertisement
Guest User

Untitled

a guest
May 3rd, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. diff --git a/main/voyager-index/src/main/java/voyager/solr/DocumentBuilderEX.java b/main/voyager-index/src/main/java/voyager/solr/DocumentBuilderEX.java
  2. index 10fc9d0..943faa3 100644
  3. --- a/main/voyager-index/src/main/java/voyager/solr/DocumentBuilderEX.java
  4. +++ b/main/voyager-index/src/main/java/voyager/solr/DocumentBuilderEX.java
  5. @@ -20,6 +20,8 @@ package voyager.solr;
  6. import java.util.Arrays;
  7. import java.util.List;
  8.  
  9. +import com.spatial4j.core.shape.Shape;
  10. +import com.spatial4j.core.shape.ShapeCollection;
  11. import org.apache.lucene.document.Document;
  12. import org.apache.lucene.document.Field;
  13. import org.apache.lucene.index.IndexableField;
  14. @@ -115,9 +117,12 @@ public class DocumentBuilderEX {
  15.  
  16. // Make sure it has the correct number
  17. if( sfield!=null && !sfield.multiValued() && field.getValueCount() > 1 ) {
  18. - throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,
  19. - "ERROR: "+getID(doc, schema)+"multiple values encountered for non multiValued field " +
  20. + // shape collection is ok
  21. + if (!(field.getValue() instanceof Shape)) {
  22. + throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,
  23. + "ERROR: "+getID(doc, schema)+"multiple values encountered for non multiValued field " +
  24. sfield.getName() + ": " +field.getValue() );
  25. + }
  26. }
  27.  
  28. float fieldBoost = field.getBoost();
  29. @@ -136,7 +141,9 @@ public class DocumentBuilderEX {
  30. // load each field value
  31. boolean hasField = false;
  32. try {
  33. - for( Object v : field ) {
  34. + Iterable<Object> fieldValues =
  35. + field.getValue() instanceof ShapeCollection ? Arrays.asList(field.getValue()) : field;
  36. + for( Object v : fieldValues ) {
  37. if( v == null ) {
  38. continue;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement