Hi, Can someone please help with how to write a query for the following scenario?
We index Topics that contains text. A topic can have many versions, each version is indexed. Our schema has topicid, versionId and timestamp fields, amongst others. Topicid is not a uniqueField because multiple verisons of a topic have the same topicId. Instead the versionId and timestamp differ for each version as follows. SolrInputDocument doc1 = new SolrInputDocument(); doc1.addField("id", "1"); doc1.addField("versionId", "1"); doc1.addField("versionDate", "2008-12-23T23:59:59Z"); SolrInputDocument doc1_1 = new SolrInputDocument(); doc1_1.addField("id", "1"); doc1_1.addField("versionId", "2"); doc1_1.addField("versionDate", "2008-12-24T23:59:59Z"); SolrInputDocument doc2 = new SolrInputDocument(); doc2.addField("id", "2"); doc2.addField("versionId", "1"); doc2.addField("versionDate", "2008-12-23T23:59:59Z"); SolrInputDocument doc2_1 = new SolrInputDocument(); doc2_1.addField("id", "2"); doc2_1.addField("versionId", "2"); doc2_1.addField("versionDate", "2008-12-24T23:59:59Z"); SolrInputDocument doc2_2 = new SolrInputDocument(); doc2_2.addField("id", "2"); doc2_2.addField("versionId", "3"); doc2_2.addField("versionDate", "2008-12-25T23:59:59Z"); We want to write a single query where the query returns doc1_1, doc2_2 and so on...that is for documents that have the same id, we want the query to return the document with highest versionId or the latest timestamp. Any thoughts how this can be done? Thanks, Sushil -- View this message in context: http://www.nabble.com/Retrieve-documents-that-contain-max-value-for-a-field-tp21175643p21175643.html Sent from the Solr - User mailing list archive at Nabble.com.