當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。