Archive for the 'Search' Category


Functional Programming and Lucene Query Expansion

Monday, January 17th, 2005

Last week I had a programming problem, I had to do a query expansion in Lucene. This particular expansion was to convert term and phrase queries into span queries to provide higher relevancy scores for results when the search terms were closer together.

I simplified the problem by only considering terms and phrases and boolean combinations of them. Basically:

BooleanQueries would be handled recursive following the above convention. A BooleanQuery is essentially a list of BooleanClauses, so at this point those functional programming classes from school popped in my head. I have lists, recursion, base cases, it should be straightforward to jot down a solution in Haskell then I’ll translate it to Java. After a while I gave up and wrote a long piece of procedural code in Java, I just didn’t know Haskell well enough to write out anything more than trivial code.

Read the rest of this entry »

Spread the word: Technorati related  |  del.icio.us bookmark it!  |  submit Functional Programming and Lucene Query Expansion digg.com digg it!  |  reddit reddit!