本文整理汇总了Java中org.apache.lucene.document.IntPoint类的典型用法代码示例。如果您正苦于以下问题:Java IntPoint类的具体用法?Java IntPoint怎么用?Java IntPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntPoint类属于org.apache.lucene.document包,在下文中一共展示了IntPoint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testIntRangeQueryWithNoBounds
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
@Test
public void testIntRangeQueryWithNoBounds() {
JsonObject json = Json.createObjectBuilder()
.add("query", Json.createObjectBuilder()
.add("type", "RangeQuery")
.add("rangeType", "Int")
.add("field", "field")
.add("lowerTerm", JsonValue.NULL)
.add("upperTerm", JsonValue.NULL)
.add("includeLower", JsonValue.FALSE)
.add("includeUpper", JsonValue.TRUE))
.build();
QueryData q = new QueryData(new StringReader(json.toString()), queryConverter);
Query query = IntPoint.newRangeQuery("field", Integer.MIN_VALUE + 1, Integer.MAX_VALUE);
assertEquals(query, q.query);
}
开发者ID:seecr,项目名称:meresco-lucene,代码行数:17,代码来源:JsonQueryConverterTest.java
示例2: termsQuery
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
@Override
Query termsQuery(String field, List<Object> values) {
int[] v = new int[values.size()];
int upTo = 0;
for (int i = 0; i < values.size(); i++) {
Object value = values.get(i);
if (!hasDecimalPart(value)) {
v[upTo++] = parse(value, true);
}
}
if (upTo == 0) {
return Queries.newMatchNoDocsQuery("All values have a decimal part");
}
if (upTo != v.length) {
v = Arrays.copyOf(v, upTo);
}
return IntPoint.newSetQuery(field, v);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:NumberFieldMapper.java
示例3: stats
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
@Override
FieldStats.Long stats(IndexReader reader, String fieldName,
boolean isSearchable, boolean isAggregatable) throws IOException {
FieldInfo fi = org.apache.lucene.index.MultiFields.getMergedFieldInfos(reader).fieldInfo(fieldName);
if (fi == null) {
return null;
}
long size = PointValues.size(reader, fieldName);
if (size == 0) {
return new FieldStats.Long(reader.maxDoc(), 0, -1, -1, isSearchable, isAggregatable);
}
int docCount = PointValues.getDocCount(reader, fieldName);
byte[] min = PointValues.getMinPackedValue(reader, fieldName);
byte[] max = PointValues.getMaxPackedValue(reader, fieldName);
return new FieldStats.Long(reader.maxDoc(),docCount, -1L, size,
isSearchable, isAggregatable,
IntPoint.decodeDimension(min, 0), IntPoint.decodeDimension(max, 0));
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:NumberFieldMapper.java
示例4: addDocument
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
public static void addDocument(Lucene lucene, String identifier, Map<String, Integer> keys, Map<String, String> fields) throws Exception {
Document doc = new Document();
if (keys != null)
for (String keyField : keys.keySet())
doc.add(new NumericDocValuesField(keyField, keys.get(keyField)));
if (fields != null) {
for (String fieldname : fields.keySet())
if (fieldname.equals("intField"))
doc.add(new IntPoint(fieldname, Integer.parseInt(fields.get(fieldname))));
else {
doc.add(new StringField(fieldname, fields.get(fieldname), Store.NO));
doc.add(new SortedDocValuesField(fieldname, new BytesRef(fields.get(fieldname))));
doc.add(new FacetField("cat_" + fieldname, fields.get(fieldname)));
}
}
lucene.addDocument(identifier, doc);
lucene.maybeCommitAfterUpdate();
}
开发者ID:seecr,项目名称:meresco-lucene,代码行数:19,代码来源:LuceneTest.java
示例5: testIntRangeQuery
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
@Test
public void testIntRangeQuery() {
JsonObject json = Json.createObjectBuilder()
.add("query", Json.createObjectBuilder()
.add("type", "RangeQuery")
.add("rangeType", "Int")
.add("field", "field")
.add("lowerTerm", 1)
.add("upperTerm", 5)
.add("includeLower", JsonValue.FALSE)
.add("includeUpper", JsonValue.TRUE))
.build();
QueryData q = new QueryData(new StringReader(json.toString()), queryConverter);
Query query = IntPoint.newRangeQuery("field", 2, 5);
assertEquals(query, q.query);
}
开发者ID:seecr,项目名称:meresco-lucene,代码行数:17,代码来源:JsonQueryConverterTest.java
示例6: termQuery
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
@Override
Query termQuery(String field, Object value) {
if (hasDecimalPart(value)) {
return Queries.newMatchNoDocsQuery("Value [" + value + "] has a decimal part");
}
int v = parse(value, true);
return IntPoint.newExactQuery(field, v);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:NumberFieldMapper.java
示例7: rangeQuery
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
@Override
Query rangeQuery(String field, Object lowerTerm, Object upperTerm,
boolean includeLower, boolean includeUpper,
boolean hasDocValues) {
int l = Integer.MIN_VALUE;
int u = Integer.MAX_VALUE;
if (lowerTerm != null) {
l = parse(lowerTerm, true);
// if the lower bound is decimal:
// - if the bound is positive then we increment it:
// if lowerTerm=1.5 then the (inclusive) bound becomes 2
// - if the bound is negative then we leave it as is:
// if lowerTerm=-1.5 then the (inclusive) bound becomes -1 due to the call to longValue
boolean lowerTermHasDecimalPart = hasDecimalPart(lowerTerm);
if ((lowerTermHasDecimalPart == false && includeLower == false) ||
(lowerTermHasDecimalPart && signum(lowerTerm) > 0)) {
if (l == Integer.MAX_VALUE) {
return new MatchNoDocsQuery();
}
++l;
}
}
if (upperTerm != null) {
u = parse(upperTerm, true);
boolean upperTermHasDecimalPart = hasDecimalPart(upperTerm);
if ((upperTermHasDecimalPart == false && includeUpper == false) ||
(upperTermHasDecimalPart && signum(upperTerm) < 0)) {
if (u == Integer.MIN_VALUE) {
return new MatchNoDocsQuery();
}
--u;
}
}
Query query = IntPoint.newRangeQuery(field, l, u);
if (hasDocValues) {
Query dvQuery = SortedNumericDocValuesField.newRangeQuery(field, l, u);
query = new IndexOrDocValuesQuery(query, dvQuery);
}
return query;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:41,代码来源:NumberFieldMapper.java
示例8: createFields
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
@Override
public List<Field> createFields(String name, Number value,
boolean indexed, boolean docValued, boolean stored) {
List<Field> fields = new ArrayList<>();
if (indexed) {
fields.add(new IntPoint(name, value.intValue()));
}
if (docValued) {
fields.add(new SortedNumericDocValuesField(name, value.intValue()));
}
if (stored) {
fields.add(new StoredField(name, value.intValue()));
}
return fields;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:NumberFieldMapper.java
示例9: testQueryFiltering
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
public void testQueryFiltering() throws IOException {
testCase(IntPoint.newRangeQuery("number", 0, 5), iw -> {
iw.addDocument(Arrays.asList(new IntPoint("number", 7), new SortedNumericDocValuesField("number", 7)));
iw.addDocument(Arrays.asList(new IntPoint("number", 1), new SortedNumericDocValuesField("number", 1)));
}, max -> {
assertEquals(1, max.getValue(), 0);
});
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:MaxAggregatorTests.java
示例10: testQueryFiltersAll
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
public void testQueryFiltersAll() throws IOException {
testCase(IntPoint.newRangeQuery("number", -1, 0), iw -> {
iw.addDocument(Arrays.asList(new IntPoint("number", 7), new SortedNumericDocValuesField("number", 7)));
iw.addDocument(Arrays.asList(new IntPoint("number", 1), new SortedNumericDocValuesField("number", 1)));
}, max -> {
assertEquals(Double.NEGATIVE_INFINITY, max.getValue(), 0);
});
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:MaxAggregatorTests.java
示例11: testQueryFiltering
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
public void testQueryFiltering() throws IOException {
testCase(IntPoint.newRangeQuery("number", 0, 3), iw -> {
iw.addDocument(Arrays.asList(new IntPoint("number", 7), new SortedNumericDocValuesField("number", 7)));
iw.addDocument(Arrays.asList(new IntPoint("number", 1), new SortedNumericDocValuesField("number", 2)));
iw.addDocument(Arrays.asList(new IntPoint("number", 3), new SortedNumericDocValuesField("number", 3)));
}, avg -> {
assertEquals(2.5, avg.getValue(), 0);
});
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:AvgAggregatorTests.java
示例12: testQueryFiltersAll
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
public void testQueryFiltersAll() throws IOException {
testCase(IntPoint.newRangeQuery("number", -1, 0), iw -> {
iw.addDocument(Arrays.asList(new IntPoint("number", 7), new SortedNumericDocValuesField("number", 7)));
iw.addDocument(Arrays.asList(new IntPoint("number", 1), new SortedNumericDocValuesField("number", 2)));
iw.addDocument(Arrays.asList(new IntPoint("number", 3), new SortedNumericDocValuesField("number", 7)));
}, avg -> {
assertEquals(Double.NaN, avg.getValue(), 0);
});
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:AvgAggregatorTests.java
示例13: testQueryFiltering
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
public void testQueryFiltering() throws IOException {
testCase(IntPoint.newRangeQuery("level", 0, 5), ValueType.STRING, iw -> {
iw.addDocument(Arrays.asList(new IntPoint("level", 0), new SortedDocValuesField(FIELD_NAME, new BytesRef("foo"))));
iw.addDocument(Arrays.asList(new IntPoint("level", 1), new SortedDocValuesField(FIELD_NAME, new BytesRef("bar"))));
iw.addDocument(Arrays.asList(new IntPoint("level", 3), new SortedDocValuesField(FIELD_NAME, new BytesRef("foo"))));
iw.addDocument(Arrays.asList(new IntPoint("level", 5), new SortedDocValuesField(FIELD_NAME, new BytesRef("baz"))));
iw.addDocument(Arrays.asList(new IntPoint("level", 7), new SortedDocValuesField(FIELD_NAME, new BytesRef("baz"))));
}, count -> assertEquals(4L, count.getValue()));
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:ValueCountAggregatorTests.java
示例14: testToQueryNumericField
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
public void testToQueryNumericField() throws IOException {
assumeTrue("test runs only when at least a type is registered", getCurrentTypes().length > 0);
Query parsedQuery = rangeQuery(INT_FIELD_NAME).from(23).to(54).includeLower(true).includeUpper(false).toQuery(createShardContext());
// since age is automatically registered in data, we encode it as numeric
assertThat(parsedQuery, instanceOf(IndexOrDocValuesQuery.class));
parsedQuery = ((IndexOrDocValuesQuery) parsedQuery).getIndexQuery();
assertThat(parsedQuery, instanceOf(PointRangeQuery.class));
assertEquals(IntPoint.newRangeQuery(INT_FIELD_NAME, 23, 53), parsedQuery);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:RangeQueryBuilderTests.java
示例15: testIntegerTermsQueryWithDecimalPart
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
public void testIntegerTermsQueryWithDecimalPart() {
MappedFieldType ft = new NumberFieldMapper.NumberFieldType(NumberType.INTEGER);
ft.setName("field");
ft.setIndexOptions(IndexOptions.DOCS);
assertEquals(IntPoint.newSetQuery("field", 1), ft.termsQuery(Arrays.asList(1, 2.1), null));
assertEquals(IntPoint.newSetQuery("field", 1), ft.termsQuery(Arrays.asList(1.0, 2.1), null));
assertTrue(ft.termsQuery(Arrays.asList(1.1, 2.1), null) instanceof MatchNoDocsQuery);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:NumberFieldTypeTests.java
示例16: addPositionFilter
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
/**
* Filter variations by positions, using only variation's start index
* @param builder
*/
private void addPositionFilter(BooleanQuery.Builder builder) {
if (startIndex != null && endIndex != null) {
builder.add(IntPoint.newRangeQuery(FeatureIndexFields.START_INDEX.getFieldName(), startIndex, endIndex),
BooleanClause.Occur.MUST);
} else {
if (startIndex != null) {
builder.add(IntPoint.newRangeQuery(FeatureIndexFields.START_INDEX.getFieldName(), startIndex, Integer
.MAX_VALUE), BooleanClause.Occur.MUST);
} else if (endIndex != null) {
builder.add(IntPoint.newRangeQuery(FeatureIndexFields.START_INDEX.getFieldName(), Integer.MIN_VALUE,
endIndex), BooleanClause.Occur.MUST);
}
}
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:19,代码来源:VcfFilterForm.java
示例17: addAdditionalFilter
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
private void addAdditionalFilter(BooleanQuery.Builder builder,
Map.Entry<String, Object> entry) {
String key = entry.getKey().toLowerCase();
if (entry.getValue() instanceof List) {
addFiltersFromList(builder, entry, key);
} else if (entry.getValue() instanceof Integer || entry.getValue() instanceof Long) {
builder.add(IntPoint.newExactQuery(key, (Integer) entry.getValue()), BooleanClause.Occur.MUST);
} else if (entry.getValue() instanceof Float || entry.getValue() instanceof Double) {
builder.add(FloatPoint.newExactQuery(key, (Float) entry.getValue()), BooleanClause.Occur.MUST);
} else {
builder.add(new TermQuery(new Term(key, entry.getValue().toString().toLowerCase())),
BooleanClause.Occur.MUST);
}
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:15,代码来源:VcfFilterForm.java
示例18: tryAddIntegralKeyValueFilter
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
private void tryAddIntegralKeyValueFilter(BooleanQuery.Builder builder,
Map.Entry<String, Object> entry, String key, List list, Object val) {
if (val instanceof Integer || entry.getValue() instanceof Long) {
builder.add(IntPoint.newRangeQuery(key,
list.get(0) != null ? (Integer) list.get(0) : Integer.MIN_VALUE,
list.get(1) != null ? (Integer) list.get(1) : Integer.MAX_VALUE),
BooleanClause.Occur.MUST);
}
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:10,代码来源:VcfFilterForm.java
示例19: tryAddIntegeralFilter
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
private void tryAddIntegeralFilter(BooleanQuery.Builder builder, Map.Entry<String, Object> entry,
String key, Object val) {
if (val instanceof Integer || entry.getValue() instanceof Long) {
builder.add(IntPoint.newExactQuery(key, (Integer) entry.getValue()),
BooleanClause.Occur.MUST);
}
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:8,代码来源:VcfFilterForm.java
示例20: deleteEntry
import org.apache.lucene.document.IntPoint; //导入依赖的package包/类
@Nonnull
public ESuccess deleteEntry (@Nonnull final IParticipantIdentifier aParticipantID,
@Nonnull final PDDocumentMetaData aMetaData) throws IOException
{
ValueEnforcer.notNull (aParticipantID, "ParticipantID");
ValueEnforcer.notNull (aMetaData, "MetaData");
return m_aLucene.runAtomic ( () -> {
final ICommonsList <Document> aDocuments = new CommonsArrayList <> ();
// Get all documents to be marked as deleted
final IndexSearcher aSearcher = m_aLucene.getSearcher ();
if (aSearcher != null)
{
// Main searching
final Query aQuery = new TermQuery (PDField.PARTICIPANT_ID.getExactMatchTerm (aParticipantID));
_timedSearch ( () -> aSearcher.search (aQuery,
new AllDocumentsCollector (m_aLucene,
(aDoc, nDocID) -> aDocuments.add (aDoc))),
aQuery);
}
if (!aDocuments.isEmpty ())
{
// Mark document as deleted
aDocuments.forEach (aDocument -> aDocument.add (new IntPoint (CPDStorage.FIELD_DELETED, 1)));
// Update the documents
m_aLucene.updateDocuments (PDField.PARTICIPANT_ID.getExactMatchTerm (aParticipantID), aDocuments);
}
s_aLogger.info ("Marked " + aDocuments.size () + " Lucene documents as deleted");
AuditHelper.onAuditExecuteSuccess ("pd-indexer-delete",
aParticipantID.getURIEncoded (),
Integer.valueOf (aDocuments.size ()),
aMetaData);
});
}
开发者ID:phax,项目名称:peppol-directory,代码行数:39,代码来源:PDStorageManager.java
注:本文中的org.apache.lucene.document.IntPoint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论