Package org.leskes.elasticfacets.fields

Examples of org.leskes.elasticfacets.fields.HashedStringFieldType


    indexWriter.addDocument(DocumentBuilder.doc()
        .add(DocumentBuilder.field("svalue", "aaa")).build());

    IndexReader reader = IndexReader.open(indexWriter, true);

      HashedStringFieldType type = new HashedStringFieldType(new HashedStringFieldData.HashedStringTypeLoader(0,0, null, null));
    SingleValueHashedStringFieldData sFieldData = (SingleValueHashedStringFieldData) type.load(reader, "svalue");

    assert (sFieldData.fieldName().equals("svalue"));
    assert (!sFieldData.multiValued());
    assertThat(sFieldData.collisions(),equalTo(0));
View Full Code Here


          .add(DocumentBuilder.field("svalue",
              String.format("term_%s", i))).build());

    IndexReader reader = IndexReader.open(indexWriter, true);

      HashedStringFieldType type = new HashedStringFieldType(new HashedStringFieldData.HashedStringTypeLoader(0,0, null, null));

      SingleValueHashedStringFieldData sFieldData = (SingleValueHashedStringFieldData) type.load(reader, "svalue");

    assertThat(sFieldData.fieldName(), equalTo("svalue"));
    assertThat(sFieldData.multiValued(), equalTo(false));
    assertThat(sFieldData.collisions(),equalTo(0));
View Full Code Here

    indexWriter.addDocument(DocumentBuilder.doc()
        .add(DocumentBuilder.field("mvalue", "aaa")).build());

    IndexReader reader = IndexReader.open(indexWriter, true);

      HashedStringFieldType type = new HashedStringFieldType(new HashedStringFieldData.HashedStringTypeLoader(0,0, null, null));
      MultiValueHashedStringFieldData sFieldData = (MultiValueHashedStringFieldData) type.load(reader, "mvalue");

    assert (sFieldData.fieldName().equals("mvalue"));
    assert (sFieldData.multiValued());
    assertThat(sFieldData.collisions(),equalTo(0));
View Full Code Here

      TIntHashSet excludeTerms = new TIntHashSet();
      excludeTerms.add(HashedStringFieldType.hashCode("xxx"));

      Pattern excludePattern = Pattern.compile("\\d{3}|a"); // the a is to test full token matching

      HashedStringFieldType type = new HashedStringFieldType(
              new HashedStringFieldData.HashedStringTypeLoader(0,0, excludePattern,excludeTerms));

      // we exclude the only multi value, expect a single value array
      SingleValueHashedStringFieldData sFieldData = (SingleValueHashedStringFieldData) type.load(reader, "mvalue");

      assert (sFieldData.fieldName().equals("mvalue"));
      assert (!sFieldData.multiValued());
      assertThat(sFieldData.collisions(),equalTo(0));
View Full Code Here

        .add(DocumentBuilder.field("mvalue", "Aa")).build());

   
    IndexReader reader = IndexReader.open(indexWriter, true);

      HashedStringFieldType type = new HashedStringFieldType(new HashedStringFieldData.HashedStringTypeLoader(0,0, null, null));

      MultiValueHashedStringFieldData sFieldData = (MultiValueHashedStringFieldData) type.load(reader, "mvalue");
   
    assertThat(sFieldData.collisions(),equalTo(2));
    indexWriter.close();

  }
View Full Code Here

              .add(DocumentBuilder.field("mvalue", "t2")).build());


      IndexReader reader = IndexReader.open(indexWriter, true);

      HashedStringFieldType type = new HashedStringFieldType(new HashedStringFieldData.HashedStringTypeLoader(199,0, null, null));

      MultiValueHashedStringFieldData sFieldData = (MultiValueHashedStringFieldData)type.load(reader, "mvalue");

      assertThat(sFieldData.hasValue(0),equalTo(false));
      assertThat(sFieldData.hasValue(1),equalTo(true));
      indexWriter.close();
View Full Code Here


      IndexReader reader = IndexReader.open(indexWriter, true);


      HashedStringFieldType type = new HashedStringFieldType(new HashedStringFieldData.HashedStringTypeLoader(0,2, null, null));

      SingleValueHashedStringFieldData sFieldData = (SingleValueHashedStringFieldData) type.load(reader, "mvalue");

      assertThat(sFieldData.hasValue(0),equalTo(true));
      final int[] count = {0};
      sFieldData.forEachValueInDoc(0, new HashedStringFieldData.HashedStringValueInDocProc() {
         @Override
View Full Code Here

TOP

Related Classes of org.leskes.elasticfacets.fields.HashedStringFieldType

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.