[ https://issues.apache.org/jira/browse/LUCENE-7851?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16023855#comment-16023855 ]
Vesa Pirila commented on LUCENE-7851: ------------------------------------- Thank you for your clarification [~rcmuir]. My original issue is actually that I'm trying to work around the lack of maps in Solr and have "serialized" one key-value pair into each string value in the multi-valued field. I would like to find the correct key-value pair using an O(log(n)) or even an O(1) search rather than iterating over all the document's values for that field, and return the found value. What would be the best forum to seek advice for this kind of a requirement? Stack Overflow? > Lucene54DocValuesProducer#getSortedSetTable lookupTerm does not honor > setDocument > --------------------------------------------------------------------------------- > > Key: LUCENE-7851 > URL: https://issues.apache.org/jira/browse/LUCENE-7851 > Project: Lucene - Core > Issue Type: Bug > Affects Versions: 6.0.1 > Reporter: Vesa Pirila > > I'm having a problem with the lookupTerm method of the anonymous > RandomAccessOrds class returned by > Lucene54DocValuesProducer#getSortedSetTable(). It does not seem to honor > setDocument. It returns the same ord every time regardless of my calling > setDocument with different arguments. > To reproduce: > I have two documents with a multi-valued string field "strfield". Both have a > single value "a". I have a custom class that extends FieldCacheSource. This > is obviously just a dummy, but it's the simplest way I know to reproduce the > problem. > {code:java} > public class MyValueSource extends FieldCacheSource { > public MyValueSource(String field) { > super(field); > } > @Override > public FunctionValues getValues(Map map, LeafReaderContext readerContext) > throws IOException { > SortedSetDocValues dvs = DocValues.getSortedSet(readerContext.reader(), > FieldNames.PARENTS_DATES); > dvs.setDocument(0); > long zeroOrd = dvs.lookupTerm(new BytesRef("a")); > dvs.setDocument(1); > long oneOrd = dvs.lookupTerm(new BytesRef("a")); > assert(zeroOrd != oneOrd); // FAILS. The same ord is always returned. > return new LongDocValues(this) { > @Override > public long longVal(int doc) { > return 0; > } > }; > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org