本文整理了Java中org.apache.lucene.search.Query.weight
方法的一些代码示例,展示了Query.weight
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.weight
方法的具体详情如下:
包路径:org.apache.lucene.search.Query
类名称:Query
方法名:weight
[英]Expert: Constructs and initializes a Weight for a top-level query.
[中]专家:为顶级查询构造并初始化权重。
代码示例来源:origin: org.apache.lucene/lucene-core-jfrog
/**
* creates a weight for <code>query</code>
* @return new weight
*/
protected Weight createWeight(Query query) throws IOException {
return query.weight(this);
}
代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene
/**
* creates a weight for <code>query</code>
* @return new weight
*/
protected Weight createWeight(Query query) throws IOException {
return query.weight(this);
}
代码示例来源:origin: stackoverflow.com
Hits(Searcher s, Query q, Filter f) throws IOException {
this.weight = q.weight(s);
this.searcher = s;
this.filter = f;
this.nDeletions = countDeletions(s);
getMoreDocs(50);
this.lengthAtStart = this.length;
}
代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-core
@Override
public void createWeight(Map context, Searcher searcher) throws IOException {
Weight w = q.weight(searcher);
context.put(this, w);
}
}
代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-core
public QueryDocValues(IndexReader reader, Query q, float defVal, Weight w) throws IOException {
this.reader = reader;
this.q = q;
this.defVal = defVal;
weight = w!=null ? w : q.weight(new IndexSearcher(reader));
}
代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene
public CustomWeight(Searcher searcher) throws IOException {
this.similarity = getSimilarity(searcher);
this.subQueryWeight = subQuery.weight(searcher);
this.subQueryWeight = subQuery.weight(searcher);
this.valSrcWeights = new Weight[valSrcQueries.length];
for(int i = 0; i < valSrcQueries.length; i++) {
this.valSrcWeights[i] = valSrcQueries[i].createWeight(searcher);
}
this.qStrict = strict;
}
代码示例来源:origin: org.apache.lucene/lucene-core-jfrog
public CustomWeight(Searcher searcher) throws IOException {
this.similarity = getSimilarity(searcher);
this.subQueryWeight = subQuery.weight(searcher);
this.subQueryWeight = subQuery.weight(searcher);
this.valSrcWeights = new Weight[valSrcQueries.length];
for(int i = 0; i < valSrcQueries.length; i++) {
this.valSrcWeights[i] = valSrcQueries[i].createWeight(searcher);
}
this.qStrict = strict;
}
代码示例来源:origin: lucene/lucene
public Explanation explain(Query query, int doc) throws IOException {
return query.weight(this).explain(reader, doc);
}
代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene
Hits(Searcher s, Query q, Filter f, Sort o) throws IOException {
weight = q.weight(s);
searcher = s;
filter = f;
sort = o;
nDeletions = countDeletions(s);
getMoreDocs(50); // retrieve 100 initially
lengthAtStart = length;
}
代码示例来源:origin: org.apache.lucene/lucene-core-jfrog
Hits(Searcher s, Query q, Filter f) throws IOException {
weight = q.weight(s);
searcher = s;
filter = f;
nDeletions = countDeletions(s);
getMoreDocs(50); // retrieve 100 initially
lengthAtStart = length;
}
代码示例来源:origin: org.exoplatform.jcr/exo.jcr.component.core
/**
* @inheritDoc
*/
@Override
public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder, boolean topScorer) throws IOException
{
contextScorer = context.weight(searcher).scorer(reader, scoreDocsInOrder, topScorer);
return new NotQueryScorer(reader);
}
代码示例来源:origin: org.apache.lucene/lucene-core-jfrog
Hits(Searcher s, Query q, Filter f, Sort o) throws IOException {
weight = q.weight(s);
searcher = s;
filter = f;
sort = o;
nDeletions = countDeletions(s);
getMoreDocs(50); // retrieve 100 initially
lengthAtStart = length;
}
代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene
Hits(Searcher s, Query q, Filter f) throws IOException {
weight = q.weight(s);
searcher = s;
filter = f;
nDeletions = countDeletions(s);
getMoreDocs(50); // retrieve 100 initially
lengthAtStart = length;
}
代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-core
public BoostedWeight(Searcher searcher) throws IOException {
this.searcher = searcher;
this.qWeight = q.weight(searcher);
this.context = boostVal.newContext();
boostVal.createWeight(context,searcher);
}
代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine
public HippoLuceneQueryHits(IndexReader reader, Filter filter, IndexSearcher searcher, Query query) throws IOException {
this.reader = reader;
if (filter == null) {
this.filter = null;
} else {
this.filter = filter.getDocIdSet(reader).iterator();
}
// We rely on Scorer#nextDoc() and Scorer#advance(int) so enable
// scoreDocsInOrder
this.scorer = query.weight(searcher).scorer(reader, true, false);
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-core
/**
* Creates a scorer for this <code>ParentAxisQuery</code>.
*
* @param reader a reader for accessing the index.
* @return a <code>ParentAxisScorer</code>.
* @throws IOException if an error occurs while reading from the index.
*/
public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder,
boolean topScorer) throws IOException {
contextScorer = contextQuery.weight(searcher).scorer(reader, scoreDocsInOrder, false);
HierarchyResolver resolver = (HierarchyResolver) reader;
return new ParentAxisScorer(searcher.getSimilarity(),
reader, searcher, resolver);
}
代码示例来源:origin: org.exoplatform.jcr/exo.jcr.component.core
/**
* Creates a scorer for this <code>ParentAxisQuery</code>.
*
* @param reader a reader for accessing the index.
* @return a <code>ParentAxisScorer</code>.
* @throws IOException if an error occurs while reading from the index.
*/
@Override
public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder, boolean topScorer) throws IOException
{
contextScorer = contextQuery.weight(searcher).scorer(reader, scoreDocsInOrder, topScorer);
HierarchyResolver resolver = (HierarchyResolver)reader;
return new ParentAxisScorer(searcher.getSimilarity(), reader, searcher, resolver);
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-core
/**
* @inheritDoc
*/
public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder,
boolean topScorer) throws IOException {
contextScorer = context.weight(searcher).scorer(reader, scoreDocsInOrder, topScorer);
if (contextScorer == null) {
// context query does not match any node
// the inverse is to match all nodes
return new MatchAllDocsQuery().createWeight(searcher).scorer(
reader, scoreDocsInOrder, false);
}
return new NotQueryScorer(reader);
}
代码示例来源:origin: apache/jackrabbit
/**
* @inheritDoc
*/
public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder,
boolean topScorer) throws IOException {
contextScorer = context.weight(searcher).scorer(reader, scoreDocsInOrder, topScorer);
if (contextScorer == null) {
// context query does not match any node
// the inverse is to match all nodes
return new MatchAllDocsQuery().createWeight(searcher).scorer(
reader, scoreDocsInOrder, false);
}
return new NotQueryScorer(reader);
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-core
/**
* Creates a scorer for this <code>DerefQuery</code>.
*
* @param reader a reader for accessing the index.
* @return a <code>DerefScorer</code>.
* @throws IOException if an error occurs while reading from the index.
*/
public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder,
boolean topScorer) throws IOException {
subQueryScorer = subQuery.weight(searcher).scorer(reader, scoreDocsInOrder, false);
if (nameTest != null) {
nameTestScorer = new NameQuery(nameTest, version, nsMappings).weight(searcher).scorer(reader, scoreDocsInOrder, false);
}
return new DerefScorer(searcher.getSimilarity(), reader);
}
内容来源于网络,如有侵权,请联系作者删除!