Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 12239
Latest: allershm
New This Month: 8
New This Week: 4
New Today: 0
Stats
Total Posts: 39378
Total Topics: 6932
Most Online Today: 134
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 1
Guests: 48
Total: 49

Author Topic: Search Feature  (Read 930 times)

0 Members and 1 Guest are viewing this topic.

Offline shuban

  • Hero Member
  • *****
  • Posts: 646
    • View Profile
    • Biology Forums - For All Your Science Needs
Search Feature
« on: February 13, 2018, 11:41:28 am »
Has the search features improved since the last release?

Thanks

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14712
    • View Profile
Re: Search Feature
« Reply #1 on: February 13, 2018, 11:44:18 am »
We haven't made any changes
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline shuban

  • Hero Member
  • *****
  • Posts: 646
    • View Profile
    • Biology Forums - For All Your Science Needs
Re: Search Feature
« Reply #2 on: February 13, 2018, 11:49:02 am »
Reason I ask is because:

$context['fulltextorderby'] and $context['fulltextscore'] lead to nowhere.

 :-\ :-\ What do these variables do?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14712
    • View Profile
Re: Search Feature
« Reply #3 on: February 13, 2018, 11:52:09 am »
I don't have any of those in my code at all...
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline shuban

  • Hero Member
  • *****
  • Posts: 646
    • View Profile
    • Biology Forums - For All Your Science Needs
Re: Search Feature
« Reply #4 on: February 13, 2018, 01:50:30 pm »
Opppppps...

Should be in Gallery, not the Store forum

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14712
    • View Profile
Re: Search Feature
« Reply #5 on: February 13, 2018, 02:37:50 pm »
The gallery already has fulltext searching built in. You can build a search index inside it.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline shuban

  • Hero Member
  • *****
  • Posts: 646
    • View Profile
    • Biology Forums - For All Your Science Needs
Re: Search Feature
« Reply #6 on: February 14, 2018, 12:01:16 am »
What I'm trying to say is:

Code: [Select]
if ($searchAll == false && $gallerySettings['gallery_set_searchenablefulltext'] == 1)
            {
            $context['fulltextorderby'] = "  ORDER BY score ASC ";
            $context['fulltextscore'] = ", MATCH(p.title, p.description, p.keywords) AGAINST('$searchfor') AS score ";
            $searchquery = " MATCH(p.title, p.description, p.keywords) AGAINST('$searchfor') ";
            }

There's this code in search2. But when I search "fulltextscore" within the source file, it's not found anywhere else? Where/when does this code communicate with mysql? I'm concerned because maybe I accidentally modified the gallery code and erased it.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14712
    • View Profile
Re: Search Feature
« Reply #7 on: February 14, 2018, 12:55:07 am »
After that there are lines such as
Code: [Select]
$context['gallery_search_query'] = $searchquery;

Which adds it to search queries later
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/
Useful Useful x 1 View List

Offline shuban

  • Hero Member
  • *****
  • Posts: 646
    • View Profile
    • Biology Forums - For All Your Science Needs
Re: Search Feature
« Reply #8 on: February 14, 2018, 11:50:50 am »
I see that

Code: [Select]
$context['fulltextscore'] = ", MATCH(p.title, p.description, p.keywords) AGAINST('$searchfor') AS score ";
            $searchquery = " MATCH(p.title, p.description, p.keywords) AGAINST('$searchfor') ";

But $context['fulltextscore'] is different than $searchquery. How are they connected? As far as I can understand, $context['fulltextscore'] gets lost and is never used after that

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14712
    • View Profile
Re: Search Feature
« Reply #9 on: February 14, 2018, 11:55:10 am »
They are used in different parts farther down
Code: [Select]

$dbresult = $smcFunc['db_query']('', "
SELECT
p.id_picture, p.id_cat, p.commenttotal, p.keywords, p.filesize, p.thumbfilename, p.approved, p.views,
p.id_member, m.real_name, p.date, p.mature, v.id_picture as unread, mg.online_color,
p.title, p.rating, p.totalratings, p.totallikes, (p.rating / p.totalratings ) AS ratingaverage $fulltextscore
FROM {db_prefix}gallery_pic as p
LEFT JOIN {db_prefix}members AS m ON (m.id_member = p.id_member)
LEFT JOIN {db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(m.ID_GROUP = 0, m.ID_POST_GROUP, m.ID_GROUP))
LEFT JOIN {db_prefix}gallery_log_mark_view AS v ON (p.id_picture = v.id_picture AND v.id_member = " . $context['user']['id'] . " AND v.user_id_cat = p.USER_ID_CAT)
LEFT JOIN {db_prefix}gallery_exif_data AS e ON (e.id_picture = p.id_picture)
$customFieldJoin
WHERE  " . $gallery_where . " p.approved = 1 $customFieldWhere AND (" . $context['gallery_search_query'] . ")
GROUP BY p.id_picture $fulltextorderby
LIMIT $context[start]," . $modSettings['gallery_set_images_per_page']);
$context['gallery_search_results'] = array();
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline shuban

  • Hero Member
  • *****
  • Posts: 646
    • View Profile
    • Biology Forums - For All Your Science Needs
Re: Search Feature
« Reply #10 on: February 14, 2018, 01:15:50 pm »
That's scary because I don't have that!

Mine goes like this:

Code: [Select]
if ($searchAll == false && $gallerySettings['gallery_set_searchenablefulltext'] == 1)
            {
            $context['fulltextorderby'] = "  ORDER BY score ASC ";
            $context['fulltextscore'] = ", MATCH(p.title, p.description, p.keywords) AGAINST('$searchfor') AS score ";
            $searchquery = " MATCH(p.title, p.description, p.keywords) AGAINST('$searchfor') ";
            }

$context['gallery_search_query'] = $searchquery;

$context['gallery_search'] = $searchfor;
}
else
{
//Search for the keyword

$context['gallery_search'] = $keyword;
$context['gallery_search_query'] = "p.keywords LIKE '%$keyword%'";
$context['gallery_searchkeywords'] = true;
$context['gallery_keywords'] = $keyword;
}

if (isset($_REQUEST['perpage']))
{
$galleryPerPage = (int) $_REQUEST['perpage'];

if ($galleryPerPage < $modSettings['orignal_set_images_per_page'])
$galleryPerPage = $modSettings['orignal_set_images_per_page'];

if ($galleryPerPage > $modSettings['orignal_set_images_per_page'] * 3)
$galleryPerPage = $modSettings['orignal_set_images_per_page'] * 3;

$_SESSION['galleryperpage'] = $galleryPerPage;
$modSettings['gallery_set_images_per_page'] = $galleryPerPage;
}   


// Check if we are sorting stuff heh
$sortby = '';
$orderby = '';
if (isset($_REQUEST['sortby']))
{
switch ($_REQUEST['sortby'])
{
case 'date': $sortby = 'p.id_picture';
break;

case 'title': $sortby = 'p.title';
break;

case 'mostview': $sortby = 'p.views';
break;

case 'mostcom': $sortby = 'p.commenttotal';
break;

case 'mostliked': $sortby = 'p.totallikes';
break;


case 'mostrated': $sortby = 'ratingaverage DESC,p.totalratings ';
break;

default: $sortby = 'p.id_picture';
break;
}

$sortby2 = $_REQUEST['sortby'];
}
else
{
if (!empty($context['gallery_sortby']))
{
$sortby = $context['gallery_sortby'];

switch ($sortby)
{
case 'p.id_picture': $sortby2 = 'date';
break;

case 'p.title': $sortby2 = 'title';
break;

case 'p.views': $sortby2 = 'mostview';
break;

case 'p.commenttotal': $sortby2 = 'mostcom';
$sortby = 'ratingaverage DESC,p.totalratings ';
break;

case 'p.totallikes': $sortby2 = 'mostliked';
break;


case 'p.totalratings': $sortby2 = 'mostrated';
break;

default: $sortby2 = 'date';
break;
}
}
else
{
$sortby = 'p.id_picture';
$sortby2 = 'date';
}
}

if (isset($_REQUEST['orderby']))
{
switch ($_REQUEST['orderby'])
{
case 'asc':
$orderby = 'ASC';

break;
case 'desc':
$orderby = 'DESC';
break;

default:
$orderby = 'DESC';
break;
}

$orderby2 = $_REQUEST['orderby'];
}
else
{
if (!empty($context['gallery_orderby']))
{
$orderby = $context['gallery_orderby'];
$orderby2 = strtolower($context['gallery_orderby']);
}
else
{
$orderby = 'DESC';

$orderby2 = 'desc';
}
}

if (empty($sortby))
$sortby = 'p.id_picture';

if (empty($orderby))
$orderby = 'DESC';

if (empty($context['fulltextorderby']))
$context['fulltextorderby'] = "  ORDER BY  $sortby $orderby";
else
{
$context['fulltextorderby'] = "  ORDER BY $sortby $orderby, score DESC";
}

$context['sub_template']  = 'search_results';

$context['page_title'] = $txt['gallery_searchresults'] . ' - ' .$modSettings['maingalleryname'];

$context['linktree'][] = array(
'name' =>  $txt['gallery_searchresults']
);

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14712
    • View Profile
Re: Search Feature
« Reply #11 on: February 14, 2018, 01:43:58 pm »
I know your gallery is heavily modified. You would have to compare your codebase to latest smf gallery code and see the differences made.

I recommend using software such as beyond compare.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline shuban

  • Hero Member
  • *****
  • Posts: 646
    • View Profile
    • Biology Forums - For All Your Science Needs
Re: Search Feature
« Reply #12 on: February 14, 2018, 02:03:33 pm »
I know your gallery is heavily modified. You would have to compare your codebase to latest smf gallery code and see the differences made.

I recommend using software such as beyond compare.

It's a shame, I lost my downloaded copy of the gallery.

Can prior paid members still download the version they paid for?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14712
    • View Profile
Re: Search Feature
« Reply #13 on: February 14, 2018, 02:12:21 pm »
No they can not. I only keep the latest version of the Gallery.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline shuban

  • Hero Member
  • *****
  • Posts: 646
    • View Profile
    • Biology Forums - For All Your Science Needs
Re: Search Feature
« Reply #14 on: February 14, 2018, 02:23:03 pm »
Bummer. If you'd like to donate function Search2() through PM, by all means :D

 

Related Topics

  Subject / Started by Replies Last post
1 Replies
3693 Views
Last post August 14, 2008, 07:19:56 pm
by SMFHacks
2 Replies
3154 Views
Last post November 22, 2008, 10:49:35 am
by gibbs
0 Replies
2015 Views
Last post September 11, 2009, 06:58:59 am
by Sicarius
2 Replies
2783 Views
Last post February 06, 2014, 08:21:06 am
by Jonas1975
1 Replies
1179 Views
Last post March 20, 2015, 10:53:55 pm
by SMFHacks

+- Recent Topics

GDPR Helper free doubts by Rock Lee
December 08, 2018, 06:20:57 pm

condition de livraison by alain54100
December 06, 2018, 12:33:38 pm

Downloads Pro 5.0 Released by SMFHacks
December 05, 2018, 03:11:32 pm

SMF Hacks Black Friday Sale! by SMFHacks
November 30, 2018, 09:03:04 am

Rewrite rule for IPN by diegolyanky
November 26, 2018, 10:58:55 am

EDITOR PRO by SMFHacks
November 25, 2018, 03:12:19 pm

SMF Gallery Pro 8.0 / PHP 7.0 onwards by SMFHacks
November 25, 2018, 12:33:10 pm

5.0 beta log errors by tfs
November 24, 2018, 10:37:06 pm

Download button doesn't initiate a download the first time by SMFHacks
November 24, 2018, 09:08:55 pm

Turn off Latest Posts? by tfs
November 23, 2018, 09:08:49 pm

Powered by EzPortal