org.apache.lucene.search.Query.weight()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(248)

本文整理了Java中org.apache.lucene.search.Query.weight方法的一些代码示例,展示了Query.weight的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.weight方法的具体详情如下:
包路径:org.apache.lucene.search.Query
类名称:Query
方法名:weight

Query.weight介绍

[英]Expert: Constructs and initializes a Weight for a top-level query.
[中]专家:为顶级查询构造并初始化权重。

代码示例

代码示例来源:origin: org.apache.lucene/lucene-core-jfrog

  1. /**
  2. * creates a weight for <code>query</code>
  3. * @return new weight
  4. */
  5. protected Weight createWeight(Query query) throws IOException {
  6. return query.weight(this);
  7. }

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

  1. /**
  2. * creates a weight for <code>query</code>
  3. * @return new weight
  4. */
  5. protected Weight createWeight(Query query) throws IOException {
  6. return query.weight(this);
  7. }

代码示例来源:origin: stackoverflow.com

  1. Hits(Searcher s, Query q, Filter f) throws IOException {
  2. this.weight = q.weight(s);
  3. this.searcher = s;
  4. this.filter = f;
  5. this.nDeletions = countDeletions(s);
  6. getMoreDocs(50);
  7. this.lengthAtStart = this.length;
  8. }

代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-core

  1. @Override
  2. public void createWeight(Map context, Searcher searcher) throws IOException {
  3. Weight w = q.weight(searcher);
  4. context.put(this, w);
  5. }
  6. }

代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-core

  1. public QueryDocValues(IndexReader reader, Query q, float defVal, Weight w) throws IOException {
  2. this.reader = reader;
  3. this.q = q;
  4. this.defVal = defVal;
  5. weight = w!=null ? w : q.weight(new IndexSearcher(reader));
  6. }

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

  1. public CustomWeight(Searcher searcher) throws IOException {
  2. this.similarity = getSimilarity(searcher);
  3. this.subQueryWeight = subQuery.weight(searcher);
  4. this.subQueryWeight = subQuery.weight(searcher);
  5. this.valSrcWeights = new Weight[valSrcQueries.length];
  6. for(int i = 0; i < valSrcQueries.length; i++) {
  7. this.valSrcWeights[i] = valSrcQueries[i].createWeight(searcher);
  8. }
  9. this.qStrict = strict;
  10. }

代码示例来源:origin: org.apache.lucene/lucene-core-jfrog

  1. public CustomWeight(Searcher searcher) throws IOException {
  2. this.similarity = getSimilarity(searcher);
  3. this.subQueryWeight = subQuery.weight(searcher);
  4. this.subQueryWeight = subQuery.weight(searcher);
  5. this.valSrcWeights = new Weight[valSrcQueries.length];
  6. for(int i = 0; i < valSrcQueries.length; i++) {
  7. this.valSrcWeights[i] = valSrcQueries[i].createWeight(searcher);
  8. }
  9. this.qStrict = strict;
  10. }

代码示例来源:origin: lucene/lucene

  1. public Explanation explain(Query query, int doc) throws IOException {
  2. return query.weight(this).explain(reader, doc);
  3. }

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

  1. Hits(Searcher s, Query q, Filter f, Sort o) throws IOException {
  2. weight = q.weight(s);
  3. searcher = s;
  4. filter = f;
  5. sort = o;
  6. nDeletions = countDeletions(s);
  7. getMoreDocs(50); // retrieve 100 initially
  8. lengthAtStart = length;
  9. }

代码示例来源:origin: org.apache.lucene/lucene-core-jfrog

  1. Hits(Searcher s, Query q, Filter f) throws IOException {
  2. weight = q.weight(s);
  3. searcher = s;
  4. filter = f;
  5. nDeletions = countDeletions(s);
  6. getMoreDocs(50); // retrieve 100 initially
  7. lengthAtStart = length;
  8. }

代码示例来源:origin: org.exoplatform.jcr/exo.jcr.component.core

  1. /**
  2. * @inheritDoc
  3. */
  4. @Override
  5. public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder, boolean topScorer) throws IOException
  6. {
  7. contextScorer = context.weight(searcher).scorer(reader, scoreDocsInOrder, topScorer);
  8. return new NotQueryScorer(reader);
  9. }

代码示例来源:origin: org.apache.lucene/lucene-core-jfrog

  1. Hits(Searcher s, Query q, Filter f, Sort o) throws IOException {
  2. weight = q.weight(s);
  3. searcher = s;
  4. filter = f;
  5. sort = o;
  6. nDeletions = countDeletions(s);
  7. getMoreDocs(50); // retrieve 100 initially
  8. lengthAtStart = length;
  9. }

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

  1. Hits(Searcher s, Query q, Filter f) throws IOException {
  2. weight = q.weight(s);
  3. searcher = s;
  4. filter = f;
  5. nDeletions = countDeletions(s);
  6. getMoreDocs(50); // retrieve 100 initially
  7. lengthAtStart = length;
  8. }

代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-core

  1. public BoostedWeight(Searcher searcher) throws IOException {
  2. this.searcher = searcher;
  3. this.qWeight = q.weight(searcher);
  4. this.context = boostVal.newContext();
  5. boostVal.createWeight(context,searcher);
  6. }

代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine

  1. public HippoLuceneQueryHits(IndexReader reader, Filter filter, IndexSearcher searcher, Query query) throws IOException {
  2. this.reader = reader;
  3. if (filter == null) {
  4. this.filter = null;
  5. } else {
  6. this.filter = filter.getDocIdSet(reader).iterator();
  7. }
  8. // We rely on Scorer#nextDoc() and Scorer#advance(int) so enable
  9. // scoreDocsInOrder
  10. this.scorer = query.weight(searcher).scorer(reader, true, false);
  11. }

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-core

  1. /**
  2. * Creates a scorer for this <code>ParentAxisQuery</code>.
  3. *
  4. * @param reader a reader for accessing the index.
  5. * @return a <code>ParentAxisScorer</code>.
  6. * @throws IOException if an error occurs while reading from the index.
  7. */
  8. public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder,
  9. boolean topScorer) throws IOException {
  10. contextScorer = contextQuery.weight(searcher).scorer(reader, scoreDocsInOrder, false);
  11. HierarchyResolver resolver = (HierarchyResolver) reader;
  12. return new ParentAxisScorer(searcher.getSimilarity(),
  13. reader, searcher, resolver);
  14. }

代码示例来源:origin: org.exoplatform.jcr/exo.jcr.component.core

  1. /**
  2. * Creates a scorer for this <code>ParentAxisQuery</code>.
  3. *
  4. * @param reader a reader for accessing the index.
  5. * @return a <code>ParentAxisScorer</code>.
  6. * @throws IOException if an error occurs while reading from the index.
  7. */
  8. @Override
  9. public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder, boolean topScorer) throws IOException
  10. {
  11. contextScorer = contextQuery.weight(searcher).scorer(reader, scoreDocsInOrder, topScorer);
  12. HierarchyResolver resolver = (HierarchyResolver)reader;
  13. return new ParentAxisScorer(searcher.getSimilarity(), reader, searcher, resolver);
  14. }

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-core

  1. /**
  2. * @inheritDoc
  3. */
  4. public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder,
  5. boolean topScorer) throws IOException {
  6. contextScorer = context.weight(searcher).scorer(reader, scoreDocsInOrder, topScorer);
  7. if (contextScorer == null) {
  8. // context query does not match any node
  9. // the inverse is to match all nodes
  10. return new MatchAllDocsQuery().createWeight(searcher).scorer(
  11. reader, scoreDocsInOrder, false);
  12. }
  13. return new NotQueryScorer(reader);
  14. }

代码示例来源:origin: apache/jackrabbit

  1. /**
  2. * @inheritDoc
  3. */
  4. public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder,
  5. boolean topScorer) throws IOException {
  6. contextScorer = context.weight(searcher).scorer(reader, scoreDocsInOrder, topScorer);
  7. if (contextScorer == null) {
  8. // context query does not match any node
  9. // the inverse is to match all nodes
  10. return new MatchAllDocsQuery().createWeight(searcher).scorer(
  11. reader, scoreDocsInOrder, false);
  12. }
  13. return new NotQueryScorer(reader);
  14. }

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-core

  1. /**
  2. * Creates a scorer for this <code>DerefQuery</code>.
  3. *
  4. * @param reader a reader for accessing the index.
  5. * @return a <code>DerefScorer</code>.
  6. * @throws IOException if an error occurs while reading from the index.
  7. */
  8. public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder,
  9. boolean topScorer) throws IOException {
  10. subQueryScorer = subQuery.weight(searcher).scorer(reader, scoreDocsInOrder, false);
  11. if (nameTest != null) {
  12. nameTestScorer = new NameQuery(nameTest, version, nsMappings).weight(searcher).scorer(reader, scoreDocsInOrder, false);
  13. }
  14. return new DerefScorer(searcher.getSimilarity(), reader);
  15. }

相关文章