package com.tencent.mm.plugin.fts.b;

import android.database.Cursor;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.plugin.fts.a.a.g;
import com.tencent.mm.plugin.fts.a.a.h;
import com.tencent.mm.plugin.fts.a.a.i;
import com.tencent.mm.plugin.fts.a.a.j;
import com.tencent.mm.plugin.fts.a.a.l;
import com.tencent.mm.plugin.fts.a.a.m;
import com.tencent.mm.plugin.fts.a.n;
import com.tencent.mm.plugin.fts.c.a;
import com.tencent.mm.plugin.fts.c.c;
import java.util.ArrayList;

class c$f extends h {
    final /* synthetic */ c mGx;

    c$f(c cVar, i iVar) {
        this.mGx = cVar;
        super(iVar);
    }

    public final void a(j jVar) {
        AppMethodBeat.i(136756);
        Ng("start");
        jVar.mDz = g.a(this.mEl.query, false, this.mGx.mGw);
        c cVar = this.mGx.mGp;
        g gVar = jVar.mDz;
        String str = this.mEl.mEp;
        String bAl = gVar.bAl();
        bAl = String.format("SELECT %s.docid, type, subtype, entity_id, aux_index, timestamp, talker FROM %s JOIN %s ON (%s.docid = %s.rowid) WHERE %s MATCH '%s' AND aux_index = ? AND status >= 0 ORDER BY timestamp desc;", new Object[]{cVar.bAf(), cVar.bAf(), cVar.bAg(), cVar.bAf(), cVar.bAg(), cVar.bAg(), bAl});
        Cursor rawQuery = cVar.mBT.rawQuery(bAl, new String[]{str});
        jVar.mEy = new ArrayList();
        while (rawQuery.moveToNext()) {
            jVar.mEy.add(new m().i(rawQuery));
        }
        rawQuery.close();
        Ng("findConversationMessage");
        if (jVar.mDz.mEb.length > 1 && !this.mEl.mEu.contains("create_talker_message​")) {
            rawQuery = ((a) ((n) com.tencent.mm.kernel.g.M(n.class)).getFTSIndexStorage(3)).a(g.aO(jVar.mDz.mEb[0], true), null, com.tencent.mm.plugin.fts.a.c.mCl, com.tencent.mm.plugin.fts.a.c.mCp);
            if (rawQuery.moveToNext()) {
                l lVar = new l();
                lVar.mDx = "create_talker_message​";
                jVar.mEy.add(0, lVar);
            }
            rawQuery.close();
            Ng("findTalkerConversation");
        }
        AppMethodBeat.o(136756);
    }

    public final String getName() {
        return "SearchConversationMessageTask";
    }

    public final int getId() {
        return 14;
    }
}
