本文整理了Java中org.apache.lucene.search.Sort.toString()
方法的一些代码示例,展示了Sort.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Sort.toString()
方法的具体详情如下:
包路径:org.apache.lucene.search.Sort
类名称:Sort
方法名:toString
暂无
代码示例来源:origin: org.apache.lucene/lucene-core
/**
* Returns the identifier of this {@link Sorter}.
* <p>This identifier is similar to {@link Object#hashCode()} and should be
* chosen so that two instances of this class that sort documents likewise
* will have the same identifier. On the contrary, this identifier should be
* different on different {@link Sort sorts}.
*/
public String getID() {
return sort.toString();
}
代码示例来源:origin: org.apache.lucene/lucene-core
@Override
public Explanation explain(IndexSearcher searcher, Explanation firstPassExplanation, int docID) throws IOException {
TopDocs oneHit = new TopDocs(1, new ScoreDoc[] {new ScoreDoc(docID, firstPassExplanation.getValue())});
TopDocs hits = rescore(searcher, oneHit, 1);
assert hits.totalHits == 1;
List<Explanation> subs = new ArrayList<>();
// Add first pass:
Explanation first = Explanation.match(firstPassExplanation.getValue(), "first pass score", firstPassExplanation);
subs.add(first);
FieldDoc fieldDoc = (FieldDoc) hits.scoreDocs[0];
// Add sort values:
SortField[] sortFields = sort.getSort();
for(int i=0;i<sortFields.length;i++) {
subs.add(Explanation.match(0.0f, "sort field " + sortFields[i].toString() + " value=" + fieldDoc.fields[i]));
}
// TODO: if we could ask the Sort to explain itself then
// we wouldn't need the separate ExpressionRescorer...
return Explanation.match(0.0f, "sort field values for sort=" + sort.toString(), subs);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene
/**
* Returns the identifier of this {@link Sorter}.
* <p>This identifier is similar to {@link Object#hashCode()} and should be
* chosen so that two instances of this class that sort documents likewise
* will have the same identifier. On the contrary, this identifier should be
* different on different {@link Sort sorts}.
*/
public String getID() {
return sort.toString();
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
/**
* Returns the identifier of this {@link Sorter}.
* <p>This identifier is similar to {@link Object#hashCode()} and should be
* chosen so that two instances of this class that sort documents likewise
* will have the same identifier. On the contrary, this identifier should be
* different on different {@link Sort sorts}.
*/
public String getID() {
return sort.toString();
}
代码示例来源:origin: harbby/presto-connectors
/**
* Returns the identifier of this {@link Sorter}.
* <p>This identifier is similar to {@link Object#hashCode()} and should be
* chosen so that two instances of this class that sort documents likewise
* will have the same identifier. On the contrary, this identifier should be
* different on different {@link Sort sorts}.
*/
public String getID() {
return sort.toString();
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
/** Returns {@code true} if the given {@code reader} is sorted by the
* {@code sort} given. Typically the given {@code sort} would be the
* {@link SortingMergePolicy#getSort()} order of a {@link SortingMergePolicy}. */
public static boolean isSorted(LeafReader reader, Sort sort) {
String description = getSortDescription(reader);
if (description != null && description.equals(sort.toString())) {
return true;
}
return false;
}
代码示例来源:origin: harbby/presto-connectors
/** Returns {@code true} if the given {@code reader} is sorted by the
* {@code sort} given. Typically the given {@code sort} would be the
* {@link SortingMergePolicy#getSort()} order of a {@link SortingMergePolicy}. */
public static boolean isSorted(LeafReader reader, Sort sort) {
String description = getSortDescription(reader);
if (description != null && description.equals(sort.toString())) {
return true;
}
return false;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene
@Override
public Explanation explain(IndexSearcher searcher, Explanation firstPassExplanation, int docID) throws IOException {
TopDocs oneHit = new TopDocs(1, new ScoreDoc[] {new ScoreDoc(docID, firstPassExplanation.getValue())});
TopDocs hits = rescore(searcher, oneHit, 1);
assert hits.totalHits == 1;
List<Explanation> subs = new ArrayList<>();
// Add first pass:
Explanation first = Explanation.match(firstPassExplanation.getValue(), "first pass score", firstPassExplanation);
subs.add(first);
FieldDoc fieldDoc = (FieldDoc) hits.scoreDocs[0];
// Add sort values:
SortField[] sortFields = sort.getSort();
for(int i=0;i<sortFields.length;i++) {
subs.add(Explanation.match(0.0f, "sort field " + sortFields[i].toString() + " value=" + fieldDoc.fields[i]));
}
// TODO: if we could ask the Sort to explain itself then
// we wouldn't need the separate ExpressionRescorer...
return Explanation.match(0.0f, "sort field values for sort=" + sort.toString(), subs);
}
}
代码示例来源:origin: harbby/presto-connectors
@Override
public Explanation explain(IndexSearcher searcher, Explanation firstPassExplanation, int docID) throws IOException {
TopDocs oneHit = new TopDocs(1, new ScoreDoc[] {new ScoreDoc(docID, firstPassExplanation.getValue())});
TopDocs hits = rescore(searcher, oneHit, 1);
assert hits.totalHits == 1;
List<Explanation> subs = new ArrayList<>();
// Add first pass:
Explanation first = Explanation.match(firstPassExplanation.getValue(), "first pass score", firstPassExplanation);
subs.add(first);
FieldDoc fieldDoc = (FieldDoc) hits.scoreDocs[0];
// Add sort values:
SortField[] sortFields = sort.getSort();
for(int i=0;i<sortFields.length;i++) {
subs.add(Explanation.match(0.0f, "sort field " + sortFields[i].toString() + " value=" + fieldDoc.fields[i]));
}
// TODO: if we could ask the Sort to explain itself then
// we wouldn't need the separate ExpressionRescorer...
return Explanation.match(0.0f, "sort field values for sort=" + sort.toString(), subs);
}
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
@Override
public Explanation explain(IndexSearcher searcher, Explanation firstPassExplanation, int docID) throws IOException {
TopDocs oneHit = new TopDocs(1, new ScoreDoc[] {new ScoreDoc(docID, firstPassExplanation.getValue())});
TopDocs hits = rescore(searcher, oneHit, 1);
assert hits.totalHits == 1;
List<Explanation> subs = new ArrayList<>();
// Add first pass:
Explanation first = Explanation.match(firstPassExplanation.getValue(), "first pass score", firstPassExplanation);
subs.add(first);
FieldDoc fieldDoc = (FieldDoc) hits.scoreDocs[0];
// Add sort values:
SortField[] sortFields = sort.getSort();
for(int i=0;i<sortFields.length;i++) {
subs.add(Explanation.match(0.0f, "sort field " + sortFields[i].toString() + " value=" + fieldDoc.fields[i]));
}
// TODO: if we could ask the Sort to explain itself then
// we wouldn't need the separate ExpressionRescorer...
return Explanation.match(0.0f, "sort field values for sort=" + sort.toString(), subs);
}
}
内容来源于网络,如有侵权,请联系作者删除!