lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Lu <chris...@gmail.com>
Subject Re: Optimal Solution for Unique Field Values
Date Sun, 15 Feb 2009 13:14:04 GMT
I think you would need to
1) collect all the matching IDs for Field2=x
2) loop through Field1, for each Term's doc, collect the term if the term
doc is in the matching IDs from step 1.

This should be the fastest approach, pretty similar to what you suggested.

-- 
Chris Lu
-------------------------
Instant Scalable Full-Text Search On Any Database/Application
site: http://www.dbsight.net
demo: http://search.dbsight.com
Lucene Database Search in 3 minutes:
http://wiki.dbsight.com/index.php?title=Create_Lucene_Database_Search_in_3_minutes
DBSight customer, a shopping comparison site, (anonymous per request) got
2.6 Million Euro funding!

On Sun, Feb 15, 2009 at 5:02 AM, Joel Halbert <joel@su3analytics.com> wrote:

> Hi,
>
> I'm looking for an optimal solution for extracting unique field values.
> The rub is that I want to be able to perform this for a unique subset of
> documents...as per the example:
>
> I have an index with Field1 and Field2.
>
> I want "all unique values of Field1 where Field2=X".
>
> Other than actually performing a query, where I select all documents
> that satisfy the condition Field2=x and then collecting the unique field
> values myself by iterating across the hits, is there a way of leveraging
> the indexreader, and enumerating across Fields, something like the
> general example given here:
>
> http://wiki.apache.org/lucene-java/LuceneFAQ#head-a801793d7479264e29157d92440199b35266dc18
>
> Thx,
> Joel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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