take a look at the HitCollector and Filter APIs .. you can impliment any logic you want in either of those classes to restrict what results you get -- and the FieldCache gives you an easy way to check what the value of a particular indexed field is.
storing the mappings of field value to "best" matching doc is up to you. : Date: Fri, 9 Jun 2006 14:27:54 +0800 : From: Alan Boo <[EMAIL PROTECTED]> : Reply-To: java-user@lucene.apache.org : To: java-user@lucene.apache.org : Subject: return single document from duplicated documents in index : : g'day, : : i've two questions. : : let's say the following is my index with 2 field : title and contents : : title contents : beer beer is good : beer beer is good : cat sleepy : dog what a cute one! : beer beer is good : : if i do a search on beer, i'll get 3 result returns and three of them : are the same, is there any elegant way to workaround so the hitlist : contains only one document instead of 3? (and i want the index : contains duplicate records for some reason) : : ____ : : : yet, another senario, : : title contents location : date : beer beer is god /usr/data/beer : 111111111 : beer beer is good /usr/data/beer : 222222255 : cat sleepy /usr/data/cat : 222222224 : dog what a cute one! /usr/data/dog 555555555 : beer beer is good /usr/data/beer2 : 999999999 : : i want to do a search on beer that will returns only the 2 result on : beer on different location and it must be the latest. is there any way : to do that? : : regards, : : alan : : --------------------------------------------------------------------- : To unsubscribe, e-mail: [EMAIL PROTECTED] : For additional commands, e-mail: [EMAIL PROTECTED] : -Hoss --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]