never_had_a_name
never_had_a_name

Reputation: 93206

Match a word with similar words using Solr?

I want to search for threads in my mysql database with Solr.

But i want it to not just search the thread words, but for similar words.

Eg. if a thread title is "dog for sale" and if the user searches for dogs the title will be in the result.

and also if a user searches for "mac os x" the word "snow leopard" will appear.

and the ability to link words the application thinks is related eg. house and apartment.

how is this kind of logic done?

i know that you can with solr look up words in a dictionary file you create/add, so solr will look for dogs and see what related words there are (eg. dog).

but where do you find such a dictionary?

i have no idea about this kind of implementation.

please point me into right direction.

thanks

Upvotes: 2

Views: 1826

Answers (2)

Karussell
Karussell

Reputation: 17375

You could use the synonym.txt file and create your own dictionary.

Another option for you could be fuzzy search.

Upvotes: 1

Mauricio Scheffer
Mauricio Scheffer

Reputation: 99730

I think you'll have to build such a dictionary yourself, since it's very application-specific. "House" and "Apartment" might be similar terms for your application but very distant in another application.

Once you have this dictionary you can use it through the SynonymFilterFactory.

Matching "dog" when the user searches for "dogs" is managed by the stemmer and doesn't require any dictionary.

Upvotes: 2

Related Questions