code: private Query createQuery(PriorityQueue<Object[]> q)
     {
        BooleanQuery query = new BooleanQuery();
        Object cur;
        int qterms = 0;
        float bestScore = 0;
  
        while (((cur = q.pop()) != null))
        {
           Object[] ar = (Object[])cur;
           TermQuery tq = new JcrTermQuery(new Term((String)ar[1], (String)ar[0]));
  
           if (boost)
           {
              if (qterms == 0)
              {
                 bestScore = ((Float)ar[2]).floatValue();
              }
              float myScore = ((Float)ar[2]).floatValue();
  
              tq.setBoost(myScore / bestScore);
           }
  
           try
           {
              query.add(tq, BooleanClause.Occur.SHOULD);
           }
           catch (BooleanQuery.TooManyClauses ignore)
           {
              break;
           }
  
           qterms++;
           if (maxQueryTerms > 0 && qterms >= maxQueryTerms)
           {
              break;
           }
        }
  
        return query;
     }
docs: Create the More like query from a PriorityQueue<Object[]>