public Query rewrite(IndexReader reader) throws IOException {
        MoreLikeThis more = new MoreLikeThis(reader);
        more.setAnalyzer(analyzer);
        more.setFieldNames(new String[]{FieldNames.FULLTEXT});
        more.setMinWordLen(4);
        Query similarityQuery = null;
        TermDocs td = reader.termDocs(new Term(FieldNames.UUID, uuid));
        try {
            if (td.next()) {
                similarityQuery = more.like(td.doc());
            }
        } finally {
            td.close();
        }
        if (similarityQuery != null) {
            return similarityQuery.rewrite(reader);
        } else {
            // return dummy query that never matches
            return new BooleanQuery();
        }
    }
public Query rewrite ( IndexReader reader ) throws IOException { MoreLikeThis more = new MoreLikeThis ( reader ) ; more . setAnalyzer ( analyzer ) ; more . setFieldNames ( new String [ ] { FieldNames . FULLTEXT } ) ; more . setMinWordLen ( 4 ) ; Query similarityQuery = null ; TermDocs td = reader . termDocs ( new Term ( FieldNames . UUID , uuid ) ) ; try { if ( td . next ( ) ) { similarityQuery = more . like ( td . doc ( ) ) ; } } finally { td . close ( ) ; } if ( similarityQuery != null ) { return similarityQuery . rewrite ( reader ) ; } else { return new BooleanQuery ( ) ; } }
{@inheritDoc}