public interface ImageSearcher
IndexReader reader = IndexReader.open(indexPath);
ImageSearcher searcher = ImageSearcherFactory.createDefaultSearcher();
FileInputStream imageStream = new FileInputStream("image.jpg");
BufferedImage bimg = ImageIO.read(imageStream);
// searching for an image:
ImageSearchHits hits = null;
hits = searcher.search(bimg, reader);
for (int i = 0; i < 5; i++) {
System.out.println(hits.score(i) + ": " + hits.doc(i).getField(DocumentBuilder.FIELD_NAME_IDENTIFIER).stringValue());
}
// searching for a document:
Document document = hits.doc(0);
hits = searcher.search(document, reader);
for (int i = 0; i < 5; i++) {
System.out.println(hits.score(i) + ": " + hits.doc(i).getField(DocumentBuilder.FIELD_NAME_IDENTIFIER).stringValue());
}
This file is part of the Caliph and Emir project: http://www.SemanticMetadata.net
| 限定符和类型 | 方法和说明 |
|---|---|
ImageDuplicates |
findDuplicates(org.apache.lucene.index.IndexReader reader)
Identifies duplicates in the database.
|
ImageSearchHits |
relevanceFeedback(ImageSearchHits originalSearch,
java.util.Set<org.apache.lucene.document.Document> positives,
java.util.Set<org.apache.lucene.document.Document> negatives)
Modifies the given search by the provided positive and negative examples.
|
ImageSearchHits |
search(java.awt.image.BufferedImage image,
org.apache.lucene.index.IndexReader reader)
Searches for images similar to the given image.
|
ImageSearchHits |
search(org.apache.lucene.document.Document doc,
org.apache.lucene.index.IndexReader reader)
Searches for images similar to the given image, defined by the Document from the index.
|
ImageSearchHits |
search(java.io.InputStream image,
org.apache.lucene.index.IndexReader reader)
Searches for images similar to the given image.
|
ImageSearchHits search(java.awt.image.BufferedImage image, org.apache.lucene.index.IndexReader reader) throws java.io.IOException
image - the example image to search for.reader - the IndexReader which is used to search through the images.java.io.IOException - in case exceptions in the reader occursImageSearchHits search(org.apache.lucene.document.Document doc, org.apache.lucene.index.IndexReader reader) throws java.io.IOException
doc - the example image to search for.reader - the IndexReader which is used to dsearch through the images.java.io.IOException - in case exceptions in the reader occursImageSearchHits search(java.io.InputStream image, org.apache.lucene.index.IndexReader reader) throws java.io.IOException
image - the example image to search for.reader - the IndexReader which is used to dsearch through the images.java.io.IOException - in case the image could not be read from stream.ImageDuplicates findDuplicates(org.apache.lucene.index.IndexReader reader) throws java.io.IOException
reader - the IndexReader which is used to dsearch through the images.java.io.IOException - in case the image could not be read from stream.ImageSearchHits relevanceFeedback(ImageSearchHits originalSearch, java.util.Set<org.apache.lucene.document.Document> positives, java.util.Set<org.apache.lucene.document.Document> negatives)
originalSearch - positives - negatives -