本文整理了Java中org.apache.lucene.search.BooleanQuery.getBoost()
方法的一些代码示例,展示了BooleanQuery.getBoost()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BooleanQuery.getBoost()
方法的具体详情如下:
包路径:org.apache.lucene.search.BooleanQuery
类名称:BooleanQuery
方法名:getBoost
暂无
代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene
public float getValue() { return getBoost(); }
代码示例来源:origin: lucene/lucene
public float getValue() { return getBoost(); }
代码示例来源:origin: org.apache.lucene/lucene-core-jfrog
public float getValue() { return getBoost(); }
代码示例来源:origin: lucene/lucene
/** Returns true iff <code>o</code> is equal to this. */
public boolean equals(Object o) {
if (!(o instanceof BooleanQuery))
return false;
BooleanQuery other = (BooleanQuery)o;
return (this.getBoost() == other.getBoost())
&& this.clauses.equals(other.clauses);
}
代码示例来源:origin: lucene/lucene
public float sumOfSquaredWeights() throws IOException {
float sum = 0.0f;
for (int i = 0 ; i < weights.size(); i++) {
BooleanClause c = (BooleanClause)clauses.elementAt(i);
Weight w = (Weight)weights.elementAt(i);
if (!c.prohibited)
sum += w.sumOfSquaredWeights(); // sum sub weights
}
sum *= getBoost() * getBoost(); // boost each sub-weight
return sum ;
}
代码示例来源:origin: org.apache.lucene/lucene-core-jfrog
public void normalize(float norm) {
norm *= getBoost(); // incorporate boost
for (int i = 0 ; i < weights.size(); i++) {
Weight w = (Weight)weights.get(i);
// normalize all clauses, (even if prohibited in case of side affects)
w.normalize(norm);
}
}
代码示例来源:origin: org.apache.lucene/lucene-core-jfrog
/** Returns a hash code value for this object.*/
public int hashCode() {
return Float.floatToIntBits(getBoost()) ^ clauses.hashCode()
+ getMinimumNumberShouldMatch();
}
代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene
/** Returns a hash code value for this object.*/
public int hashCode() {
return Float.floatToIntBits(getBoost()) ^ clauses.hashCode()
+ getMinimumNumberShouldMatch();
}
代码示例来源:origin: lucene/lucene
public void normalize(float norm) {
norm *= getBoost(); // incorporate boost
for (int i = 0 ; i < weights.size(); i++) {
BooleanClause c = (BooleanClause)clauses.elementAt(i);
Weight w = (Weight)weights.elementAt(i);
if (!c.prohibited)
w.normalize(norm);
}
}
代码示例来源:origin: lucene/lucene
/** Returns a hash code value for this object.*/
public int hashCode() {
return Float.floatToIntBits(getBoost()) ^ clauses.hashCode();
}
代码示例来源:origin: org.apache.lucene/lucene-core-jfrog
public float sumOfSquaredWeights() throws IOException {
float sum = 0.0f;
for (int i = 0 ; i < weights.size(); i++) {
BooleanClause c = (BooleanClause)clauses.get(i);
Weight w = (Weight)weights.get(i);
// call sumOfSquaredWeights for all clauses in case of side effects
float s = w.sumOfSquaredWeights(); // sum sub weights
if (!c.isProhibited())
// only add to sum for non-prohibited clauses
sum += s;
}
sum *= getBoost() * getBoost(); // boost each sub-weight
return sum ;
}
代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene
public void normalize(float norm) {
norm *= getBoost(); // incorporate boost
for (int i = 0 ; i < weights.size(); i++) {
Weight w = (Weight)weights.get(i);
// normalize all clauses, (even if prohibited in case of side affects)
w.normalize(norm);
}
}
代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene
/** Returns true iff <code>o</code> is equal to this. */
public boolean equals(Object o) {
if (!(o instanceof BooleanQuery))
return false;
BooleanQuery other = (BooleanQuery)o;
return (this.getBoost() == other.getBoost())
&& this.clauses.equals(other.clauses)
&& this.getMinimumNumberShouldMatch() == other.getMinimumNumberShouldMatch();
}
代码示例来源:origin: org.apache.lucene/lucene-core-jfrog
/** Returns true iff <code>o</code> is equal to this. */
public boolean equals(Object o) {
if (!(o instanceof BooleanQuery))
return false;
BooleanQuery other = (BooleanQuery)o;
return (this.getBoost() == other.getBoost())
&& this.clauses.equals(other.clauses)
&& this.getMinimumNumberShouldMatch() == other.getMinimumNumberShouldMatch();
}
代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene
public float sumOfSquaredWeights() throws IOException {
float sum = 0.0f;
for (int i = 0 ; i < weights.size(); i++) {
BooleanClause c = (BooleanClause)clauses.get(i);
Weight w = (Weight)weights.get(i);
// call sumOfSquaredWeights for all clauses in case of side effects
float s = w.sumOfSquaredWeights(); // sum sub weights
if (!c.isProhibited())
// only add to sum for non-prohibited clauses
sum += s;
}
sum *= getBoost() * getBoost(); // boost each sub-weight
return sum ;
}
代码示例来源:origin: org.infinispan/infinispan-query
@Override
public void writeObject(final ObjectOutput output, final BooleanQuery query) throws IOException {
output.writeBoolean(query.isCoordDisabled());
output.writeFloat(query.getBoost());
UnsignedNumeric.writeUnsignedInt(output, query.getMinimumNumberShouldMatch());
final List<BooleanClause> booleanClauses = query.clauses();
final int numberOfClauses = booleanClauses.size();
UnsignedNumeric.writeUnsignedInt(output, numberOfClauses);
for (BooleanClause booleanClause : booleanClauses) {
writeClause(output, booleanClause);
}
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
@Override
public void writeObject(final ObjectOutput output, final BooleanQuery query) throws IOException {
output.writeBoolean(query.isCoordDisabled());
output.writeFloat(query.getBoost());
UnsignedNumeric.writeUnsignedInt(output, query.getMinimumNumberShouldMatch());
final List<BooleanClause> booleanClauses = query.clauses();
final int numberOfClauses = booleanClauses.size();
UnsignedNumeric.writeUnsignedInt(output, numberOfClauses);
for (BooleanClause booleanClause : booleanClauses) {
writeClause(output, booleanClause);
}
}
代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-core
/**
* Recursively walks the "from" query pulling out sub-queries and
* adding them to the "to" query.
*
* <p>
* Boosts are multiplied as needed. Sub-BooleanQueryies which are not
* optional will not be flattened. From will be mangled durring the walk,
* so do not attempt to reuse it.
* </p>
*/
public static void flattenBooleanQuery(BooleanQuery to, BooleanQuery from) {
for (BooleanClause clause : (List<BooleanClause>)from.clauses()) {
Query cq = clause.getQuery();
cq.setBoost(cq.getBoost() * from.getBoost());
if (cq instanceof BooleanQuery
&& !clause.isRequired()
&& !clause.isProhibited()) {
/* we can recurse */
flattenBooleanQuery(to, (BooleanQuery)cq);
} else {
to.add(clause);
}
}
}
代码示例来源:origin: org.pageseeder.flint/pso-flint-lucene
/**
* Substitutes one term in the term query for another.
*
* <p>This method only creates new query object if required; it does not modify the given query.
*
* @param query the query where the substitution should occur.
* @param original the original term to replace.
* @param replacement the term it should be replaced with.
*
* @return A new term query where the term has been substituted;
* or the same query if no substitution was needed.
*/
@Beta
public static Query substitute(BooleanQuery query, Term original, Term replacement) {
BooleanQuery q = new BooleanQuery();
for (BooleanClause clause : query.getClauses()) {
Query qx = substitute(clause.getQuery(), original, replacement);
q.add(qx, clause.getOccur());
}
q.setBoost(query.getBoost());
return q;
}
代码示例来源:origin: ajermakovics/eclipse-instasearch
bq.add(phraseQuery, Occur.SHOULD);
bq.add(boolQuery, Occur.SHOULD);
bq.setBoost(boolQuery.getBoost());
phraseQuery.setBoost(boolQuery.getBoost());
boolQuery.setBoost( phraseQuery.getBoost()*0.5f );
内容来源于网络,如有侵权,请联系作者删除!