0

I am integrating solr with liferay and I want implement smart next word suggester. for eg if title of my documents are following:

  • Solr is best search engine in world
  • Solr is implemented on lucene search engine
  • Solr are lucene used by 80% of developers as search engine in world
  • lucene doesn't require separate installation on app server for make search implementation

So if I type Solr, I should get following result :

  1. solr
  2. solr lucene
  3. Solr search
  4. solr engine
  5. solr world

etc.

if I type lucene, I should get following result :

  1. lucene
  2. lucene search
  3. lucene engine
  4. lucene world

etc.

I tried lots of example and they works but I am facing following problems:

  • Suggestions work if I start from prefix Solr, If I start typing any middle word, it doesn't work
  • I am getting complete sentence not next best matching word.

Please help. Thanks in advance :)

yadavjpr
  • 36
  • 5

2 Answers2

0

You can build "most popular other words" for the field by using facets. Ignore the facet with the same name as the word you're searching for and add a fq with the word (to limit it to the subset of documents that matches your word). Do this for each word you're searching for (i.e. ignore solr in the facet list generated and add fq=title:solr to the query).

Next step would be fq=title:solr AND title:lucene and skip solr and lucene in the list of facets.

This assumes that you're tokenizing your field approriately (with the StandardTokenizer or WhitespaceTokenizer for example) so you get one token for each word.

MatsLindh
  • 49,529
  • 4
  • 53
  • 84
0

AnalyzingInfixLookupFactory will give you suggestions if you type the middle word as well, hope that answers your first question

Anusha
  • 647
  • 11
  • 29