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


Java FieldMaskingSpanQuery类代码示例

本文整理汇总了Java中org.apache.lucene.search.spans.FieldMaskingSpanQuery的典型用法代码示例。如果您正苦于以下问题:Java FieldMaskingSpanQuery类的具体用法?Java FieldMaskingSpanQuery怎么用?Java FieldMaskingSpanQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: doAssertLuceneQuery

import org.apache.lucene.search.spans.FieldMaskingSpanQuery; //导入依赖的package包/类
@Override
protected void doAssertLuceneQuery(FieldMaskingSpanQueryBuilder queryBuilder, Query query, SearchContext context) throws IOException {
    String fieldInQuery = queryBuilder.fieldName();
    MappedFieldType fieldType = context.getQueryShardContext().fieldMapper(fieldInQuery);
    if (fieldType != null) {
        fieldInQuery = fieldType.name();
    }
    assertThat(query, instanceOf(FieldMaskingSpanQuery.class));
    FieldMaskingSpanQuery fieldMaskingSpanQuery = (FieldMaskingSpanQuery) query;
    assertThat(fieldMaskingSpanQuery.getField(), equalTo(fieldInQuery));
    assertThat(fieldMaskingSpanQuery.getMaskedQuery(), equalTo(queryBuilder.innerQuery().toQuery(context.getQueryShardContext())));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:FieldMaskingSpanQueryBuilderTests.java

示例2: searchForColoredFox

import org.apache.lucene.search.spans.FieldMaskingSpanQuery; //导入依赖的package包/类
private static void searchForColoredFox(IndexSearcher searcher) throws IOException {
    final SpanQuery anyColor = new SpanTermQuery(new Term(COLOR_FIELD, ANY_ANNOTATION_TERM));
    final SpanQuery colorAsText = new FieldMaskingSpanQuery(anyColor, TEXT_FIELD);
    final SpanQuery fox = new SpanTermQuery(new Term(TEXT_FIELD, "fox"));
    final SpanQuery coloredFox = new SpanNearQuery(new SpanQuery[] { colorAsText, fox }, 0, true);
    search(searcher, coloredFox);
}
 
开发者ID:shaie,项目名称:lucenelab,代码行数:8,代码来源:SimplePreAnnotatedTokenFilterExample.java

示例3: searchForRedAnimal

import org.apache.lucene.search.spans.FieldMaskingSpanQuery; //导入依赖的package包/类
private static void searchForRedAnimal(IndexSearcher searcher) throws IOException {
    final SpanQuery red = new SpanTermQuery(new Term(COLOR_FIELD, "red"));
    final SpanQuery redColorAsAnimal = new FieldMaskingSpanQuery(red, ANIMAL_FIELD);
    final SpanQuery anyAnimal = new SpanTermQuery(new Term(ANIMAL_FIELD, AnyAnnotationTokenFilter.ANY_ANNOTATION_TERM));
    final SpanQuery redAnimals = new SpanNearQuery(new SpanQuery[] { redColorAsAnimal, anyAnimal }, 0, true);
    search(searcher, redAnimals);
}
 
开发者ID:shaie,项目名称:lucenelab,代码行数:8,代码来源:AnnotatorAnyExample.java

示例4: searchForColoredFox

import org.apache.lucene.search.spans.FieldMaskingSpanQuery; //导入依赖的package包/类
private static void searchForColoredFox(IndexSearcher searcher) throws IOException {
    final SpanQuery anyColor = new MultiPositionSpanTermQuery(new Term(COLOR_FIELD, ANY_ANNOTATION_TERM));
    final SpanQuery colorAsText = new FieldMaskingSpanQuery(anyColor, TEXT_FIELD);
    final SpanQuery fox = new SpanTermQuery(new Term(TEXT_FIELD, "fox"));
    final SpanQuery coloredFox = new SpanNearQuery(new SpanQuery[] { colorAsText, fox }, 0, true);
    search(searcher, coloredFox);
}
 
开发者ID:shaie,项目名称:lucenelab,代码行数:8,代码来源:PreAnnotatedTokenFilterExample.java

示例5: searchForBrownFox

import org.apache.lucene.search.spans.FieldMaskingSpanQuery; //导入依赖的package包/类
private static void searchForBrownFox(IndexSearcher searcher) throws IOException {
    final SpanQuery brown = new SpanTermQuery(new Term(COLOR_FIELD, "brown"));
    final SpanQuery brownText = new FieldMaskingSpanQuery(brown, TEXT_FIELD);
    final SpanQuery fox = new SpanTermQuery(new Term(TEXT_FIELD, "fox"));
    search(searcher, new SpanNearQuery(new SpanQuery[] { brownText, fox }, 1, true));
}
 
开发者ID:shaie,项目名称:lucenelab,代码行数:7,代码来源:AnnotatorTeeSinkFilterExample.java

示例6: searchForBrownFox

import org.apache.lucene.search.spans.FieldMaskingSpanQuery; //导入依赖的package包/类
private static void searchForBrownFox(IndexSearcher searcher) throws IOException {
    final SpanQuery brown = new SpanTermQuery(new Term(COLOR_FIELD, "brown"));
    final SpanQuery brownText = new FieldMaskingSpanQuery(brown, TEXT_FIELD);
    final SpanQuery fox = new SpanTermQuery(new Term(TEXT_FIELD, "fox"));
    search(searcher, new SpanNearQuery(new SpanQuery[] { brownText, fox }, 0, true));
}
 
开发者ID:shaie,项目名称:lucenelab,代码行数:7,代码来源:AnnotatorTokenFilterExample.java


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