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 Volodymyr Bychkoviak <vb...@i-hypergrid.com> on 2005/10/31 12:24:27 UTC

complex search

hi all.

I have indexed table from database into index and it looks like:
<itemId>
<price>
<otherFields>

itemId is not unique.

I want to implement search which in SQL equivalent looks like
select itemId, min(price) from <table>
    where <condition on otherFields>
    groupBy itemId


Is it possible to achieve?

-- 
regards,
Volodymyr Bychkoviak


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


Re: complex search

Posted by Volodymyr Bychkoviak <vb...@i-hypergrid.com>.
thanks for idea...

Chris Hostetter wrote:
> : I want to implement search which in SQL equivalent looks like
> : select itemId, min(price) from <table>
> :     where <condition on otherFields>
> :     groupBy itemId
>
> : Is it possible to achieve?
>
>
> Not easily.  The most straightforward approach I can think of is to write
> your own HitCollector that builds up a Hash of itemId => price mappings
> for each docId it sees with a positive score, and only overright existing
> mappings if the price it sees is less then the previous price.
>
> To make it efficient, you're going to want to make sure itemId and price
> are both indexed fields, and use the FieldCache.
>
>
>
> -Hoss
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
>   

-- 
regards,
Volodymyr Bychkoviak


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


Re: complex search

Posted by Chris Hostetter <ho...@fucit.org>.
: I want to implement search which in SQL equivalent looks like
: select itemId, min(price) from <table>
:     where <condition on otherFields>
:     groupBy itemId

: Is it possible to achieve?


Not easily.  The most straightforward approach I can think of is to write
your own HitCollector that builds up a Hash of itemId => price mappings
for each docId it sees with a positive score, and only overright existing
mappings if the price it sees is less then the previous price.

To make it efficient, you're going to want to make sure itemId and price
are both indexed fields, and use the FieldCache.



-Hoss


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