FAQ
Hello

Is there an api that indicates whether a field is multivalued, just like
IndexReader.getFieldNames(IndexReader.FieldOption fldOption) does it
for fields beeing indexed/stored/termvector?

Of course I could track it at index time.

Stefan

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

Search Discussions

  • Mark harwood at Mar 17, 2010 at 5:42 pm
    Not the fastest thing in the world but works:

    Term startTerm=new Term("myFieldName","");
    TermEnum te=reader.terms(startTerm);
    BitSet docsRead=new BitSet(reader.maxDoc());
    boolean multiValued=false;
    do{
    Term t=te.term();
    if((t==null)||(t.field()!=startTerm.field()))
    {
    break;
    }
    TermDocs td = reader.termDocs(t);
    while(td.next())
    {
    if(docsRead.get(td.doc()))
    {
    multiValued=true;
    break;
    }
    docsRead.set(td.doc());
    }
    }while(te.next()&&multiValued==false);




    ----- Original Message ----
    From: Stefan Trcek <wzzelfzzel@abas.de>
    To: java-user@lucene.apache.org
    Sent: Wed, 17 March, 2010 16:15:36
    Subject: Get info wheter a field is multivalued

    Hello

    Is there an api that indicates whether a field is multivalued, just like
    IndexReader.getFieldNames(IndexReader.FieldOption fldOption) does it
    for fields beeing indexed/stored/termvector?

    Of course I could track it at index time.

    Stefan

    ---------------------------------------------------------------------
    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
  • Stefan Trcek at Mar 17, 2010 at 6:49 pm

    On Wednesday 17 March 2010 18:42:10 mark harwood wrote:
    Not the fastest thing in the world but works:

    Term startTerm=new Term("myFieldName","");
    TermEnum te=reader.terms(startTerm);
    BitSet docsRead=new BitSet(reader.maxDoc());
    boolean multiValued=false;
    do{
    Term t=te.term();
    if((t==null)||(t.field()!=startTerm.field()))
    {
    break;
    }
    TermDocs td = reader.termDocs(t);
    while(td.next())
    {
    if(docsRead.get(td.doc()))
    {
    multiValued=true;
    break;
    }
    docsRead.set(td.doc());
    }
    }while(te.next()&&multiValued==false);
    Nice idea. Just running it: 1,5s for 1M terms. I guess I'll track it at
    index time.

    Thanks,
    Stefan

    ---------------------------------------------------------------------
    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
postedMar 17, '10 at 4:16p
activeMar 17, '10 at 6:49p
posts3
users2
websitelucene.apache.org

2 users in discussion

Stefan Trcek: 2 posts Mark harwood: 1 post

People

Translate

site design / logo © 2022 Grokbase