title: Using wordnet synonyms to expand a query in Lucene 4.2 version
body: <p>I am using Lucene 4.2 and would like to know how wordnet can be used to expand an input query for this version of Lucene. Basically, if my query is like</p>
  
  <pre><code>term_1 AND term_2 OR term_3
  </code></pre>
  
  <p>I would like it to be expanded as</p>
  
  <pre><code>(term_1 OR term_1syn_1 OR term_1syn_2) AND (term_2 OR term_2syn_1) OR (term_3 OR term_3syn_1)
  </code></pre>
  
  <p>and so on.</p>
  
  <p>I looked at other answers on StackoverFlow for this kind of question, but none of them have any sample implementation.</p>
  
  <p>Given an input query in form of a string, how can I expand it using the WordNetQueryParser and SynonymMap classes?</p>
  
  <p>I have already downloaded the wordnet prolog file and I know that the _s.pl file has all the synonyms.</p>
  
  <p>Any sample code would be highly appreciated.</p>