EverTheLearner
EverTheLearner

Reputation: 7210

How do you configure Solr to produce a result set with most common words

I'm creating article search functionality for my application. I am looking for search functionality similar to Stackoverflow's Question creation suggestions that popup below the title textbox when you create a new Question.

Search String:

"the dog waker"

Database Rows:

"The best you can do"
"Love to your pet"
"Selina the dog walker"
"How to teach your dog to be healthy" 
"Teach your dog tricks"

I want each word in the input to make an impact on the resultset and if the input word is not found it doesn't filter out the dataset i'm searching.

I want to get this resultset:

"Selina the dog walker" - has "dog" and fuzzy searched "walker" from the input "waker"
"How to teach your dog to be healthy" - has "dog"
"Teach your dog tricks" - has "dog"

I've modified the schema.xml with the following but it doesn't seem to be working correctly. It filters out everything unless I have all of the words.

<analyzer>
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.StopFilterFactory"/>     -->    
    <filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="15" side="front"/>
</analyzer>

Upvotes: 2

Views: 199

Answers (2)

Bob Yoplait
Bob Yoplait

Reputation: 2501

Not sure about:

<filter class="solr.StopFilterFactory"/>

(btw, are you aware that you have a closing XML comment at the end of this line)

On the other hand, I know that on Solr 4, the following works:

<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt " enablePositionIncrements="true"/> 

I don't think you need:

<filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="15" side="front"/>

Finally, "Love to your pet" should not show up in the results, do you confirm that ?

Upvotes: 0

Okke Klein
Okke Klein

Reputation: 2549

Not sure what you want to do here, but I would remove EdgeNGramFilterFactory and if you want to add some fuzzyness, you can add a PhoneticFilter or use the Lucene syntax ~

Upvotes: 1

Related Questions