<div dir="ltr"><div>Good day devs,<br><br></div><div>Nick spotted these one during last Marseille Hackfest. We made some test with our catalogue on master and find out how to reproduce it, how to break it and how to fix it, though the inner mechanics remains a mystery and we are not quite sure about what the default behaviour should be.<br></div><div><div><br>We did our test with 中國翻譯 (Chinese Translators Journal) which have two words highly present in our Catalog: China and translation.<br><br>First, the default Koha behaviour is to add a "*" at the end of the searched word, which lead to 0 results. It produces a query looking like this one:<br><br>$ curl  "<a href="http://localhost:9200/koha_robin_biblios/_search?pretty">http://localhost:9200/koha_robin_biblios/_search?pretty</a>" -d '{"from": 0, "size": 0,"query":{"query_string":{"query": "中國翻譯*"}}}'<br>{<br>  "took" : 1,<br>  "timed_out" : false,<br>  "_shards" : {<br>    "total" : 5,<br>    "successful" : 5,<br>    "skipped" : 0,<br>    "failed" : 0<br>  },<br>  "hits" : {<br>    "total" : 0,<br>    "max_score" : 0.0,<br>    "hits" : [ ]<br>  }<br>}<br><br>If we quote 中國翻譯 in Koha, it yields one answer, the right one. It produces a query looking like this one:<br><br>$ curl  "<a href="http://bouse02.prive.bulac.fr:9200/koha_robin_biblios/_search?pretty">http://bouse02.prive.bulac.fr:9200/koha_robin_biblios/_search?pretty</a>" -d '{"from": 0, "size": 0,"query":{"query_string":{"query": "\"中國翻譯\""}}}'<br>{<br>  "took" : 5,<br>  "timed_out" : false,<br>  "_shards" : {<br>    "total" : 5,<br>    "successful" : 5,<br>    "skipped" : 0,<br>    "failed" : 0<br>  },<br>  "hits" : {<br>    "total" : 1,<br>    "max_score" : 0.0,<br>    "hits" : [ ]<br>  }<br>}<br><br>Note that if I write an Elasticsearch query without quotes or star, it yields too much results (9626), the “right” result isn't in the ten first results:<br><br>$ curl  "<a href="http://bouse02.prive.bulac.fr:9200/koha_robin_biblios/_search?pretty">http://bouse02.prive.bulac.fr:9200/koha_robin_biblios/_search?pretty</a>" -d '{"from": 0, "size": 0,"query":{"query_string":{"query": "中國翻譯"}}}'<br>{<br>  "took" : 16,<br>  "timed_out" : false,<br>  "_shards" : {<br>    "total" : 5,<br>    "successful" : 5,<br>    "skipped" : 0,<br>    "failed" : 0<br>  },<br>  "hits" : {<br>    "total" : 9626,<br>    "max_score" : 0.0,<br>    "hits" : [ ]<br>  }<br>}<br><br><br>I'm not sure what the right behaviour needs to be. We felt adding quotes added a lot of relevance to our results no matter what the language is. What is certain is that adding a star to the search by default doesn't help us. We didn't have the problem with Elasticsearch while playing with it in 17.05. For us, it is a regression. I add the MARC of our test record.<br><br></div><div>What do you think about it?<br><br></div><div>Best regards,<br clear="all"></div><div><br>-- <br><div class="gmail_signature"><div>
        <br>
        <span style="font-family: courier\ new, courier, monospace;"><b>Nicolas Legrand</b></span></div>
<div>
        <span style="font-family: courier\ new, courier, monospace;">Administration technique et développements du système de gestion de la bibliothèque</span></div>
<br>
<div>
        <span style="font-family: courier\ new, courier, monospace;"><img alt="Logo BULAC" src="http://www.bulac.fr/a/img/logo-bulac-mail.png" style="width: 200px; height: 60px;"></span></div>
<div>
         </div>
<div>
        <span style="color:rgb(255,94,14)"><span><span style="font-family: courier\ new, courier, monospace;">Bibliothèque universitaire </span></span></span></div>
<div>
        <span style="color:rgb(255,94,14)"><span><span style="font-family: courier\ new, courier, monospace;">des langues et civilisations</span></span></span><br>
         </div>
<div>
        <span style="font-family: courier\ new, courier, monospace;">65 rue des Grands Moulins</span></div>
<div>
        <span style="font-family: courier\ new, courier, monospace;">F-75013 PARIS</span></div>
<div>
        <span style="font-family: courier\ new, courier, monospace;">T +33 1 81 69 <b>18 22</b></span></div>
<div>
        <a href="http://www.bulac.fr" target="_blank">www.bulac.fr</a></div></div>
</div></div></div>