1
votes

So , i just started using Lucene.Net , i must say its great framework for Full-Text-Search but i am bit lost while devising a strategy for search from the online e-commerce portal.

It's a typical scenario

1- User enters a query in the magical search Box " Man Black T-Shirts under $ 50 "

its a well known case for the NLP like query and i did a lot of research and found there is no .net port available for Lucene.Net.

Now , my question is how do i formulate a Query for the above user query and submit it to the Lucene to return some meaning full result?

Where to start, With TermQuery , BooleanQuery , phraseQuery , what should be the search strategy with lucene.net for a e-commerce product site?

Please advice?

1

1 Answers

0
votes

The simplest way of taking user input is to parse it with one of the provided QueryParsers found in Lucene.Net.QueryParsers.

This will at least break down the phrase they have entered into something that will do a proper search against the index.

From this you will get a Query object. You can then combine that further with additional criteria such as attribute queries like "Black" on other fields (TermQuery), or range queries (NumericRangeQuery). These can then be combined together in a BooleanQuery.

If you are after actually converting the under $50 in the phrase to a range query then you could try parse these phrases yourself (not an easy task), but I'm not aware of any lucene features/contribs that would do this out of the box for you.

I pre-process the user input to do term replacements on it and to calculate synonyms from the wordnet database myself.