来自sqlite fts3 unionQuery的结果不正确且重复

来自sqlite fts3 unionQuery的结果不正确且重复,sqlite,fts3,Sqlite,Fts3,我从我的rawQuery中得到的结果是重复的,并且遵循OR逻辑,而不是and逻辑,也就是说,当我只想要同时包含“tuxedo”和“hotel”的条目时,我将获得所有包含“tuxedo”的条目 这是我的方法: public ArrayList<Integer> getAdvancedResultIDList(String[] search) { ArrayList<String> queryList = new ArrayList<String>();

我从我的rawQuery中得到的结果是重复的,并且遵循OR逻辑,而不是and逻辑,也就是说,当我只想要同时包含“tuxedo”和“hotel”的条目时,我将获得所有包含“tuxedo”的条目

这是我的方法:

public ArrayList<Integer> getAdvancedResultIDList(String[] search)
{
    ArrayList<String> queryList = new ArrayList<String>();
    ArrayList<Integer> resultsList = new ArrayList<Integer>();
    SQLiteQueryBuilder builder = new SQLiteQueryBuilder();
    this.mDB = GamesList.mDBHelper.getDatabase();
    Cursor searchCursor = null;
    try
    {
        //TODO:
        // for each string in the search array search the whole of searchable table. Check that the results are only of the values that 
        // contain all the search strings, and add the id of that row to the results ArrayList
        for(int i = 0; i < search.length; i++)
        {
            String query;
            String s = '"' + search[i] + '"';
            query = "SELECT " + KEY_ID + " FROM "+ SEARCHABLE_TABLE + " WHERE " + SEARCHABLE_TABLE + " MATCH " + s;
            queryList.add(query);
        }

        String[] queryArray = queryList.toArray(new String[queryList.size()]);


        String unionQuery = builder.buildUnionQuery(queryArray, KEY_ID + " ASC", null);

        searchCursor = this.mDB.rawQuery(unionQuery, null);

        int colId = searchCursor.getColumnIndex(KEY_ID);

        String resultID;

        for(searchCursor.moveToFirst(); !searchCursor.isAfterLast();searchCursor.moveToNext())
        {
            resultID = searchCursor.getString(colId);
            Integer Id = Integer.parseInt(searchCursor.getString(colId));
            resultsList.add(Id);

        }
        searchCursor.close();

    }
    catch(Exception e)
    {
        e.printStackTrace();
    }
    finally
    {
        try
        {
            this.mDB.close();

        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
    return resultsList;
}
public ArrayList getAdvancedResultId列表(字符串[]搜索)
{
ArrayList queryList=新的ArrayList();
ArrayList resultsList=新建ArrayList();
SQLiteQueryBuilder=新SQLiteQueryBuilder();
this.mDB=GamesList.mDBHelper.getDatabase();
游标搜索游标=null;
尝试
{
//待办事项:
//对于搜索数组中的每个字符串,搜索整个可搜索表。检查结果是否仅为
//包含所有搜索字符串,并将该行的id添加到结果ArrayList
for(int i=0;i
提前感谢,新年快乐

说明了如何使用多个搜索词:

SELECT id FROM searchTable WHERE searchTable MATCH 'tuxedo hotel'

很好,谢谢。我和工会的事走上了死胡同:-/