Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Strange search results / problems

Quote Reply
Strange search results / problems
Hello everyone!

I'll try to be brief and concise:

In the database, among all the others, I have 3 fields:

Location
Type_of_accommodation
Additional_Data

Column Type: CHAR
Column Index: None
Column Size: 255
Form Type: CHECKBOX

and for all links:

Indexing Scheme: INTERNAL

Now, ...

When in my admin section I search for "Air conditioning" and "Internet access" in "Additional_Data" I get 95 results, but ...

When I do the same with search.cgi I get no result ?!?

I get some results if I'm looking for something else but generally the number of results differs from what I get in the administrative area and generally it does not corresponds to the reality.

Does anybody have an idea of what is the problem here?

Many thanks in advance.
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Have the Additional_Data field set to be indexed? (it needs to be indexed, otherwise it won't search it). It should be setup a bit like the Description field.

I believe the admin panel doesn't do internal indexing (only the mySQL table indexing), which may be why you're seeing different results than you are in the user CGI's

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Strange search results / problems In reply to
Hello Andy!

Please take a look on the image ...

Thanks ...
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Hi Katakombe,

In order for fields to be searchable from the user you have to give them search weight or else GLinks just don't bothers to search on those fields!

Look at the documentation on that and how the search weights are defined in the default fields in Links table.

Hope that helps.

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Column Index => None
Search Weight => empty

Both those need setting :)

Also - when you search, are you doing

Additional_Data=1, or Additional_Data=Access%20for%20disabled

If you are using numbers for that field, I would also suggest changing it into an INT (as CHAR isn't needed in this case).

From memory, you need to use the VALUE thats actually saved in the DB... so doing this should work:

?Additional_Data=1;query=*

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [eupos] Strange search results / problems In reply to
Hi,

Boris - It should actually, assuming you are passing in a specific value for it... so something like:

search.cgi?Field=foo;query=*

Or:

search.cgi?Field=foo;field-opt=like;query=*

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Strange search results / problems In reply to
Hi Any!

If I change from "None" to "Regular" do I risk any lost of data?

Thanks ..
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Hi,

You shouldn't do - but its always worth doing a backup of your DB before doing changes like that... just in case Whistle

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Strange search results / problems In reply to
Hi Andy,

Yes it should ... but only if the options are explicitly set to search on the specific field, the regular search routine would not bother to search in fields without search weight when Internal scheme is used!

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [Andy] Strange search results / problems In reply to
Quote:
A column must be defined as not null if you want to index it.

but I can't have it like that because it is optional for users to use it ..

Any other idea?
Quote Reply
Re: [eupos] Strange search results / problems In reply to
eupos wrote:
Hi Andy,

Yes it should ... but only if the options are explicitly set to search on the specific field, the regular search routine would not bother to search in fields without search weight when Internal scheme is used!

I know (see my first post). I was just saying, that if you *explicity* pass in a value for that field, then it will search Angelic

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Hi katakombe,

I'd be careful with the indexes as having too many indexes would actually slow your database.

My advice is to play a bit with the search weights and reindex after each change.

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Hi,

Try just setting it as not indexed then. Alternatively, make the change in phpMyAdmin, and do a "resync". There is an annoying bug where it gives you this message, even when its not true (for never version of mySQL). Its quite ok to have a field with no value, but still have it indexed.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Strange search results / problems In reply to
Additional_Data=1 is right in my case, kind of /cgi-bin/search.cgi?query=&Additional_Data=2&Additional_Data=9
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Everything is quite confusing right now ...
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
But what if I change from CHAR to INT? Do I risk any lost ... ?
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
katakombe wrote:
But what if I change from CHAR to INT? Do I risk any lost ... ?

Try doing this query first:

Quote:
SELECT DISTINCT(Additional_Data) FROM glinks_Links;

This will show you what values you have in that field. If you only have numbers in it, then changing to an INT will have no problems at all. If you have some with text in, then you would need to update those links (they wouldn't be working right with your current setup anyway, as you are using numbers for DB values)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Strange search results / problems In reply to
Hello Again Andy!

Please look at the PDF file for output ...

Anyway, I'm not sure ... I think that I have lost once a quite part of my database like that ...

Do you want to look from Admin?
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Hi,

Ah ok, actually you can't use INT for your values. I thought this was a basic SELECT box, but its actually a multi-select (in "checkbox" form). In that case, you do need CHAR.

As Boris said, try tweaking the "search weight" and then re-index and test it. If you would prefer me to have a look, email over GLinks admin logins, and I'll take a look when I get a chance (give me some example queries you would expect to work as well :))

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Strange search results / problems In reply to
OK, thanks, PM sent.
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Hmmm ... check the output.pdf file again:

Are results sorted alphabetically there ?!?

I don't know, but as I said everything is quite confusing ... 96 results in Admin area but 0 results through search.cgi ...
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Hi,

That is the correct ordering for a CHAR field. If you were using an INT, it would be going 1,2,3,4,5 etc... but because you're using a CHAR, it doesn't sort numerically as you would expect... it would go:

1,10,11,12,13,14,15,16,17,18,19,2,20,21,22,23 etc

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Strange search results / problems In reply to
Yea, you are right Smile
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Hi,

Ok, so after doing some debugging it seems there is a problem with the selecting of multiple "checkbox" / "multi-select" values from the user side. An example using search.cgi:

Code:
SELECT * FROM glinks_Links WHERE (TestCheckbox IN ('btest','atest') AND isValidated = 'Yes') LIMIT 0, 25

That won't give a result, as the value in that field is just:

Code:
atest
btest

When run in the admin panel, it does it differently:

Code:
Executing query: SELECT * FROM glinks_Links WHERE (TestCheckbox LIKE '%atest\t%btest%') LIMIT 0, 25

I'm not really sure of the cause of this, but thought I'd post it here, as it appears to be a bug

FWIW, simply doing:

search.cgi?query=;TestCheckbox=xxx works fine... cos its only looking for one value (doesn't need to do an IN in that case, its its only gotta match one criteria)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Strange search results / problems In reply to
HI,

Has there been any progress from the GT team about this issue?

Regards
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Hi,

I haven't heard anything yet. I pointed them in the direction of this post, so hopefully they will just reply here Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Strange search results / problems In reply to
Hello everyone!

I would not want to be boring, but from my perspective, this is a big problem for me because the site is live and searches give inaccurate search results to users.

Is there any chance that someone from GT can explain the reasons for these problems?

Once again, many thanks in advance.

Last edited by:

katakombe: Mar 25, 2013, 2:53 AM
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Hi,

It may be worth emailing them to see if they've had a chance to look at it (just to give a nudge Whistle)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Strange search results / problems In reply to
Hi again Andy!

I've already thought about it, but I'll wait one more day to see if anyone from GT send a reply to this topic here ...

BR//
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Sorry, I'm been really busy with a project at the moment and haven't had a chance to look into this one.

Adrian
Quote Reply
Re: [brewt] Strange search results / problems In reply to
Hello Adrian, no problem!

Do you need access to my server?

Thanks.
Quote Reply
Re: [brewt] Strange search results / problems In reply to
Hi everyone!

As I already said, I would not want to be boring, but to me this is very important.

What should I do - is this my fault or problem lies in something else?

Once again, thanks.
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Is this the same problem:

http://www.gossamer-threads.com/...th_checkbox_P199182/

and

http://www.gossamer-threads.com/..._checkboxes_P263919/

?

I'm totally confused ...
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Hi,

It appears to be, yes.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Strange search results / problems In reply to
Hello again Andy!

I'm not at all happy that the problem exists, but I'm glad that I'm not alone Crazy

If that is the case, GT should solve this somehow ..

Regards,
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Sorry, still trying to get this project out, so I'll be busy for a few more days.

Adrian
Quote Reply
Re: [brewt] Strange search results / problems In reply to
Hello!

It's been 10 days - is there anything new?

Kind regards
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Sorry about the delay. Try this patch:

Code:
Index: Base.pm
===================================================================
RCS file: GT/SQL/Base.pm,v
retrieving revision 1.72
diff -u -r1.72 Base.pm
--- Base.pm 13 May 2011 23:56:51 -0000 1.72
+++ Base.pm 23 Apr 2013 20:46:11 -0000
@@ -15,6 +15,7 @@
# ===============================================================
use GT::Base;
use GT::AutoLoader;
+use GT::SQL::Display::HTML;
use strict;
use vars qw($ERRORS $DEBUG @ISA $VERSION $ERROR_MESSAGE);
@ISA = qw/GT::Base/;
@@ -529,7 +530,12 @@
push @$add, $_;
}
if ( @$add ) {
- push @ins, [$field, 'IN', $add];
+ if ( $c->{$field}->{form_type} eq 'CHECKBOX' ) {
+ push @ins, [$field, 'LIKE', $s . join($GT::SQL::Display::HTML::INPUT_SEPARATOR . $s, sort @$add) . $e];
+ }
+ else {
+ push @ins, [$field, 'IN', $add];
+ }
}
}
elsif ($opts->{$field} =~ /^(>=?|<=?|!)(.*)/) {

Adrian

Last edited by:

brewt: Apr 23, 2013, 1:47 PM
Quote Reply
Re: [brewt] Strange search results / problems In reply to
Sorry:

Quote:
Unable to load GT::Base::in_eval: Compilation error at /mywebsite/public_html/cgi-bin/admin/GT/AutoLoader.pm line 129.
Compilation failed in require at /mywebsite/public_html/cgi-bin/admin/GT/SQL.pm line 19.
BEGIN failed--compilation aborted at /mywebsite/public_html/cgi-bin/admin/GT/SQL.pm line 19.
Compilation failed in require at /mywebsite/public_html/cgi-bin/admin/GT/Delay.pm line 50.

Frown
Quote Reply
Re: [brewt] Strange search results / problems In reply to
Please accept my apologies - my mistake:

It's not:

Quote:
+use GT::SQL::Display::HTML;

it's:

Quote:
use GT::SQL::Display::HTML;

(without "+")

I made a short test and it seems that everything is OK

WhistleCool
Quote Reply
Re: [brewt] Strange search results / problems In reply to
I'm sorry, but this nightmare is not over ...

Both in admin and on the user side I get incorrect results when I'm looking for only one variable:

For example, I'm looking in "Additional_Data" field for Elevator (6) and I get 253 results out of 350 possible which is not true ...

Something is definitely wrong and I humbly ask that GT team closely check what's the problem here.

Many thanks in advance.
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
If the field is a number, that search isn't going to be a good one since the search is a LIKE search.

Adrian
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
The final solution:

For all those who have, or will have the same problems as me, I would like to make a modest contribution and describe the solution:

If you use:

Code:
Column Type: CHAR
Column Index: None
Form Type: CHECKBOX or MULTI-SELECT

and for all links:

Code:
Indexing Scheme: INTERNAL

then for:

Code:
Form Names

you can use a maximum of 10 unique values as numbers (0,1,2,3,4,5,6,7,8,9)

If you need more than 10 values (up to a maximum of 26), you can use the alphabet (A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z) as I did.

(For a maximum of 36 combinations you can use both letters and numbers)

For "Search Weight" field you must assign a value of at least 1 and you have to do "Rebuild Search".

Your entire database will not work properly unless you install Adrian's patch:

http://www.gossamer-threads.com/...ems_P314942/#p314942

So much of me. I sincerely hope that everyone will benefit from this. Good luck!
Quote Reply
Re: [katakombe] Strange search results / problems In reply to
Or you can go 2 characters and not use any single character values (eg. 10, 11, or aa, ab, ac, etc).

Adrian
Quote Reply
Re: [brewt] Strange search results / problems In reply to
Hi,

It seems there is still a problem. An example listing has checkboxes B I and O selected. Thats all fine.

The SQL query being run at its simplest, is:


Code:
GT::SQL::Driver::MYSQL::sth (15093): Executing query: SELECT * FROM glinks_Links WHERE (ExpiryDate >= 1375945671 AND isValidated = 'Yes' AND Additional_Data LIKE '%B
%I
%O%') LIMIT 0, 10

...but the DB, its stored as:

A
K
L
M
N
O
Q
R
B
E
G
H
I

...and because they don't match that order, it can't find them. It seems like for some reason GT::SQL isn't saving the checkbox info in the correct order.
Quote Reply
Re: [brewt] Strange search results / problems In reply to
Hello!

Is there any progress with this issue after 20 days?

Thanks