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}





Reply via email to