Skip to content

Commit

Permalink
Merge pull request #277 from iftechfoundation/search-author-fulltext-…
Browse files Browse the repository at this point in the history
…index

Add fulltext index for author search
  • Loading branch information
dfabulich committed Jan 4, 2024
2 parents e2a183b + 784e85c commit 8261203
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions sql/patch-schema-2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ USE ifdb;

-- use this script for pending changes to the production DB schema

alter table games add fulltext key `author` (`author`);

alter table reviews
add column `embargopastdate` date DEFAULT NULL,
add key `embargodate` (`embargodate`),
Expand Down
4 changes: 2 additions & 2 deletions www/searchutil.php
Original file line number Diff line number Diff line change
Expand Up @@ -668,9 +668,9 @@ function doSearch($db, $term, $searchType, $sortby, $limit, $browse)
$or = "";
foreach ($nameList as $n) {
// look for this exact name embedded in the author field
$expr .= "$or author like '%"
$expr .= "$or match (author) against ('"
. mysql_real_escape_string(quoteSqlLike($n), $db)
. "%' ";
. "') ";

// get the sorting version of the name - LAST, SUFFIX,
// FIRST, MIDDLE, and split into an array
Expand Down

0 comments on commit 8261203

Please sign in to comment.