lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From udaysasi <>
Subject DuplicateFilter on search results
Date Mon, 22 Dec 2008 21:05:36 GMT

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

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. 

View this message in context:
Sent from the Lucene - General mailing list archive at

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message