Package org.apache.lucene.index

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


                Genre genre = Genre.get(doc.get(QueryBuilder.T));
                Definitions tags = null;
                IndexableField tagsField = doc.getField(QueryBuilder.TAGS);
                if (tagsField != null) {
                    tags = Definitions.deserialize(tagsField.binaryValue().bytes);
                }
                int nhits = docs.size();

                if (sourceContext != null) {
                    try {
View Full Code Here


  @Override
  public Object get(String name, Document document) {
    IndexableField field = document.getField( name );
      String stringValue;
      if ( field.binaryValue() != null ) {
        try {
          stringValue = CompressionTools.decompressString( field.binaryValue() );
        }
      catch (DataFormatException e) {
          throw new SearchException( "Field " + name + " looks like binary but couldn't be decompressed" );
View Full Code Here

  public Object get(String name, Document document) {
    IndexableField field = document.getField( name );
      String stringValue;
      if ( field.binaryValue() != null ) {
        try {
          stringValue = CompressionTools.decompressString( field.binaryValue() );
        }
      catch (DataFormatException e) {
          throw new SearchException( "Field " + name + " looks like binary but couldn't be decompressed" );
        }
      }
View Full Code Here

        BytesRef tempTerm = null;
        Set<BytesRef> tempContexts = new HashSet<>();

        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());
        }

        if (hasContexts) {
          final IndexableField[] contextFields = doc.getFields(contextsField);
          for (IndexableField contextField : contextFields) {
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());
        }

        if (hasContexts) {
          final IndexableField[] contextFields = doc.getFields(contextsField);
          for (IndexableField contextField : contextFields) {
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;
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;
        currentContexts = tempContexts;
        currentWeight = getWeight(doc, currentDocId);
View Full Code Here

                .startObject("path1").field("field1", "value1").endObject()
                .startObject("path2").field("field2", "value2").endObject()
                .endObject().bytes());

        IndexableField sourceField = doc.rootDoc().getField("_source");
        Map<String, Object> sourceAsMap = XContentFactory.xContent(XContentType.JSON).createParser(new BytesArray(sourceField.binaryValue())).mapAndClose();
        assertThat(sourceAsMap.containsKey("path1"), equalTo(true));
        assertThat(sourceAsMap.containsKey("path2"), equalTo(false));
    }

    @Test
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.