Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4253
Latest: Ineedsmfhelp
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 43242
Total Topics: 7516
Most Online Today: 107
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 110
Total: 110

Author Topic: Search Feature  (Read 4537 times)

0 Members and 1 Guest are viewing this topic.

Offline shuban

  • Hero Member
  • *****
  • Posts: 665
    • View Profile
    • Biology Forums
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: 16428
    • 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: 665
    • View Profile
    • Biology Forums
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: 16428
    • 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: 665
    • View Profile
    • Biology Forums
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: 16428
    • 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: 665
    • View Profile
    • Biology Forums
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: 16428
    • 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: 665
    • View Profile
    • Biology Forums
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: 16428
    • 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: 665
    • View Profile
    • Biology Forums
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: 16428
    • 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: 665
    • View Profile
    • Biology Forums
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: 16428
    • 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: 665
    • View Profile
    • Biology Forums
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
0 Replies
6630 Views
Last post October 04, 2006, 09:20:49 pm
by SMFHacks
2 Replies
5116 Views
Last post September 02, 2007, 09:17:26 am
by SMFHacks
0 Replies
7826 Views
Last post September 11, 2009, 06:58:59 am
by Sicarius
2 Replies
14410 Views
Last post February 06, 2014, 08:21:06 am
by Jonas1975
1 Replies
11237 Views
Last post March 20, 2015, 10:53:55 pm
by SMFHacks

+- Recent Topics

is it possible to add support for odysee.com by SMFHacks
March 13, 2024, 10:53:28 pm

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

an idea for new mod (( content type with different display )) by SMFHacks
February 27, 2024, 01:36:27 pm

[Mod] RSS Feed Poster by SMFHacks
February 27, 2024, 11:57:18 am

find duplicate pictures by fvlog19
February 14, 2024, 02:22:40 pm

Error uploading video. by SMFHacks
February 08, 2024, 02:04:16 pm

Gallery icon as last added image by fvlog19
February 01, 2024, 01:04:56 pm

User Gallery Feature: move / bulk move images by SMFHacks
January 30, 2024, 05:48:25 pm

In the future it may be for smf 2.1.x? by smithloo
January 30, 2024, 12:55:34 am

Powered by EzPortal