Hello:

>What do you mean by does not index anything?

When I do a search the value returned for the "dim" set to "Publish Date"
is null. If I pass through value[0] the publish date year is returned by
the search.

setHierarchical was called.

When a String[] with more than one element is passed an exception is not
thrown.

I am open to all suggestions as to what I am missing.

regards,

west suhanic


On Sun, Jun 22, 2014 at 3:23 AM, Shai Erera <ser...@gmail.com> wrote:

> What do you mean by does not index anything? Do you get an exception when
> you add a String[] with more than one element?
>
> You should probably call conf.setHierarchical(dimension), but if you don't
> do that you should receive an IllegalArgumentException telling you to do
> that...
>
> Shai
>
>
> On Sun, Jun 22, 2014 at 6:34 AM, west suhanic <west.suha...@gmail.com>
> wrote:
>
>> 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