lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sawan Sharma" <ssha...@chambal.com>
Subject Group the search results by a given field
Date Thu, 17 May 2007 09:03:02 GMT
Hi All,

I was wondering - is it possible to search and group the results by a
given field?

For example, I have an index with several million records. Most of
them are different Features of the same ID.

I'd love to be able to do.. groupby=ID or something like that
in the results, and provide the ID as a clickable link to see
all the Features of that ID.

I have used HitCollector class to accomplish this goal. In Collect method I
have used following algo...

Collect()
{
    if Searcher.Doc(doc_id).get(ID) is not exist in HashKey then
                   Add Searcher.Doc(doc_id).get(ID) as new HashKey in hash
table and assign value = 1
    else
                   increment HashKey( Searcher.Doc(doc_id).get(ID)) value
with 1
}

But, it depends on HitCount. As soon as I get more hits it takes more time
and my search performance is degrade.

How it can be done with best performance..?

Any ideas?

Sawan

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