Hi,

On Tue, Jul 30, 2013 at 4:09 PM, andi rexha <a_re...@hotmail.com> wrote:
> Hi, I have a stored and tokenized field, and I want to cache all the field 
> values.
>
> I have one document in the index, with the  "field.value"  =>   "hello world" 
>   and with tokens   => "hello", "world".
> I try to extract the fields content :
> String [] cachedFields  =  FieldCache.DEFAULT.getStrings(reader, 
> field.getName());
>
> The content of the cachedFields array is ["hello"].
>
> When I try to index other documents, I get also "null" as the value of the 
> field.
>
> Can somebody help me with that?

Lucene 3.6's field cache was created for sorting on single-valued
fields, this is why it only stores one token per field per document
and isn't suitable for multi-valued fields.

If you need such an API for multi-valued fields, I recommend upgrading
to Lucene 4 and using SortedSetDocValues[1].

[1] 
http://lucene.apache.org/core/4_4_0/core/org/apache/lucene/index/AtomicReader.html#getSortedSetDocValues%28java.lang.String%29

-- 
Adrien

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

Reply via email to