FAQ
hi, i have been searching for getting the term enum for filtered documents...
I have index containing fields "group_id" and "user"..i know that we can
easily get unique Terms and their count for specific filed by following
code..

HashMap hmap= new HashMap();
TermEnum tenum= reader.terms(new Term("group_id"));
boolean next=true;

while(next==true && tenum.term().field().equals("group_id")){
hmap.put(tenum.term().text(), tenum.docFreq());
next=tenum.next();
}

but now problem is that i want to find unique term count on basis of some
filter...
e.g "I want to get users and their count in 'group_id:Java' "

I can fulfill my requirement by iterating on documents whose "group_id:Java"
but this will slow down the process. Please guide me how to do this
efficiently... any other idea is highly appreciated :)
Thanks

--
View this message in context: http://lucene.472066.n3.nabble.com/how-to-find-filtered-term-enum-tp2352751p2352751.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

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

Search Discussions

  • Pierre GOSSE at Jan 26, 2011 at 1:58 pm
    Solr's faceting would be the answer .. in solr.

    Maybe you could find hints about doing that with lucene by having a look at solr's code for faceting.

    Pierre

    -----Message d'origine-----
    De : Emmad
    Envoyé : mercredi 26 janvier 2011 10:53
    À : java-user@lucene.apache.org
    Objet : how to find filtered term enum?


    hi, i have been searching for getting the term enum for filtered documents...
    I have index containing fields "group_id" and "user"..i know that we can
    easily get unique Terms and their count for specific filed by following
    code..

    HashMap hmap= new HashMap();
    TermEnum tenum= reader.terms(new Term("group_id"));
    boolean next=true;

    while(next==true && tenum.term().field().equals("group_id")){
    hmap.put(tenum.term().text(), tenum.docFreq());
    next=tenum.next();
    }

    but now problem is that i want to find unique term count on basis of some
    filter...
    e.g "I want to get users and their count in 'group_id:Java' "

    I can fulfill my requirement by iterating on documents whose "group_id:Java"
    but this will slow down the process. Please guide me how to do this
    efficiently... any other idea is highly appreciated :)
    Thanks

    --
    View this message in context: http://lucene.472066.n3.nabble.com/how-to-find-filtered-term-enum-tp2352751p2352751.html
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.

    ---------------------------------------------------------------------
    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
  • Emmad at Jan 26, 2011 at 5:23 pm
    Thanks Pierre for your reply. Actually m not able to find that could you
    please elaborate that how solr do this? any guess?
    --
    View this message in context: http://lucene.472066.n3.nabble.com/how-to-find-filtered-term-enum-tp2352751p2355007.html
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedJan 26, '11 at 9:59a
activeJan 26, '11 at 5:23p
posts3
users2
websitelucene.apache.org

2 users in discussion

Emmad: 2 posts Pierre GOSSE: 1 post

People

Translate

site design / logo © 2022 Grokbase