New search concept

Main discussion forum
Post Reply
atagal
Newbie
Newbie
Posts: 34
Joined: Tue Oct 26, 2010 12:08 am

New search concept

Post by atagal »

As I understand TGF search FORM by "submit" name but not always in html code are "name" (like on AMG)

Code: Select all

<form name="search" id="search_form" action="/search" method="post">
                            <p><input type="text" name="search_term" id="search_txt">
                            <input type="image" src="/img/pages/wide/go.gif" id="search_button"></p>
                            <p><select name="search_type" id="search_opt">
                                    <option value="artist" selected="selected">Artist/Group</option>
                                    <option value="album">Album</option>
                                    <option value="song">Song</option>
                                    <option value="work">Classical Work</option>
                            </select></p>
                        </form>
So, I suggest replace or expand current event oriented control to direct data send (POST and GET).
Some sites use POST method to send data, others use GET method.


New AMG code example (POST method):

Code: Select all

TITLE=POST;ACTION='http://www.allmusic.com/search';search_term=%T&search_type=Song
Discogs search for artist (GET)

Code: Select all

ARTIST=GET;ACTION='http://www.discogs.com/search';Q=%A&artists=artist
Advanced search (feature?)

Code: Select all

CUSTOM=GET;ACTION=''http://www.discogs.com/advanced_search';artist=%A&release_title=%L
Of course, % placeholder need replace to variables (%A %B etc) for advanced search.
Advanced search popmenu gives many benefits to user as in script user can search by any tag (by year, genre etc).

How?
Last edited by atagal on Fri Oct 29, 2010 7:55 am, edited 1 time in total.

User avatar
jtclipper
Administrator
Administrator
Posts: 772
Joined: Tue Aug 10, 2010 12:04 pm

Re: New search concept

Post by jtclipper »

There is another method to search on the Custom Online panel using scripts

ARTIST=URL;http://www.somesite.com

But it is currently limiting, without the use of %variables as we discussed, so I think that a new popmenu command 'Custom search" and a new script based placeholder CUSTOM= plus the usage of variables will be nice to have.

CUSTOM=URL;http://www.somesite.com/search?Q=%A&artists=artist

The problem though is to find the exact URL used
Dimitris

atagal
Newbie
Newbie
Posts: 34
Joined: Tue Oct 26, 2010 12:08 am

Re: New search concept

Post by atagal »

I had no idea about URL method! I guess it is GET method, and wont work on AMG.

Not big deal to find exact url if someone know html.
Problem is that on web2 sites are a lot ajax based buttons.

example:

Code: Select all

<form id="search">
            <input type="text" id="search-query">
            <input type="submit" value="Search">
            </form>
Mouse event oriented control can be handy to find such javascript (ajax) button.
But if on webpage is 2 or more forms and no names? TGF find form by button's name or just take 1st form[0] from DOM?

User avatar
jtclipper
Administrator
Administrator
Posts: 772
Joined: Tue Aug 10, 2010 12:04 pm

Re: New search concept

Post by jtclipper »

In the case that more than one form exists, which I don't think is common, at least on the web sites with the content we are looking for, TGF will match the form element name with the one used in the script and if a match is found then this form will be used.

Java scripted buttons and whatever else you can come across in the future will always be a pain to programmatically 'fire' from a 3rd party application, so user interaction will be necessary.
Dimitris

atagal
Newbie
Newbie
Posts: 34
Joined: Tue Oct 26, 2010 12:08 am

Re: New search concept

Post by atagal »

One universal method to find any form without names or ID:

1. parse DOM and put all forms to array form[]
2. find form in array by sequence

by default 1st form: form[0] on most pages.

Code: Select all

form[0]=#:click
so if user want fire 3th form on webpage:

CUSTOM=FORM;TYPE=artists:str|Q=%A:str|form[2]=#:click

or user friendly syntax FORM2=#:click
Last edited by atagal on Fri Oct 29, 2010 12:28 pm, edited 1 time in total.

User avatar
jtclipper
Administrator
Administrator
Posts: 772
Joined: Tue Aug 10, 2010 12:04 pm

Re: New search concept

Post by jtclipper »

I use a 'for/next' loop to iterate through all forms and select the one that has an element match, but could add a numeric identifier in the script to force usage of a specific form.
something like

Code: Select all

{?
 ALBUM=FORM^2;search_term=%L^str|search_type=album^str
/?}
Will try and work out all the possibilities we discussed and add new features in the next beta.
Dimitris

atagal
Newbie
Newbie
Posts: 34
Joined: Tue Oct 26, 2010 12:08 am

Re: New search concept

Post by atagal »

Ha. You r right, no need parse entire DOM.

Probably possible to parse even more easy by finding only <button... because need only this line :)

Thank you Dimitris!

atagal
Newbie
Newbie
Posts: 34
Joined: Tue Oct 26, 2010 12:08 am

Re: New search concept

Post by atagal »

discogs search form went to new form.

Code: Select all

<button type="submit" id="do_site_search" class="submit button" name="" value=""></button>
In result automatic search wont work as here no button name.
querry have changed to "artist: artist name" or "release: release title".

because impossible to escape variable ":" - it is impossible to search more precise.

atagal
Newbie
Newbie
Posts: 34
Joined: Tue Oct 26, 2010 12:08 am

Re: New search concept

Post by atagal »

btw, maybe even better is an idea to add Discogs service like Amazon because Discogs have free API.

http://www.discogs.com/developers/

Post Reply