Hello All:

I am building sample code using lucene v4.8.1 to explore
the new facet API. The problem I am having is that if I pass
a populated string array nothing gets indexed while if
I pass only the first element of the string array that value gets indexed.
The code found below shows the case that works and the case that does not
work. What am I doing wrong?

****************Start of code sample*************************

void showStuff( String... va )
{
              /** This code permits out the contents of va successfully.**/
              for( int ii = 0 ; ii < va.length ; ii++ )
                      System.out.println( "value[" + ii + "] " + va[ii] );
}

                for( final Map< String, String[] > fd : allFacetData )
                {

                        final Document doc = new Document();
                        for( final Map.Entry< String, String[] > entry :
fd.entrySet() )
                        {
                                final String key = entry.getKey();
                                String[] value = entry.getValue();
                                showStuff( value );

                                /**  This call indexes successfully **/
                                final FacetField newFF = new FacetField(
key, value[0] );

                                /**
                                   * This call will not index anything if
the value String array
                                   * has more than one element.
                                   *final FacetField newFF = new
FacetField( key, value );
                                   */
                                doc.add( newFF );
                        }

                        try
                        {
                                final Document theBuildDoc =
configFacetsHandle.
build( taxoWriter, doc );
                                indexWriter.addDocument( theBuildDoc );
                                indexWriter.addDocument(
configFacetsHandle.buil
d( taxoWriter, doc ) );
                        }
                        catch( IOException ioe )
                        {
                                eMsg.append( method );
                                eMsg.append(  " failed with the exception "
);
                                eMsg.append( ioe.toString() );
                                return constantValuesInterface.FAILURE;
                        }
                }

*******************End of code sample***************

regards,

West Suhanic

Reply via email to