MultiValued FC question

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

MultiValued FC question

Billnbell
(I posted on solr-user by mistake)


Trying to get a list of multiValued fields from the cache…

ValueSource vs = sf.getType().getValueSource(sf, fp); 
DocValues llVals = vs.getValues(context, reader);
org.apache.lucene.spatial.geohash.GeoHashUtils.decode(llVals.strVal(doc));

     public String strVal(int doc) {
        int ord=termsIndex.getOrd(doc);
        if (ord == 0) {
          return null;
        } else {
          return termsIndex.lookup(ord, new BytesRef()).utf8ToString();
        }
      }

I figure the problem is that lookup only returns one. I need more than 1… I thought ./lucene/src/java/org/apache/lucene/document/Document.java would help me, but it didn't much. Would I want to call getFieldables(name) ? Or would that slow down the caching? Thoughts?

  1. What is termIndex ? Why does ord() matter?
  2. Is there a helper for getting a multiValue field from the Field cache?  

The strVal(doc) only returns one of the multiValues. Thought one of you gurus might know the answer.

Thanks.

Bill


Reply | Threaded
Open this post in threaded view
|

Re: MultiValued FC question

Bill Bell-3
I'll ask another way…

If I use termsIndex. There does not appear to be a way to get a list of terms for a document and field easily using ValueSource. Is that right?

If not, how would I go about getting a list of terms for a field in a document? When I do fq=ids:56 it appears to work on multivalued fields. How does it work?

Thanks.

From: Bill Bell <[hidden email]>
Reply-To: <[hidden email]>
Date: Sun, 13 Feb 2011 02:31:57 -0700
To: "[hidden email]" <[hidden email]>
Subject: MultiValued FC question

(I posted on solr-user by mistake)


Trying to get a list of multiValued fields from the cache…

ValueSource vs = sf.getType().getValueSource(sf, fp); 
DocValues llVals = vs.getValues(context, reader);
org.apache.lucene.spatial.geohash.GeoHashUtils.decode(llVals.strVal(doc));

     public String strVal(int doc) {
        int ord=termsIndex.getOrd(doc);
        if (ord == 0) {
          return null;
        } else {
          return termsIndex.lookup(ord, new BytesRef()).utf8ToString();
        }
      }

I figure the problem is that lookup only returns one. I need more than 1… I thought ./lucene/src/java/org/apache/lucene/document/Document.java would help me, but it didn't much. Would I want to call getFieldables(name) ? Or would that slow down the caching? Thoughts?

  1. What is termIndex ? Why does ord() matter?
  2. Is there a helper for getting a multiValue field from the Field cache?  

The strVal(doc) only returns one of the multiValues. Thought one of you gurus might know the answer.

Thanks.

Bill