0

I have a product catalog which I am indexing in ElasticSearch using the Elastica client.

While implementing search, I was appending * after the typed search terms so that when one types whis or whisk he will already start seeing search results for whisky.

But I want to show results for poster when one types posters as well.

I was able to achieve the plural to singular result using snowball filter. But for that to work, I have to remove *.

This is bad because there are no results to show until a full word is entered.

Any ideas how I can go about this? My analyzer code: (taken from here)

'analysis' => array(
    'analyzer' => array(
        'indexAnalyzer' => array(
            'type' => 'custom',
            'tokenizer' => 'whitespace',
            'filter' => array('lowercase', 'mySnowball')
        ),
        'searchAnalyzer' => array(
            'type' => 'custom',
            'tokenizer' => 'whitespace',
            'filter' => array('lowercase', 'mySnowball')
        )
    ),
    'filter' => array(
        'mySnowball' => array(
            'type' => 'snowball',
            'language' => 'English'
        )
    )
)
Hitesh
  • 330
  • 1
  • 4
  • 10

1 Answers1

0

I went with custom functionality.

I search with the exact search phrase without *. My code looks for result count. If it's an incomplete word, it will probably return a null result. So I append a * to the result query and do another search.

This makes my auto-suggest results slower, but functional.

Hitesh
  • 330
  • 1
  • 4
  • 10