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 John Powers <jp...@configureone.com> on 2005/11/15 16:45:40 UTC
Items in multiple category: distinct search?
Hello, I have done a search for this issue, but I didnt really see an
answer.
if i want to store things in a hierarchy, but i want items to be in multiple
categories at any level. i'd like to be able to search for an item and
only show it once, but maybe (not required) show what categories the results
are in. but if i look in a category (search on that category) then i want
to see that item there obviously only the once that it is there.
so i've got the hierarchy part..but its getting items to be in multiple
categories. i can put them there as duplicate entries of that itemNumber,
however when i search i dont want to get back the 7 times that one item is
used.. i dont mind if its in 7 categories and they each show one usage, but
i'd like for my total hit count to reflect just that this item exists
once... i could iterate through the whole Hits list and put them into a
unique result list, but i'd like lucene to do that for me. any way to do
that? custom filter? i've looked at the query language..i didnt see a
"distinct" clause...
any help is greatly appreciated.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Items in multiple category: distinct search?
Posted by John Powers <jp...@configureone.com>.
I got the category thing to work. I'm using a string "category" that looks
like:
Cat1[980455981]{4}|SubCatA[980456122]{1}|
Then I can search by id, name and when I get a result list I can put them in
sequence (the soft bracket number)
However, my problem now is distinct... I want to put items in multiple
categories.. That works fine. But if I query lucene, then I get back not
the one thing I want, but the 5 duplicates because as far as lucene is
concerned I guess those are 5 line items in the index. I could put a flag
in there that says one of them is the primary instance and so then I only
search with that as a query.. But I don't want to do that. I would like
to just filter out by itemID or something like that any dups...
I could just dump all the items into a List or something that only accepts
new unused items.. But I'd rather use a lucene solution...
On 11/15/05 2:38 PM, "Jeff Rodenburg" <je...@gmail.com> wrote:
> Hi John -
>
> It sounds like you're thinking of your index in terms of sql constructs --
> multiple rows for the same record. We do this very same thing with
> categories; if you have a record that lives in multiple categories, just add
> additional category field/value pairs for your original record. It's ok to
> use multiple fields with the same name. Once stored, if you want to see
> records in category "A", just query lucene for category "A". Thinking of it
> in terms of SQL constructs makes it more difficult than it needs to be.
>
> Hope this helps.
>
>
>
> On 11/15/05, John Powers <jp...@configureone.com> wrote:
>>
>> Hello, I have done a search for this issue, but I didnt really see an
>> answer.
>>
>> if i want to store things in a hierarchy, but i want items to be in
>> multiple
>> categories at any level. i'd like to be able to search for an item and
>> only show it once, but maybe (not required) show what categories the
>> results
>> are in. but if i look in a category (search on that category) then i want
>> to see that item there obviously only the once that it is there.
>>
>> so i've got the hierarchy part..but its getting items to be in multiple
>> categories. i can put them there as duplicate entries of that itemNumber,
>> however when i search i dont want to get back the 7 times that one item is
>> used.. i dont mind if its in 7 categories and they each show one usage,
>> but
>> i'd like for my total hit count to reflect just that this item exists
>> once... i could iterate through the whole Hits list and put them into a
>> unique result list, but i'd like lucene to do that for me. any way to do
>> that? custom filter? i've looked at the query language..i didnt see a
>> "distinct" clause...
>>
>> any help is greatly appreciated.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Items in multiple category: distinct search?
Posted by Jeff Rodenburg <je...@gmail.com>.
Hi John -
It sounds like you're thinking of your index in terms of sql constructs --
multiple rows for the same record. We do this very same thing with
categories; if you have a record that lives in multiple categories, just add
additional category field/value pairs for your original record. It's ok to
use multiple fields with the same name. Once stored, if you want to see
records in category "A", just query lucene for category "A". Thinking of it
in terms of SQL constructs makes it more difficult than it needs to be.
Hope this helps.
On 11/15/05, John Powers <jp...@configureone.com> wrote:
>
> Hello, I have done a search for this issue, but I didnt really see an
> answer.
>
> if i want to store things in a hierarchy, but i want items to be in
> multiple
> categories at any level. i'd like to be able to search for an item and
> only show it once, but maybe (not required) show what categories the
> results
> are in. but if i look in a category (search on that category) then i want
> to see that item there obviously only the once that it is there.
>
> so i've got the hierarchy part..but its getting items to be in multiple
> categories. i can put them there as duplicate entries of that itemNumber,
> however when i search i dont want to get back the 7 times that one item is
> used.. i dont mind if its in 7 categories and they each show one usage,
> but
> i'd like for my total hit count to reflect just that this item exists
> once... i could iterate through the whole Hits list and put them into a
> unique result list, but i'd like lucene to do that for me. any way to do
> that? custom filter? i've looked at the query language..i didnt see a
> "distinct" clause...
>
> any help is greatly appreciated.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>