There are 6 code examples for org.apache.lucene.document.Field.Store.

The API names are highlighted below. You can use suckoo button to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.

Project Name: hnlpengine-luceneanalyzer Package: analysis

Source Code: LemmaAnalyzerTest.java (Click to view .java file)

Method Code:
vote
like

@Before public void setUp() throws Exception {
  lemmaAnalyzer=new LemmaAnalyzer(new MockNaturalLanguageEngine());
  directory=new RAMDirectory();
  IndexWriter writer=new IndexWriter(directory,lemmaAnalyzer,true,new MaxFieldLength(500));
  Document doc=new Document();
  doc.add(new Field("content","The quick brown fox jumps over the lazy dogs",Store.NO,Index.ANALYZED));
  writer.addDocument(doc);
  writer.close();
  searcher=new IndexSearcher(directory);
}
 

Project Name: hnlpengine-luceneanalyzer Package: analysis

Source Code: SynonymAnalyzerTest.java (Click to view .java file)

Method Code:
vote
like

@Before public void setUp() throws Exception {
  synonymAnalyzer=new SynonymAnalyzer(new MockNaturalLanguageEngine());
  synonymAnalyzerQ=new SynonymAnalyzer(new MockNaturalLanguageEngine(),true);
  directory=new RAMDirectory();
  IndexWriter writer=new IndexWriter(directory,synonymAnalyzer,true,new MaxFieldLength(500));
  Document doc=new Document();
  doc.add(new Field("content","The quick brown fox jumps over the lazy dogs",Store.NO,Index.ANALYZED));
  writer.addDocument(doc);
  writer.close();
  searcher=new IndexSearcher(directory);
}
 

Project Name: hnlpengine-luceneanalyzer Package: analysis

Source Code: CoLocationAnalyzerTest.java (Click to view .java file)

Method Code:
vote
like

void addDoc(String contents,IndexWriter writer) throws CorruptIndexException, IOException {
  Document doc=new Document();
  doc.add(new Field("content",contents,Store.NO,Index.ANALYZED));
  writer.addDocument(doc);
}
 

Project Name: hnlpengine-luceneanalyzer Package: rha

Source Code: FeatureDocument.java (Click to view .java file)

Method Code:
vote
like

Document genFeatureDoc(){
  int limit=value.length() - N;
  StringBuffer nGrams=new StringBuffer();
  for (int i=0; i < limit; i++) {
    char ngram[]=new char[N];
    for (int j=0; j < N; j++) {
      ngram[j]=value.charAt(i + j);
    }
    increment(ngram);
    nGrams.append(' ').append(ngram);
    featureCounter++;
  }
  doc.add(new Field("NGRAM",nGrams.toString(),Store.YES,Index.ANALYZED));
  doc.add(new Field("TERM",value,Store.YES,Index.NO));
  return doc;
}
 

Project Name: rssowl.core Package: org.rssowl.core.internal.persist.search

Source Code: SearchDocument.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Creates a new <code>Field</code> from the given list of {@link IAttachment}.
 * @param fieldConstant the constant identifying the target field
 * @param attachments the value of the field
 * @param store one of the {@link Store} constants.
 * @param index one of the {@link Index} constants.
 * @return Field the {@link Field} that can be used for indexing.
 */
protected Field createAttachmentsField(int fieldConstant,List<IAttachment> attachments,Store store,Index index){
  if (attachments == null || attachments.size() == 0)   return null;
  StringBuilder attachmentValues=new StringBuilder();
  for (  IAttachment attachment : attachments) {
    if (attachment.getLink() != null)     attachmentValues.append(attachment.getLink()).append(" ");
    if (attachment.getType() != null)     attachmentValues.append(attachment.getType()).append(" ");
  }
  if (attachmentValues.length() > 0)   return createStringField(fieldConstant,attachmentValues.toString(),store,index);
  return null;
}
 

Project Name: rssowl.core Package: org.rssowl.core.internal.persist.search

Source Code: NewsDocument.java (Click to view .java file)

Method Code:
vote
like

/** 
 * @param indexDescription
 * @return boolean
 */
public boolean addFields(boolean indexDescription){
  INews news=getType();
  List<Field> fields=new ArrayList<Field>();
  addField(fields,createDocumentIDField());
  addField(fields,createHTMLField(INews.TITLE,news.getTitle()));
  if (indexDescription)   addField(fields,createHTMLField(INews.DESCRIPTION,news.getDescription()));
  addField(fields,createURIField(INews.LINK,news.getLinkAsText(),Store.NO,Index.UN_TOKENIZED));
  addField(fields,createURIField(INews.FEED,news.getFeedLinkAsText(),Store.NO,Index.UN_TOKENIZED));
  addField(fields,createDateField(INews.RECEIVE_DATE,news.getReceiveDate(),Store.NO));
  addField(fields,createDateField(INews.PUBLISH_DATE,news.getPublishDate(),Store.NO));
  addField(fields,createDateField(INews.MODIFIED_DATE,news.getModifiedDate(),Store.NO));
  addField(fields,createDateField(INews.AGE_IN_DAYS,DateUtils.getRecentDate(news),Store.NO));
  addField(fields,createDateField(INews.AGE_IN_MINUTES,DateUtils.getRecentDate(news),Store.NO,Resolution.MINUTE));
  addField(fields,createEnumField(INews.STATE,news.getState(),Store.YES));
  addField(fields,createBooleanField(INews.IS_FLAGGED,news.isFlagged(),Store.NO));
  addField(fields,createLongField(INews.RATING,news.getRating(),Store.NO));
  addField(fields,createLongField(INews.PARENT_ID,news.getParentId(),Store.NO));
  Set<ILabel> labels=news.getLabels();
  for (  ILabel label : labels) {
    if (label != null)     addField(fields,createStringField(INews.LABEL,label.getName().toLowerCase(),Store.NO,Index.UN_TOKENIZED));
  }
  if (news.getGuid() != null) {
    String value=news.getGuid().getValue();
    if (value != null)     addField(fields,createStringField(INews.GUID,value.toLowerCase(),Store.NO,Index.UN_TOKENIZED));
  }
  if (news.getSource() != null) {
    if (news.getSource().getLink() != null)     addField(fields,createURIField(INews.SOURCE,news.getSource().getLink().toString(),Store.NO,Index.UN_TOKENIZED));
 else     if (news.getSource().getName() != null)     addField(fields,createStringField(INews.SOURCE,news.getSource().getName(),Store.NO,Index.TOKENIZED));
  }
  addField(fields,createPersonField(INews.AUTHOR,news.getAuthor(),Store.NO,Index.TOKENIZED));
  addField(fields,createCategoriesField(INews.CATEGORIES,news.getCategories(),Store.NO,Index.TOKENIZED));
  List<IAttachment> attachments=news.getAttachments();
  addField(fields,createBooleanField(INews.HAS_ATTACHMENTS,!attachments.isEmpty(),Store.NO));
  addField(fields,createAttachmentsField(INews.ATTACHMENTS_CONTENT,attachments,Store.NO,Index.TOKENIZED));
  return addFieldsToDocument(fields);
}