I want to implement spell check functionality offerd by solr using MySql
database, but I dont understand how.
Here the basic flow of what I want to do.

I have a simple inputText (in jsf) and if I type the word shwo the response
to OutputLabel should be show.

First of all I'm using the following tools and frameworks:

JBoss application server 6.1.
Eclipse
JPA
JSF(Primefaces)

Steps I've done until now:

Step 1: Download solr server from:
http://lucene.apache.org/solr/downloads.html Extract content.

Step 2: Add to Envoierment variable:

Variable name: solr.solr.home Variable value :
D:\JBOSS\solr-4.4.0\solr-4.4.0\example\solr --- where you have the solr
server

Step 3:

Open solr war and to solr.war\WEB-INF\web.xml add env-entry - (the easy way)

solr/home D:\JBOSS\solr-4.4.0\solr-4.4.0\example\solr java.lang.String

OR import project change and bulid war.

Step 4: Browser: localhost:8080/solr/

And the solr console appears.

Until now all works well.

I have found some usefull code (my opinion) that returns:

    [collection1] webapp=/solr path=/spell
params={spellcheck=on&q=whatever&wt=javabin&qt=/spell&version=2&spellcheck.build=true}
hits=0 status=0 QTime=16

Here is the code that gives the result from above:

SolrServer solr;
    try {
        solr = new CommonsHttpSolrServer("http://localhost:8080/solr";);

    ModifiableSolrParams params = new ModifiableSolrParams();
    params.set("qt", "/spell");
    params.set("q", "whatever");
    params.set("spellcheck", "on");
    params.set("spellcheck.build", "true");

    QueryResponse response = solr.query(params);
    SpellCheckResponse spellCheckResponse =
response.getSpellCheckResponse();
    if (!spellCheckResponse.isCorrectlySpelled()) {
        for (Suggestion suggestion :
response.getSpellCheckResponse().getSuggestions()) {
           System.out.println("original token: " + suggestion.getToken() + "
- alternatives: " + suggestion.getAlternatives());
        }
    }
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

Questions:

1.How do I make the database connection whit my DB and search the content to
see if there are any words that could match?
2.How do I make the configuration.(solr-config.xml,shema.xml...etc)?
3.How do I send a string from my view(xhtml) so that the solr server knows
what he looks for?

I read all the information about solr but it's still unclear:

Links:Main Page:
http://lucene.apache.org/solr/

Main Page tutorial: http://lucene.apache.org/solr/4_4_0/tutorial.html

Solr Wiki:
http://wiki.apache.org/solr/Solrj --- official solrj documentation
http://wiki.apache.org/solr/SpellCheckComponent

Solr config: http://wiki.apache.org/solr/SolrConfigXml
http://www.installationpage.com/solr/solr-configuration-tutorial-schema-solrconfig-xml/
http://wiki.apache.org/solr/SchemaXml

StackOverflow proof: Solr Did you mean (Spell check component)

Solr Database Integration:
http://www.slideshare.net/th0masr/integrating-the-solr-search-engine
http://www.cabotsolutions.com/2009/05/using-solr-lucene-for-full-text-search-with-mysql-db/

Solr Spell Check:
http://docs.lucidworks.com/display/solr/Spell+Checking
http://searchhub.org/2010/08/31/getting-started-spell-checking-with-apache-lucene-and-solr/
http://techiesinsight.blogspot.ro/2012/06/using-solr-spellchecker-from-java.html
http://blog.websolr.com/post/2748574298/spellcheck-with-solr-spellcheckcomponent
How to use SpellingResult class in SolrJ

I really need your help.Regards.




--
View this message in context: 
http://lucene.472066.n3.nabble.com/How-to-config-SOLR-server-for-spell-check-functionality-tp4088163.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to