lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Questions about UUID type
Date Thu, 15 Jan 2009 22:31:33 GMT

1) please don't cc both solr-user and solr-dev ... if you are confused 
about how something works, or having problems, please just email 
solr-user.

2) ...

: I'm confused by the UUID type comment. It's said that
	...
: However¡¤ i found that if i don't specify the field and it will report the
: exception
: 
: org.apache.solr.common.SolrException: Document [test] missing required
: field: id

...the javadoc you quoted is correct an accurate for what that method 
does, it behaves as documented when the value passed to it is null, empty 
or "NEW".

but at a higher level you still need to supply a value for any 
required="true" field when indexing a doc ... that value can be null, or 
empty, or "NEW" but you have to provide one.  If you want solr to just 
take care of it for you, then specify a default value in your schema...

<field name="id" type="uuid" indexed="true" stored="true" default="NEW"/>

The current appraoch allwows Solr to be flexible to what the user wants...

* if you specify a default in the schema, solr won't complain if it's not 
in the input and will pass that value on to UUIDFIeld
* if you don't specify a default, you take responsibility for seinging 
some type of value for hte UUIDField to use
* regardless of where the input comes from UUIDField will do the right 
thing if the input is null, empty, or "NEW"



-Hoss
Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message