TopDocs topDocs = searcher.search(directQuery, 10);
System.out.println("Number of matching docs: " + topDocs.totalHits);
ScoreDoc doc1 = topDocs.scoreDocs[0];
System.out.println("Doc: " + doc1.toString());
System.out.println("Explain: " + searcher.explain(directQuery, doc1.doc));
Query payloadQuery = new PayloadTermQuery(new Term("title", "London"), new MaxPayloadFunction());
topDocs = searcher.search(payloadQuery, 10);
System.out.println("Number of matching docs: " + topDocs.totalHits);
ScoreDoc doc2 = topDocs.scoreDocs[0];
System.out.println("Doc: " + doc2.toString());
System.out.println("Explain: " + searcher.explain(payloadQuery, doc2.doc));