Examples of StringField


Examples of org.apache.lucene.document.StringField

    stopword = "" + randomChar();
    CharacterRunAutomaton stopset = new CharacterRunAutomaton(BasicAutomata.makeString(stopword));
    analyzer = new MockAnalyzer(random, MockTokenizer.WHITESPACE, false, stopset);
    RandomIndexWriter iw = new RandomIndexWriter(random, directory, analyzer);
    Document doc = new Document();
    Field id = new StringField("id", "", Field.Store.NO);
    Field field = new TextField("field", "", Field.Store.NO);
    doc.add(id);
    doc.add(field);
   
    // index some docs
    int numDocs = atLeast(1000);
    for (int i = 0; i < numDocs; i++) {
      id.setStringValue(Integer.toString(i));
      field.setStringValue(randomFieldContents());
      iw.addDocument(doc);
    }
   
    // delete some docs
View Full Code Here

Examples of org.apache.lucene.document.StringField

    facetHandlers = new LinkedList<FacetHandler<?>>();
  }

  private void addMetaDataField(Document doc, String name, String[] vals) {
    for (String val : vals) {
      Field field = new StringField(name, val, Store.NO);
      doc.add(field);
    }
  }
View Full Code Here

Examples of org.apache.lucene.document.StringField

    facetHandlers = new LinkedList<FacetHandler<?>>();
  }

  private void addMetaDataField(Document doc, String name, String[] vals) {
    for (String val : vals) {
      Field field = new StringField(name, val, Store.NO);
      doc.add(field);
    }
  }
View Full Code Here

Examples of org.apache.lucene.document.StringField

    String text = "text";
    String color = "color";

    Document doc1 = new Document();
    doc1.add(new TextField(text, "Foo1", Store.YES));
    doc1.add(new StringField(color, RED, Store.YES));
    m_indexWriter.addDocument(doc1);
    m_indexWriter.commit();

    Document doc2 = new Document();
    doc2.add(new TextField(text, "Foo2", Store.YES));
    doc2.add(new StringField(color, RED, Store.YES));
    m_indexWriter.addDocument(doc2);
    m_indexWriter.commit();

    Document doc3 = new Document();
    doc3.add(new TextField(text, "Foo3", Store.YES));
    doc3.add(new StringField(color, BLUE, Store.YES));
    m_indexWriter.addDocument(doc3);
    m_indexWriter.commit();

    SimpleFacetHandler colorHandler = new SimpleFacetHandler(color);
View Full Code Here

Examples of org.apache.lucene.document.StringField

      else if (i % 2 == 0) make = "rav4";
      else make = "prius";

      String ID = Integer.toString(i);
      Document d = new Document();
      d.add(new StringField("id", ID, Field.Store.YES));
      d.add(new StringField("color", color, Field.Store.YES));
      d.add(new StringField("make", make, Field.Store.YES));
      dataList.add(d);
    }
    return dataList.toArray(new Document[dataList.size()]);
  }
View Full Code Here

Examples of org.apache.lucene.document.StringField

  public Document[] createDataTwo() {
    ArrayList<Document> dataList = new ArrayList<Document>();
    String color = "red";
    String ID = Integer.toString(10);
    Document d = new Document();
    d.add(new StringField("id", ID, Field.Store.YES));
    d.add(new StringField("color", color, Field.Store.YES));
    d.add(new IntField("NUM", 10, Field.Store.YES));
    dataList.add(d);

    color = "green";
    ID = Integer.toString(11);
    d = new Document();
    d.add(new StringField("id", ID, Field.Store.YES));
    d.add(new StringField("color", color, Field.Store.YES));
    d.add(new IntField("NUM", 11, Field.Store.YES));
    dataList.add(d);

    return dataList.toArray(new Document[dataList.size()]);
  }
View Full Code Here

Examples of org.apache.lucene.document.StringField

    ArrayList<Document> dataList = new ArrayList<Document>();
    for (int i = 0; i < _documentSize; i++) {
      String color = (i % 2 == 0) ? "red" : "green";
      String ID = Integer.toString(i);
      Document d = new Document();
      d.add(new StringField("id", ID, Field.Store.YES));
      d.add(new StringField("color", color, Field.Store.YES));
      dataList.add(d);
    }

    return dataList.toArray(new Document[dataList.size()]);
  }
View Full Code Here

Examples of org.apache.lucene.document.StringField

  private BoboBrowser newBrowser() throws IOException {
    return new BoboBrowser(newIndexReader());
  }

  public static Field buildMetaField(String name, String val) {
    Field f = new StringField(name, val, Field.Store.NO);
    return f;
  }
View Full Code Here

Examples of org.apache.lucene.document.StringField

    d1.add(buildMetaField("custom", "000003"));
    d1.add(buildMetaField("latitude", "60"));
    d1.add(buildMetaField("longitude", "120"));
    d1.add(buildMetaField("salary", "04500"));

    Field sf = new StringField("testStored", "stored", Store.YES);
    d1.add(sf);

    FieldType ft = new FieldType();
    ft.setStored(false);
    ft.setIndexed(true);
View Full Code Here

Examples of org.apache.lucene.document.StringField

    }
   
    FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
    ft.setOmitNorms(true);
    parentStreamField = new Field(Consts.FIELD_PAYLOADS, parentStream, ft);
    fullPathField = new StringField(Consts.FULL, "", Field.Store.YES);

    nextID = indexWriter.maxDoc();

    if (cache == null) {
      cache = defaultTaxonomyWriterCache();
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.