Dear all:

I'm trying to add a solr document into the solr collection. The code that I
am using is like this:

public static void addDocuments (HttpSolrServer serverCore2)
 throws SolrServerException, IOException {
 SolrInputDocument doc1 = new SolrInputDocument();
    doc1.addField( "c_noticia", "id1", 1.0f );
    doc1.addField( "c_tipo", 1, 1.0f );
    doc1.addField( "c_perfil", 10 );
    serverCore2.add( doc1 );
    serverCore2.commit();

}

However, I get next error when i execute my program:

Exception in thread "main"
org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException:
Document is missing mandatory uniqueKey field: uuid at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:402)
at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)
at
org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117)
at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:116) at
org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:102) at
SearchLucene.addDocuments(SearchLucene.java:1047) at
SearchLucene.printOr(SearchLucene.java:1030) at
SearchLucene.SearchLuciernaga(SearchLucene.java:437) at
GetResults.main(GetResults.java:482)


My schema.xml file is like this:

 <field name="c_noticia" type="string" indexed="true" stored="true" required
="true" multiValued="false" /> <field name="c_tipo" type="int" indexed=
"true" stored="true" multiValued="true"/> <field name="c_perfil" type="int"
indexed="true" stored="true" multiValued="true"/>

And the uniqueKey is like this:

<uniqueKey>c_noticia</uniqueKey>


I don't understand what is the problem here.

My uniqueKey is: c_noticia, it is not a uuid field.


Thanks a lot for some help in advance,

Silvia.














2014-03-28 11:47 GMT+01:00 Alan Woodward <a...@flax.co.uk>:

> Hi all,
>
> I have a few of questions about the context-aware AnalyzingInfixSuggester:
> - is it possible to choose a specific field for the context at runtime
> (say, I want to limit suggestions by a field that I've already faceted on),
> or is it limited to the hardcoded CONTEXTS_FIELD_NAME?
> - is the context-aware functionality exposed to Solr yet?
> - how difficult would it be to add similar functionality to the other
> suggesters, if say I only wanted to do prefix matching?
>
> Thanks,
>
> Alan Woodward
> www.flax.co.uk
>
>
>

Reply via email to