searchとsearch_engの2 つのFTSテーブルがあります。search_engから一致した単語のentry_idを取得しようとしています。次に、それらのentry_idに従って検索から値を取得します。しかし、以下に示す方法でそれを実装しようとすると、エラーが発生します: SQL logic error。これは、2 つ以上の値をMATCHするためですか? そうでない場合、私が間違っていることはありますか?
//takes entry_id, g_value where matches word
query = "SELECT * FROM search_eng WHERE g_value MATCH '"
+ lookingFor + "' LIMIT 10";
cursor = db.rawQuery(query, null);
if (cursor.moveToFirst()) {
//if cursor is not empty
int num = 0;//counter for loop
query = querySelectFromTableWhere;//"SELECT entry_id AS _id, re_value, ke_value, g_value, pos FROM search WHERE "
do {
if (num == 0) {
//for the first time
//query for getting all data of words which matches with entry_id which was got from search_eng
query = query
+ " entry_id MATCH '"
+ cursor.getString(cursor
.getColumnIndex("entry_id"))+"'";
} else {
//next tries: 2nd time, 3rd time...
//query for getting all data of words which matches with entry_id which was got from search_eng
query = query
+ " OR entry_id MATCH '"
+ cursor.getString(cursor
.getColumnIndex("entry_id"))+"'";
}
num++;//plus counter
} while (cursor.moveToNext());
query=query+" LIMIT 10";
}
スタックトレース:
09-26 21:48:14.937: E/AndroidRuntime(29495): 致命的な例外: メイン 09-26 21:48:14.937: E/AndroidRuntime(29495): android.database.sqlite.SQLiteException: SQL ロジック エラーまたは欠落しているデータベース09-26 21:48:14.937: E/AndroidRuntime(29495): android.database.sqlite.SQLiteQuery.native_fill_window(ネイティブ メソッド) 09-26 21:48:14.937: E/AndroidRuntime(29495): android.database で.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:73) 09-26 21:48:14.937: E/AndroidRuntime(29495): android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:299) 09-26 21 :48:14.937: E/AndroidRuntime(29495): android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:272) 09-26 21:48:14.937: E/AndroidRuntime(29495): android.support で。 v4.widget.CursorAdapter.getCount(CursorAdapter.java:202) 09-26 21:48:14.937: E/AndroidRuntime(29495):android.widget.ListView.setAdapter(ListView.java:489) 09-26 21:48:14.937: E/AndroidRuntime(29495): com.joericharduz.akita.MainActivity.displayListView(MainActivity.java:147) 09- 26 21:48:14.937: E/AndroidRuntime(29495): com.joericharduz.akita.MainActivity.access$0(MainActivity.java:136) 09-26 21:48:14.937: E/AndroidRuntime(29495): com .joericharduz.akita.MainActivity$1.onTextChanged(MainActivity.java:122) 09-26 21:48:14.937: E/AndroidRuntime(29495): android.widget.TextView.sendOnTextChanged(TextView.java:6603) 09-26 21:48:14.937: E/AndroidRuntime(29495): android.widget.TextView.handleTextChanged(TextView.java:6650) 09-26 21:48:14.937: E/AndroidRuntime(29495): android.widget.TextView で$ChangeWatcher.onTextChanged(TextView.java:6794) 09-26 21:48:14.937: E/AndroidRuntime(29495): Android で。text.SpannableStringBuilder.sendTextChange(SpannableStringBuilder.java:889) 09-26 21:48:14.937: E/AndroidRuntime(29495): android.text.SpannableStringBuilder.change(SpannableStringBuilder.java:352) 09-26 21:48: 14.937: E/AndroidRuntime(29495): android.text.SpannableStringBuilder.change(SpannableStringBuilder.java:269) 09-26 21:48:14.937: E/AndroidRuntime(29495): android.text.SpannableStringBuilder.replace(SpannableStringBuilder) で.java:432) 09-26 21:48:14.937: E/AndroidRuntime(29495): android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:409) 09-26 21:48:14.937: E/AndroidRuntime(29495) ): android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:28) 09-26 21:48:14.937: E/AndroidRuntime(29495): android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:654) 09-26 21:48:14.937: E/AndroidRuntime(29495): android.view.inputmethod.BaseInputConnection.commitText(BaseInputConnection.java:180) 09-26 21:48:14.937: E/AndroidRuntime(29495) : com.android.internal.widget.EditableInputConnection.commitText(EditableInputConnection.java:120) 09-26 21:48:14.937: E/AndroidRuntime(29495): com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper) .java:283) 09-26 21:48:14.937: E/AndroidRuntime(29495): com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:79) 09-26 21:48:14.937 : E/AndroidRuntime(29495): android.os.Handler.dispatchMessage(Handler.java:99) 09-26 21:48:14.937: E/AndroidRuntime(29495): android.os.Looper.loop(Looper. java:130) 09-26 21:48:14.937: E/AndroidRuntime(29495):android.app.ActivityThread.main(ActivityThread.java:3687) 09-26 21:48:14.937: E/AndroidRuntime(29495): java.lang.reflect.Method.invokeNative(Native Method) 09-26 21: 48:14.937: E/AndroidRuntime(29495): java.lang.reflect.Method.invoke(Method.java:507) 09-26 21:48:14.937: E/AndroidRuntime(29495): com.android.internal .os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) 09-26 21:48:14.937: E/AndroidRuntime(29495): com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) 09-26 21:48:14.937: E/AndroidRuntime(29495): dalvik.system.NativeStart.main(ネイティブ メソッド) でReflect.Method.invoke(Method.java:507) 09-26 21:48:14.937: E/AndroidRuntime(29495): com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) で 09 -26 21:48:14.937: E/AndroidRuntime(29495): com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) 09-26 21:48:14.937: E/AndroidRuntime(29495): dalvik.system.NativeStart.main (ネイティブ メソッド) でReflect.Method.invoke(Method.java:507) 09-26 21:48:14.937: E/AndroidRuntime(29495): com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) で 09 -26 21:48:14.937: E/AndroidRuntime(29495): com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) 09-26 21:48:14.937: E/AndroidRuntime(29495): dalvik.system.NativeStart.main (ネイティブ メソッド) で