Re: How to implement Auto complete, suggestion client side
Hi, Thank you Dan Davis and Alexandre Rafalovitch. This is very helpful for me. Regards Olivier 2015-01-27 0:51 GMT+01:00 Alexandre Rafalovitch arafa...@gmail.com: You've got a lot of options depending on what you want. But since you seem to just want _an_ example, you can use mine from http://www.solr-start.com/javadoc/solr-lucene/index.html (gray search box there). You can see the source for the test screen (using Spring Boot and Spring Data Solr as a middle-layer) and Select2 for the UI at: https://github.com/arafalov/Solr-Javadoc/tree/master/SearchServer. The Solr definition is at: https://github.com/arafalov/Solr-Javadoc/tree/master/JavadocIndex/JavadocCollection/conf Other implementation pieces are in that (and another) public repository as well, but it's all in Java. You'll probably want to do something similar in PHP. Regards, Alex. Sign up for my Solr resources newsletter at http://www.solr-start.com/ On 26 January 2015 at 17:11, Olivier Austina olivier.aust...@gmail.com wrote: Hi All, I would say I am new to web technology. I would like to implement auto complete/suggestion in the user search box as the user type in the search box (like Google for example). I am using Solr as database. Basically I am familiar with Solr and I can formulate suggestion queries. But now I don't know how to implement suggestion in the User Interface. Which technologies should I need. The website is in PHP. Any suggestions, examples, basic tutorial is welcome. Thank you. Regards Olivier
Re: How to implement Auto complete, suggestion client side
You've got a lot of options depending on what you want. But since you seem to just want _an_ example, you can use mine from http://www.solr-start.com/javadoc/solr-lucene/index.html (gray search box there). You can see the source for the test screen (using Spring Boot and Spring Data Solr as a middle-layer) and Select2 for the UI at: https://github.com/arafalov/Solr-Javadoc/tree/master/SearchServer. The Solr definition is at: https://github.com/arafalov/Solr-Javadoc/tree/master/JavadocIndex/JavadocCollection/conf Other implementation pieces are in that (and another) public repository as well, but it's all in Java. You'll probably want to do something similar in PHP. Regards, Alex. Sign up for my Solr resources newsletter at http://www.solr-start.com/ On 26 January 2015 at 17:11, Olivier Austina olivier.aust...@gmail.com wrote: Hi All, I would say I am new to web technology. I would like to implement auto complete/suggestion in the user search box as the user type in the search box (like Google for example). I am using Solr as database. Basically I am familiar with Solr and I can formulate suggestion queries. But now I don't know how to implement suggestion in the User Interface. Which technologies should I need. The website is in PHP. Any suggestions, examples, basic tutorial is welcome. Thank you. Regards Olivier
Re: How to implement Auto complete, suggestion client side
Cannot get any easier than jquery-ui's autocomplete widget - http://jqueryui.com/autocomplete/ Basically, you set some classes and implement a javascript that calls the server to get the autocomplete data. I never would expose Solr to browsers, so I would have the AJAX call go to a php script (or function/method if you are using a web framework such as CakePHP or Symfony). Then, on the server, you make a request to Solr /suggest or /spell with wt=json, and then you reformulate this into a simple JSON response that is a simple array of options. You can do this in stages: - Constant suggestions - you change your html and implement Javascript that shows constant suggestions after for instance 2 seconds. - Constant suggestions from the server - you change your JavaScript to call the server, and have the server return a constant list. - Dynamic suggestions from the server - you implement the server-side to query Solr and turn the return from /suggest or /spell into a JSON array. - Tuning, tuning, tuning - you work hard on tuning it so that you get high quality suggestions for a wide variety of inputs. Note that the autocomplete I've described for you is basically the simplest thing possible, as you suggest you are new to it. It is not based on data mining of query and click-through logs, which is a very common pattern these days. There is no bolding of the portion of the words that are new. It is just a basic autocomplete widget with a delay. On Mon, Jan 26, 2015 at 5:11 PM, Olivier Austina olivier.aust...@gmail.com wrote: Hi All, I would say I am new to web technology. I would like to implement auto complete/suggestion in the user search box as the user type in the search box (like Google for example). I am using Solr as database. Basically I am familiar with Solr and I can formulate suggestion queries. But now I don't know how to implement suggestion in the User Interface. Which technologies should I need. The website is in PHP. Any suggestions, examples, basic tutorial is welcome. Thank you. Regards Olivier