You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by senthil kumaran <ku...@gmail.com> on 2008/07/28 13:53:11 UTC

How to get unique values for field1 where search is on field2?

Hi,
    I've indexed Book Title,Author Name,Contents and some other fields.
Previously I gave option to search string in any of those fields and I
displayed results from getting fields "Title","Author Name","Contents" from
hits resulted docs.
    Now I want to display "Title" & "Author Name" list which have search
string in "Contents" field.

     For example Title                 : The J2EE Tutorial
                          Author Name   : Stephanie Bodoff
                          Contents          : Enterprise Beans,A
Message-Driven Bean Example .............etc............

                          Title                 : The Advanced J2EE
                          Author Name   : Stephanie Bodoff
                          Contents          : A Session Bean Example,
.............etc............

                          Title                 : Guide to Computer Security
Management
                          Author Name   : Karen Kent
                          Contents          : Management
Infrastructure,Management Planning,Management Operational Processes Example
.............etc............


    If I search the string      Example , it'll return 3 docs. I want those
3 Contents values with Title value , but I don't need duplicated Author
Names (need unique details). So I need 2 Author Name fields.
    To achieve this I've used 2 lucene queries
                     1.query with Contents:example & get only Title and
Contents fields for that search string.
                     2. same query with DuplicateFilter("Author Name") and
get only unique Author Names.

    Is there any other ways available during indexing or searching?

Thanks
RSK

Re: How to get unique values for field1 where search is on field2?

Posted by Chris Hostetter <ho...@fucit.org>.
What you are describing sounds an awful lot lik you wantto "facet" on the 
Author field ... if you search the mailing list archives you'll find quite 
a bit of discussion on various approaches to this problem.

-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org