Hi Tomas,
first consideration :
an empty string is different from a NULL string.
This is controversial, I would suggest you to never use the empty String as
this can cause some others side effect.
Apart from that, the plugin will add the class only if the class field is
without any value

> Object documentClass = doc.getFieldValue(classFieldName);
> if (documentClass == null) {
>
> Saying that, I would suggest you to build a sample index with some
document and then try to classify.
If this doesn't solve your issue, I can help you further.

Cheers

On Wed, Jun 22, 2016 at 3:45 PM, Tomas Ramanauskas <
tomas.ramanaus...@springer.com> wrote:

> I also tried this configuration, but could get the feature to work:
>
>
>
>   <initParams path="/update/">
>     <lst name="defaults">
>       <str name="update.chain">classification</str>
>     </lst>
>   </initParams>
>
>
>   <updateRequestProcessorChain name="classification">
>     <processor class="solr.ClassificationUpdateProcessorFactory">
>       <str name="inputFields">title_t,author_s</str>
>       <str name="classField">cat_s</str>
>       <str name="algorithm">bayes</str>
>     </processor>
>   </updateRequestProcessorChain>
>
>
> Tomas
>
> On 22 Jun 2016, at 13:46, Tomas Ramanauskas <
> tomas.ramanaus...@springer.com<mailto:tomas.ramanaus...@springer.com>>
> wrote:
>
> P.S. The version I use:
>
> 6.1.0-68
>
> Also, earlier I said “If I modify an existing record, I think the
> functionality works:”, but I think it doesn’t work for me at all.
>
> $ curl http://localhost:8983/solr/demo/get?id=book1
> {
>   "doc":
>   {
>     "id":"book1",
>     "title_t":["The Way of Kings"],
>     "author_s":"Brandon Sanderson",
>     "cat_s":"fantasy",
>     "pubyear_i":2010,
>     "ISBN_s":"978-0-7653-2635-5",
>     "_version_":1535488016326328320}}
>
> $ curl http://localhost:8983/solr/demo/update -d '
> [
> {"id" : "book1",
> "title_t":["The Way of Kings"],
> "author_s":"Brandon Sanderson",
> "cat_s":"aaa",
> "pubyear_i":2010,
> "ISBN_s":"978-0-7653-2635-5"
> }
> ]'
> {"responseHeader":{"status":0,"QTime":0}}
>
> $ curl http://localhost:8983/solr/demo/get?id=book1
> {
>   "doc":
>   {
>     "id":"book1",
>     "title_t":["The Way of Kings"],
>     "author_s":"Brandon Sanderson",
>     "cat_s":"fantasy",
>     "pubyear_i":2010,
>     "ISBN_s":"978-0-7653-2635-5",
>     "_version_":1535488016326328320}}
>
>
> Tomas
>
>
> On 22 Jun 2016, at 12:47, Tomas Ramanauskas <
> tomas.ramanaus...@springer.com<mailto:tomas.ramanaus...@springer.com>>
> wrote:
>
> Hi, everyone,
>
>
> would someone be able to share a working example (step by step) that
> demonstrates the use of Naive Bayes classifier in Solr?
>
>
> I followed this Blog post:
>
> https://alexbenedetti.blogspot.co.uk/2015/07/solr-document-classification-part-1.html?showComment=1464358093048#c2489902302085000947
>
> And this tutorial:
> http://yonik.com/solr-tutorial/
>
> And this JIRA ticket:
> https://issues.apache.org/jira/browse/SOLR-7739
>
>
>
> So this is my configuration file (only what I added or modified):
>
>   <initParams path="/update/**">
>     <lst name="defaults">
>       <str name="update.chain">classification</str>
>     </lst>
>   </initParams>
>
>
>   <updateRequestProcessorChain name="classification">
>     <processor class="solr.ClassificationUpdateProcessorFactory">
>       <str name="inputFields">title_t,author_s</str>
>       <str name="classField">cat_s</str>
>       <str name="algorithm">bayes</str>
>     </processor>
>   </updateRequestProcessorChain>
>
>
>
> If I modify an existing record, I think the functionality works:
>
>
> $ curl http://localhost:8983/solr/demo/update -d '
> [
> {"id" : "book1",
> "title_t":["The Way of Kings"],
> "author_s":"Brandon Sanderson",
> "cat_s":"",
> "pubyear_i":2010,
> "ISBN_s":"978-0-7653-2635-5"
> }
> ]'
> {"responseHeader":{"status":0,"QTime":8}}
> $ curl http://localhost:8983/solr/demo/get?id=book1
> {
>   "doc":
>   {
>     "id":"book1",
>     "title_t":["The Way of Kings"],
>     "author_s":"Brandon Sanderson",
>     "cat_s":"fantasy",
>     "pubyear_i":2010,
>     "ISBN_s":"978-0-7653-2635-5",
>     "_version_":1535488016326328320}}
>
>
>
>
> If I add a new document, something isn’t quite working:
>
> $ curl http://localhost:8983/solr/demo/update -d '
> [
> {"id" : "book7",
> "title_t":["The Way of Kings"],
> "author_s":"Brandon Sanderson",
> "cat_s":"",
> "pubyear_i":2010,
> "ISBN_s":"978-0-7653-2635-5"
> }
> ]'
> {"responseHeader":{"status":0,"QTime":0}}
> $ curl http://localhost:8983/solr/demo/get?id=book7
> {
>   "doc":null}
>
>
>
>
>
>
>


-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Reply via email to