Ok now I have successfully install solr and index by database with following structure : DB_NAME - solr, Table - users
my db-data-config.xml file :
<dataConfig>
<dataSource type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/solr"
user="root"
password="" />
<document>
<entity name="users" query="select id,name from users;" />
<field column="ID" name="id" />
<field column="NAME" name="name" />
</document>
</dataConfig>
Which returns rows of database table users.
Problem 1 :
But what should I do if I want to search like 'Rakesh Shetty' and it should return result "Rakesh Vasant Shetty" ?
I have tried <entity name="users" query="select id,name from users where name like '%Rakesh Shetty%' ;" />
but it returns empty result.
Problem 2 :
Also, how can I make this search query dynamic ? I mean there will be a form with search textbox and it should query to solr ? I am using php and solr 5.1.0.
Thanks in advance.