Re: MultiValued FC question

2011-02-15 Thread Bill Bell
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 billnb...@gmail.com
Reply-To:  dev@lucene.apache.org
Date:  Sun, 13 Feb 2011 02:31:57 -0700
To:  dev@lucene.apache.org dev@lucene.apache.org
Subject:  MultiValued FC question

(I posted on solr-user by mistake)

I am working on https://issues.apache.org/jira/browse/SOLR-2155

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






MultiValued FC question

2011-02-13 Thread Bill Bell
(I posted on solr-user by mistake)

I am working on https://issues.apache.org/jira/browse/SOLR-2155

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