Downloads Autcomplete like Google/Yahoo/Bing (Give it a try) (Free/Paid version))
- Download Autocomplete Free version (Free)
- Download Autocomplete $9.99 version
- Download demo 1m Wikipedia and MBArtists xml files
Installation Steps
Search tier:
Solr with RankingAlgorithm
1. Download and install Apache Solr with RankingAlgorithm – #downloads
( Has the demos, 1m wikipedia and 390k mbartists index)
2. Change to example directory and run start_solr.sh
3. Access from a browser, http://search_ipaddress:8983/solr/wikipedia/select/?q=ac_field:”san+fran”&rows=15&wt=json&indent=true
(If this works, your Solr with RankingAlgorithm installation is working properly)
Note: You can edit the schema wikipedia index or the mbartists to make your own. You can access the schema under multicore/wikipedia.
Web tier:
Scripts
1. Copy the example/autocomplete/search_ac.jsp (java web server like tomcat/jetty/glassfish) or example/autocomplete/search_ac.php (apache web server) to your web application document root directory
2. Edit the script and change the searchhost in the URL to your search host ip address or host name or add searchhost in /etc/hosts. Change the core context from “wikipedia” to your context as needed.
Client tier
<script src="javascripts/jquery.1.6.8/jquery.js"></script>
<script type='text/javascript' src='javascripts/jquery.autocomplete_solr-ra.js'></script>
<script>
$("#ac1").autocomplete("/search_ac.jsp",
{
minChars:1,
width:350,
scroll:true,
scrollHeight:200
});
</script>
<style>
.ac_results {
padding: 0px;
border: 1px solid black;
background-color: white;
overflow: hidden;
z-index: 99999;
}
.ac_results ul {
width: 100%;
list-style-position: outside;
list-style: none;
padding: 0;
margin: 0;
}
.ac_results li {
margin: 0px;
padding: 2px 5px;
cursor: default;
display: block;
/*
if width will be 100% horizontal scrollbar will apear
when scroll mode will be used
*/
/*width: 100%;*/
font: menu;
font-size: 12px;
/*
it is very important, if line-height not setted or setted
in relative units scroll will be broken in firefox
*/
line-height: 16px;
overflow: hidden;
}
.ac_loading {
background: white url('indicator.gif') right center no-repeat;
}
.ac_odd {
border-bottom:1px dotted #cccccc;
}
.ac_even {
border-bottom:1px dotted #cccccc;
}
.ac_over {
background-color: #0A246A;
color: white;
}
</style>
4. Add a input field to your html file
<INPUT id=ac1 TYPE="TEXT" class=nobold12 size=45 NAME="from" maxlength="90" VALUE='' >
(see autocomplete demo.html from here:
http://solr-ra.tgels.org/demo_autocomplete.html)
Note: ac1 the id of the input field should be the same as the ac1 in the jquery script above.
If you have installed everything correctly autocomplete should be working now. Type a few characters like “san fra” and it should pull cities starting with “san fra”.
Note:
For Apache/PHP web tier:
1. You will need PHP with Pear/PECL extension (HTTP_Request2)
You can install php/Pear-PECL as follows on fedora:
yum install php
yum install php-pear
pear install HTTP_Request2