Package org.apache.lucene.document

Examples of org.apache.lucene.document.Field


    return null;
  }

  private Document createDocument(String suggestTerm) {
    Document doc = new Document();
    doc.add(new Field("t", suggestTerm, Field.Store.YES,
        Field.Index.UN_TOKENIZED));
    return doc;
  }
View Full Code Here


          storedVals.add(val);
          }
          doc.removeField(facetHandler.getName());
         
          for (String val : storedVals){
            doc.add(new Field(facetHandler.getName(),
                      val,
                      Field.Store.NO,
                      Field.Index.NOT_ANALYZED));
          }
        }
View Full Code Here

    assertNotNull(txt);
  }

  public void testRemoveIndexTypeLead() throws Exception{
    Document doc1 = new Document();
    doc1.add(new Field(DocumentCreator.FIELD_BOOKMARK_ID,"100",Field.Store.YES,Field.Index.UN_TOKENIZED));
    doc1.add(new Field(DocumentCreator.FIELD_INDEX_TYPE,DocumentCreator.INDEX_TYPE_LEAD,Field.Store.NO,Field.Index.UN_TOKENIZED));
    doc1.add(new Field(DocumentCreator.FIELD_INDEX_TYPE,"other-type",Field.Store.NO,Field.Index.UN_TOKENIZED));
    doc1 = DocumentCreator.removeIndexTypeLead(doc1);
    Field[] fields = doc1.getFields(DocumentCreator.FIELD_INDEX_TYPE);
    assertEquals(1,fields.length);
    assertEquals("other-type",fields[0].stringValue());
    fields = doc1.getFields(DocumentCreator.FIELD_BOOKMARK_ID);
View Full Code Here

    assertEquals(1,fields.length)
  }
 
  public void testAddIndexTypeLead() throws Exception {
    Document doc1 = new Document();
    doc1.add(new Field(DocumentCreator.FIELD_BOOKMARK_ID,"100",Field.Store.YES,Field.Index.UN_TOKENIZED));
    doc1 = DocumentCreator.addIndexTypeLead(doc1);
    Field[] fields = doc1.getFields(DocumentCreator.FIELD_INDEX_TYPE);
    assertEquals(1,fields.length);
    assertEquals(DocumentCreator.INDEX_TYPE_LEAD,fields[0].stringValue())
  }
View Full Code Here

   */
  public static Document addIndexTypeLead(Document doc) {
    if (doc == null) {
      throw new NullPointerException("input Document object is NULL");
    }
    doc.add(new Field(FIELD_INDEX_TYPE, INDEX_TYPE_LEAD, Field.Store.YES,
        Field.Index.UN_TOKENIZED));
    return doc;
  }
View Full Code Here

    }
    return doc;
  }
 
  public static Field createFieldBookmarkId(int id){
    return new Field(FIELD_BOOKMARK_ID, String.valueOf(id),
        Field.Store.YES, Field.Index.TOKENIZED);
  }
View Full Code Here

 
  public static Field createFieldTitle(String title){
    if(title == null){
      throw new NullPointerException("title is NULL");
    }
    return new Field(FIELD_TITLE, title, Field.Store.YES,Field.Index.NO)
  }
View Full Code Here

  public static Field createFieldText(String text){
    if(text == null){
      throw new NullPointerException("text is NULL");
    }
    return new Field(FIELD_TEXT, text, Field.Store.NO, Field.Index.TOKENIZED);
  }
View Full Code Here

 
  public static Field createFieldUser(String username){
    if(username == null){
      throw new NullPointerException("username is NULL");
    }
    return new Field(FIELD_USER,username,Field.Store.YES, Field.Index.TOKENIZED);
  }
View Full Code Here

 
  public static Field createFieldUrl(String url){
    if(url == null){
      throw new NullPointerException("url is NULL");
    }
    return new Field(FIELD_URL, url, Field.Store.YES, Field.Index.NO);
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.document.Field

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.