Search code examples
c#lucenesolrnetfuzzy-search

SolrNet Fuzzy Search More Than One Word


I am newbie on Solr and i want to full text search with SolrNet. So i used to MySql Full text search before and it is very slowly. I found Solr solution. This is very fast and scalability. But i can't fuzzy search in Solr. How can i do this? My examples and goals below. Excuse my badly english and thank you for advices.

I can fuzzy search but with one word (article): For Example:

var solr = ServiceLocator.Current.GetInstance<ISolrOperations<Article>>();
List<Article> search = solr.Query(new SolrQuery("segsource:article~") ).Cast<Article>().ToList();

But i want to search more than a word (article name, bla bla bla - just like >

mysql> SELECT * FROM articles WHERE MATCH (title,body)
    -> AGAINST ('more than one word bla bla bla');

). For example

var solr = ServiceLocator.Current.GetInstance<ISolrOperations<Article>>();
List<Article> search = solr.Query(new SolrQuery("segsource:article name ~") ).Cast<Article>().ToList();

Solution

  • I'll see if there's a nicer way to do this, but in the meantime the following worked for me.

    segsource:(article~ name~)

    IE, you'd have to split the query on spaces and rejoin them inserting the tilda on each.