Convert search query and content to lowercase
This commit is contained in:
@@ -47,7 +47,7 @@ export default function Search(props: {
|
|||||||
className="m-1 p-1 w-full border"
|
className="m-1 p-1 w-full border"
|
||||||
type="text"
|
type="text"
|
||||||
onInput={async (event: any) => {
|
onInput={async (event: any) => {
|
||||||
const query = event.target.value.trim();
|
const query = event.target.value.trim().toLowerCase();
|
||||||
if (!query) {
|
if (!query) {
|
||||||
setSearchResult([]);
|
setSearchResult([]);
|
||||||
return;
|
return;
|
||||||
@@ -81,7 +81,7 @@ export default function Search(props: {
|
|||||||
if (now !== searchingNow) setSearchingNow(now);
|
if (now !== searchingNow) setSearchingNow(now);
|
||||||
|
|
||||||
const value: ChatStore = await db.get("chatgpt-api-web", key);
|
const value: ChatStore = await db.get("chatgpt-api-web", key);
|
||||||
const content = value.contents_for_index.join(" ");
|
const content = value.contents_for_index.join(" ").toLowerCase();
|
||||||
if (content.includes(query)) {
|
if (content.includes(query)) {
|
||||||
const beginIndex: number = content.indexOf(query);
|
const beginIndex: number = content.indexOf(query);
|
||||||
const preview = content.slice(
|
const preview = content.slice(
|
||||||
|
|||||||
Reference in New Issue
Block a user