Java Code Examples for org.apache.lucene.index.SortedDocValues#binaryValue()
The following examples show how to use
org.apache.lucene.index.SortedDocValues#binaryValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestICUCollationDocValuesField.java From lucene-solr with Apache License 2.0 | 5 votes |
private void doTestRanges(IndexSearcher is, String startPoint, String endPoint, BytesRef startBR, BytesRef endBR, Collator collator) throws Exception { SortedDocValues dvs = MultiDocValues.getSortedValues(is.getIndexReader(), "collated"); for(int docID=0;docID<is.getIndexReader().maxDoc();docID++) { Document doc = is.doc(docID); String s = doc.getField("field").stringValue(); boolean collatorAccepts = collator.compare(s, startPoint) >= 0 && collator.compare(s, endPoint) <= 0; assertEquals(docID, dvs.nextDoc()); BytesRef br = dvs.binaryValue(); boolean luceneAccepts = br.compareTo(startBR) >= 0 && br.compareTo(endBR) <= 0; assertEquals(collatorAccepts, luceneAccepts); } }
Example 2
Source File: TestCollationDocValuesField.java From lucene-solr with Apache License 2.0 | 5 votes |
private void doTestRanges(IndexSearcher is, String startPoint, String endPoint, BytesRef startBR, BytesRef endBR, Collator collator) throws Exception { SortedDocValues dvs = MultiDocValues.getSortedValues(is.getIndexReader(), "collated"); for(int docID=0;docID<is.getIndexReader().maxDoc();docID++) { Document doc = is.doc(docID); String s = doc.getField("field").stringValue(); boolean collatorAccepts = collate(collator, s, startPoint) >= 0 && collate(collator, s, endPoint) <= 0; assertEquals(docID, dvs.nextDoc()); BytesRef br = dvs.binaryValue(); boolean luceneAccepts = br.compareTo(startBR) >= 0 && br.compareTo(endBR) <= 0; assertEquals(startPoint + " <= " + s + " <= " + endPoint, collatorAccepts, luceneAccepts); } }