当前位置: 首页>>代码示例>>Java>>正文


Java Store.NO属性代码示例

本文整理汇总了Java中org.apache.lucene.document.Field.Store.NO属性的典型用法代码示例。如果您正苦于以下问题:Java Store.NO属性的具体用法?Java Store.NO怎么用?Java Store.NO使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.lucene.document.Field.Store的用法示例。


在下文中一共展示了Store.NO属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: openReaderWithNewType

static DirectoryReader openReaderWithNewType(String type, IndexWriter writer) throws IOException {
    Document doc = new Document();
    StringField typeField = new StringField(TypeFieldMapper.NAME, type, Store.NO);
    doc.add(typeField);
    writer.addDocument(doc);
    return DirectoryReader.open(writer);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:TypeFieldTypeTests.java

示例2: prepareDocument

public Document prepareDocument(Delegator delegator) {
    Document doc;
    // make a new, empty document
    doc = new Document();
    String contentId = content.getString("contentId");
    doc.add(new StringField("contentId", contentId, Store.YES));
    // Add the last modified date of the file a field named "modified". Use a
    // Keyword field, so that it's searchable, but so that no attempt is
    // made to tokenize the field into words.
    Timestamp modDate = (Timestamp) content.get("lastModifiedDate");
    if (modDate == null) {
        modDate = (Timestamp) content.get("createdDate");
    }
    if (modDate != null) {
        doc.add(new StringField("modified", modDate.toString(), Store.YES));
    }
    String contentName = content.getString("contentName");
    if (UtilValidate.isNotEmpty(contentName))
        doc.add(new TextField("title", contentName, Store.YES));
    String description = content.getString("description");
    if (UtilValidate.isNotEmpty(description))
        doc.add(new TextField("description", description, Store.YES));
    List<String> ancestorList = new ArrayList<String>();
    ContentWorker.getContentAncestryAll(content.getDelegator(), contentId, "WEB_SITE_PUB_PT", "TO", ancestorList);
    String ancestorString = StringUtil.join(ancestorList, " ");
    if (UtilValidate.isNotEmpty(ancestorString)) {
        Field field = new StringField("site", ancestorString, Store.NO);
        doc.add(field);
    }
    boolean retVal = indexDataResource(doc);
    if (!retVal) {
        doc = null;
    }
    return doc;
}
 
开发者ID:jamesyong,项目名称:o3erp,代码行数:35,代码来源:ContentDocument.java

示例3: addFields

/** {@inheritDoc} */
@Override
public void addFields(Document document, DecoratedKey partitionKey) {
    Long value = (Long) partitionKey.getToken().getTokenValue();
    Field tokenField = new LongField(FIELD_NAME, value, Store.NO);
    document.add(tokenField);
}
 
开发者ID:Stratio,项目名称:stratio-cassandra,代码行数:7,代码来源:TokenMapperMurmur.java

示例4: isStored

/**
 * Returns true if the field is storeable.
 */
protected Store isStored() {
	return store ? Store.YES : Store.NO;
}
 
开发者ID:XMBomb,项目名称:InComb,代码行数:6,代码来源:AStoreableIndexFieldConf.java

示例5: get

public Field get(int n, FieldSelector fieldSelector) throws IOException
{
    return new Field(fieldName, getStringValue(n, fieldName), Store.NO, Index.UN_TOKENIZED);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:4,代码来源:ReferenceCountingReadOnlyIndexReaderFactory.java

示例6: testBigDocuments

@Nightly
public void testBigDocuments() throws IOException {
  // "big" as "much bigger than the chunk size"
  // for this test we force a FS dir
  // we can't just use newFSDirectory, because this test doesn't really index anything.
  // so if we get NRTCachingDir+SimpleText, we make massive stored fields and OOM (LUCENE-4484)
  Directory dir = new MockDirectoryWrapper(random(), new MMapDirectory(createTempDir("testBigDocuments")));
  IndexWriterConfig iwConf = newIndexWriterConfig(new MockAnalyzer(random()));
  iwConf.setMaxBufferedDocs(RandomInts.randomIntBetween(random(), 2, 30));
  RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwConf);

  if (dir instanceof MockDirectoryWrapper) {
    ((MockDirectoryWrapper) dir).setThrottling(Throttling.NEVER);
  }

  final Document emptyDoc = new Document(); // emptyDoc
  final Document bigDoc1 = new Document(); // lot of small fields
  final Document bigDoc2 = new Document(); // 1 very big field

  final Field idField = new StringField("id", "", Store.NO);
  emptyDoc.add(idField);
  bigDoc1.add(idField);
  bigDoc2.add(idField);

  final FieldType onlyStored = new FieldType(StringField.TYPE_STORED);
  onlyStored.setIndexed(false);

  final Field smallField = new Field("fld", randomByteArray(random().nextInt(10), 256), onlyStored);
  final int numFields = RandomInts.randomIntBetween(random(), 500000, 1000000);
  for (int i = 0; i < numFields; ++i) {
    bigDoc1.add(smallField);
  }

  final Field bigField = new Field("fld", randomByteArray(RandomInts.randomIntBetween(random(), 1000000, 5000000), 2), onlyStored);
  bigDoc2.add(bigField);

  final int numDocs = atLeast(5);
  final Document[] docs = new Document[numDocs];
  for (int i = 0; i < numDocs; ++i) {
    docs[i] = RandomPicks.randomFrom(random(), Arrays.asList(emptyDoc, bigDoc1, bigDoc2));
  }
  for (int i = 0; i < numDocs; ++i) {
    idField.setStringValue("" + i);
    iw.addDocument(docs[i]);
    if (random().nextInt(numDocs) == 0) {
      iw.commit();
    }
  }
  iw.commit();
  iw.forceMerge(1); // look at what happens when big docs are merged
  final DirectoryReader rd = DirectoryReader.open(dir);
  final IndexSearcher searcher = new IndexSearcher(rd);
  for (int i = 0; i < numDocs; ++i) {
    final Query query = new TermQuery(new Term("id", "" + i));
    final TopDocs topDocs = searcher.search(query, 1);
    assertEquals("" + i, 1, topDocs.totalHits);
    final Document doc = rd.document(topDocs.scoreDocs[0].doc);
    assertNotNull(doc);
    final IndexableField[] fieldValues = doc.getFields("fld");
    assertEquals(docs[i].getFields("fld").length, fieldValues.length);
    if (fieldValues.length > 0) {
      assertEquals(docs[i].getFields("fld")[0].binaryValue(), fieldValues[0].binaryValue());
    }
  }
  rd.close();
  iw.close();
  dir.close();
}
 
开发者ID:europeana,项目名称:search,代码行数:68,代码来源:BaseStoredFieldsFormatTestCase.java

示例7: getFieldStore

/**
 * @param field
 * @return
 */
public Store getFieldStore(SchemaField field)
{
    if (storeAll)
    {
        return Store.YES;
    }

    PropertyDefinition propertyDefinition = getPropertyDefinition(field.getName());
    if (propertyDefinition != null)
    {
        return propertyDefinition.isStoredInIndex() ? Store.YES : Store.NO;
    }

    NonDictionaryField nonDDField = nonDictionaryFields.get(field.getName());
    if (nonDDField != null)
    {
        return nonDDField.store;
    }

    for (String additionalContentFieldEnding : additionalContentFields.keySet())
    {
        if (field.getName().endsWith(additionalContentFieldEnding)
                && (getPropertyDefinition(field.getName().substring(0, (field.getName().length() - additionalContentFieldEnding.length()))) != null))
        {
            return additionalContentFields.get(additionalContentFieldEnding).store;
        }
    }

    for (String additionalTextFieldEnding : additionalTextFields.keySet())
    {
        if (field.getName().endsWith(additionalTextFieldEnding)
                && (getPropertyDefinition(field.getName().substring(0, (field.getName().length() - additionalTextFieldEnding.length()))) != null))
        {
            return additionalTextFields.get(additionalTextFieldEnding).store;
        }
    }

    for (String additionalMlTextFieldEnding : additionalMlTextFields.keySet())
    {
        if (field.getName().endsWith(additionalMlTextFieldEnding)
                && (getPropertyDefinition(field.getName().substring(0, (field.getName().length() - additionalMlTextFieldEnding.length()))) != null))
        {
            return additionalMlTextFields.get(additionalMlTextFieldEnding).store;
        }
    }

    return Store.NO;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:52,代码来源:AlfrescoSolrDataModel.java

示例8: testBigDocuments

@Nightly
public void testBigDocuments() throws IOException {
  // "big" as "much bigger than the chunk size"
  // for this test we force a FS dir
  iw.close();
  dir.close();
  dir = newFSDirectory(_TestUtil.getTempDir(getClass().getSimpleName()));
  iw = new RandomIndexWriter(random(), dir, iwConf);

  if (dir instanceof MockDirectoryWrapper) {
    ((MockDirectoryWrapper) dir).setThrottling(Throttling.NEVER);
  }

  final Document emptyDoc = new Document(); // emptyDoc
  final Document bigDoc1 = new Document(); // lot of small fields
  final Document bigDoc2 = new Document(); // 1 very big field

  final Field idField = new StringField("id", "", Store.NO);
  emptyDoc.add(idField);
  bigDoc1.add(idField);
  bigDoc2.add(idField);

  final FieldType onlyStored = new FieldType(StringField.TYPE_STORED);
  onlyStored.setIndexed(false);

  final Field smallField = new Field("fld", randomByteArray(random().nextInt(10), 256), onlyStored);
  final int numFields = RandomInts.randomIntBetween(random(), 500000, 1000000);
  for (int i = 0; i < numFields; ++i) {
    bigDoc1.add(smallField);
  }

  final Field bigField = new Field("fld", randomByteArray(RandomInts.randomIntBetween(random(), 1000000, 5000000), 2), onlyStored);
  bigDoc2.add(bigField);

  final int numDocs = atLeast(5);
  final Document[] docs = new Document[numDocs];
  for (int i = 0; i < numDocs; ++i) {
    docs[i] = RandomPicks.randomFrom(random(), Arrays.asList(emptyDoc, bigDoc1, bigDoc2));
  }
  for (int i = 0; i < numDocs; ++i) {
    idField.setStringValue("" + i);
    iw.addDocument(docs[i]);
    if (random().nextInt(numDocs) == 0) {
      iw.commit();
    }
  }
  iw.commit();
  iw.forceMerge(1); // look at what happens when big docs are merged
  final DirectoryReader rd = DirectoryReader.open(dir);
  final IndexSearcher searcher = new IndexSearcher(rd);
  for (int i = 0; i < numDocs; ++i) {
    final Query query = new TermQuery(new Term("id", "" + i));
    final TopDocs topDocs = searcher.search(query, 1);
    assertEquals("" + i, 1, topDocs.totalHits);
    final Document doc = rd.document(topDocs.scoreDocs[0].doc);
    assertNotNull(doc);
    final IndexableField[] fieldValues = doc.getFields("fld");
    assertEquals(docs[i].getFields("fld").length, fieldValues.length);
    if (fieldValues.length > 0) {
      assertEquals(docs[i].getFields("fld")[0].binaryValue(), fieldValues[0].binaryValue());
    }
  }
  rd.close();
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:64,代码来源:TestCompressingStoredFieldsFormat.java

示例9: newFieldsNoStore

private Field newFieldsNoStore(String name, String value) {
  return new StringField(name, value, Store.NO);
}
 
开发者ID:apache,项目名称:incubator-blur,代码行数:3,代码来源:BaseFieldManagerTest.java

示例10: addFields

/**
 * Adds to the specified Lucene {@link Document} the full row key formed by the specified partition key and the
 * clustering key.
 *
 * @param document      A Lucene {@link Document}.
 * @param partitionKey  A partition key.
 * @param clusteringKey A clustering key.
 */
public void addFields(Document document, DecoratedKey partitionKey, CellName clusteringKey) {
    ByteBuffer fullKey = byteBuffer(partitionKey, clusteringKey);
    Field field = new StringField(FIELD_NAME, ByteBufferUtils.toString(fullKey), Store.NO);
    document.add(field);
}
 
开发者ID:Stratio,项目名称:stratio-cassandra,代码行数:13,代码来源:FullKeyMapper.java


注:本文中的org.apache.lucene.document.Field.Store.NO属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。