You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@lucene.apache.org by udaysasi <ud...@gmail.com> on 2008/12/22 22:04:51 UTC

DuplicateFilter on search results

Hello All, 

I am new to this forum and I have a question where I am stuck and would
appreciate any pointers or inputs.

I have created a Lucene index from a Database table. I am trying to apply a
Duplicate Filter on an attribute while searching for another attribute. 

Lets say for example(and simplicity), I have columns like username, itemname
and that the index looks like the following : 

username    itemname   item description   docid
---------    ---------   ---------------   -----
john            laptop          Lenovo              0
eric               pda          Blackberry           1
john            iphone            Apple              2
john              pda           Blackberry          3
monica        iphone            Apple              4
john            laptop             Dell                5

Now, My question is - how do I get all the unique items that a particular
person (Say, John) contains?

I tried to query the index with username:john and tried to apply a
DuplicateFilter on itemname column while searching. What I get in the
results is just the laptop and iphone. Looks like the duplicate filter is
applied on the entire index which eliminates anything but the
FIRST_OCCURENCE of the item pda. Hence the filter yeilds only doc ids : 0,
1, 2 and among them, the search yeilds only docs 0 and 2 when I search for
username:john

Is there a way to apply duplicatefilter on the search results? Like - Get
all records for John and Get all Unique itemnames under his name. 

I am not sure if I was clear enough explaining my problem. Please throw some
light on this if you have encountered such issue and was able to find a way
to do this. 

I did some googling and found ways to join queries using BooleanFilter to
add a subquery to an existing query. What I am trying to do is to add a
filter to a query result. 

Thanks
-Uday
-- 
View this message in context: http://www.nabble.com/DuplicateFilter-on-search-results-tp21134975p21134975.html
Sent from the Lucene - General mailing list archive at Nabble.com.