Jacob's TN Searchy Thingy
- JacobH
- Quinta do Vesuvio 1994
- Posts: 3300
- Joined: 16:37 Sat 03 May 2008
- Location: London, UK
- Contact:
Jacob's TN Searchy Thingy
Admin2 Note: This thread split from here.
I don’t know if this would be helpful, or not, but I’ve been working on a similar script that I have been using to search through the TN on . I’ve got a copy up here: http://www.jacob-head.com/ftlop/ . It’s password protected, because I still am not quite sure whether Roy and the rest of the FTLOP team are happy with me publicising it, but feel free to try it. The username is: theportforum and the password: NovalNacional.
It can be updated automatically (though at the moment this is inactive so I don’t overuse the servers), which may be an advantage. It’s main disadvantages are that currently it doesn’t have names and dates for each note and it just gives the topic subject, rather than refining it.
I’m not sure whether there is much need for something like that. I’ve occasionally found it useful to use it to search for (say) all the VPs from one year, but perhaps for most uses the basic list will suffice!
I don’t know if this would be helpful, or not, but I’ve been working on a similar script that I have been using to search through the TN on . I’ve got a copy up here: http://www.jacob-head.com/ftlop/ . It’s password protected, because I still am not quite sure whether Roy and the rest of the FTLOP team are happy with me publicising it, but feel free to try it. The username is: theportforum and the password: NovalNacional.
It can be updated automatically (though at the moment this is inactive so I don’t overuse the servers), which may be an advantage. It’s main disadvantages are that currently it doesn’t have names and dates for each note and it just gives the topic subject, rather than refining it.
I’m not sure whether there is much need for something like that. I’ve occasionally found it useful to use it to search for (say) all the VPs from one year, but perhaps for most uses the basic list will suffice!
Jacob,
Is this scanning the users TNs or Roy's own TNs? If it's the former then it seems it is not really much different to a BOT scanning for keywords on any public site. If it's the latter I would imagine Roy will have a major issue with it, especially if you have subscribed to to gain access to the data.
Derek
Is this scanning the users TNs or Roy's own TNs? If it's the former then it seems it is not really much different to a BOT scanning for keywords on any public site. If it's the latter I would imagine Roy will have a major issue with it, especially if you have subscribed to to gain access to the data.
Derek
"The first duty of Port is to be red"
Ernest H. Cockburn
Ernest H. Cockburn
Jacob,
Would it take lots of effort to create a version of your index/search facility that points at the TNs on ?
Obviously it would be good for The Collective to agree to allow that to happen but I would be interested to know how easy t would be to make possible.
Derek
Would it take lots of effort to create a version of your index/search facility that points at the TNs on ?
Obviously it would be good for The Collective to agree to allow that to happen but I would be interested to know how easy t would be to make possible.
Derek
"The first duty of Port is to be red"
Ernest H. Cockburn
Ernest H. Cockburn
- JacobH
- Quinta do Vesuvio 1994
- Posts: 3300
- Joined: 16:37 Sat 03 May 2008
- Location: London, UK
- Contact:
No, it shouldn’t be too difficult…To produce a manually-updated version on my site (like the one) would, touch wood, only take about 10 minutes…Adding names and dates should, I hope, also be quite straight-forward.
Getting it to automatically update would be a bit more complex as it would have to be hosted on the server, reading the threads off the forum database. I think that would be a Sunday-afternoon project!
Getting it to automatically update would be a bit more complex as it would have to be hosted on the server, reading the threads off the forum database. I think that would be a Sunday-afternoon project!
Interesting! Perhaps others could chip in with thoughts?JacobH wrote:No, it shouldn’t be too difficult…To produce a manually-updated version on my site (like the one) would, touch wood, only take about 10 minutes…Adding names and dates should, I hope, also be quite straight-forward.
Getting it to automatically update would be a bit more complex as it would have to be hosted on the server, reading the threads off the forum database. I think that would be a Sunday-afternoon project!
Derek
"The first duty of Port is to be red"
Ernest H. Cockburn
Ernest H. Cockburn
- JacobH
- Quinta do Vesuvio 1994
- Posts: 3300
- Joined: 16:37 Sat 03 May 2008
- Location: London, UK
- Contact:
I made the necessary changes and put a version for on site at http://www.jacob-head.com/tpf. For the record, the necessary changes did only take 10 minutes, though working out that the reason that the same 10 bottles were shown 15 times each was not because of a bug in the code but because I’d downloaded the same page 15 times, took considerably more… pps:
It’s a bit rough-and-ready but hopefully shows what might be possible.
KillerB, the only non-trivial bit of code is this one which takes an arbitrary string and then returns an array containing a guess as to the shipper, type of port and vintage referred to in that string.
The index is generated in three stages, using XML. First we get the raw data, consisting of topic names and urls, and format them into an XML file as follows:
For these mock-ups, I‘ve been doing this by grabbing the forum index source code with wget and parsing it through some sed scripts.
Stage two is this set of code, which loops through the XML and produces:
Finally, stage three is the index.php (source code) which just takes the XML and displays/manipulates it.
With database access, stage one would be eliminated and I could incorporate stage 2 into the index.php file in a slightly more sophisticated way (so as to make it auto-update).
Alternatively, perhaps there might be some use for the basic portid function in generating the current static list, so you don’t have to do any manual sorting?
It’s a bit rough-and-ready but hopefully shows what might be possible.
KillerB, the only non-trivial bit of code is this one which takes an arbitrary string and then returns an array containing a guess as to the shipper, type of port and vintage referred to in that string.
The index is generated in three stages, using XML. First we get the raw data, consisting of topic names and urls, and format them into an XML file as follows:
Code: Select all
<forum>
<topic>
<name>Cruz Ruby</name>
<url>http://www.xyz.com/xzy.php</url>
</topic>
</forum>
Stage two is this set of code, which loops through the XML and produces:
Code: Select all
<forum>
<topic>
<name>Cruz Ruby</name>
<type>Ruby</type>
<year>nv</year>
<url>http://www.xyz.com/xzy.php</url>
</topic>
</forum>
With database access, stage one would be eliminated and I could incorporate stage 2 into the index.php file in a slightly more sophisticated way (so as to make it auto-update).
Alternatively, perhaps there might be some use for the basic portid function in generating the current static list, so you don’t have to do any manual sorting?
- JacobH
- Quinta do Vesuvio 1994
- Posts: 3300
- Joined: 16:37 Sat 03 May 2008
- Location: London, UK
- Contact:
I've finally had a chance to patch together some pseudo-php which would be how I would automate the script with database access if such a system might be helpful.
The passages marked **SQL** would, of course, need to be converted into real SQL calls, but as that's very much dependant on your set-up, it seemed easiest to leave them in pseudo-form. It uses my PortID function to do the hard work. I'm just about finishing a version 1.01 which will split crusted, garrafeira and white out of "ruby &c." and do some sub-types (e.g. identify if it is a 10/20/30/40 year-old tawny; ruby or ruby reserve; which sort of white and have a guess at the quinta for sqvp).
The passages marked **SQL** would, of course, need to be converted into real SQL calls, but as that's very much dependant on your set-up, it seemed easiest to leave them in pseudo-form. It uses my PortID function to do the hard work. I'm just about finishing a version 1.01 which will split crusted, garrafeira and white out of "ruby &c." and do some sub-types (e.g. identify if it is a 10/20/30/40 year-old tawny; ruby or ruby reserve; which sort of white and have a guess at the quinta for sqvp).
Code: Select all
include('./portid.inc');
##We only need to update if there have been new topics.
##How many topics are there now?
**SQL**
$currenttopics = SELECT forum_topics FROM phpbb_forums WHERE forum_id = 2;
##How many topics where there last time?
$oldtopics=file_get_contents('numberoftopics.txt');
##If there are now more topics than last time, then we rebuild the database
if($currenttopics > $oldtopics){
##Create new XML document using the DOM
$xml = new DomDocument('1.0');
##Build an array of topic numbers from the TN forum
$arrayoftopics=array();
**SQL**
$arrayoftopics = SELECT topic_id FROM phpbb_topics WHERE forum_id = 2;
##Loop through the array
foreach($arrayoftopics as $currenttopic){
$newtopic=$xml->addChild('topic');
**SQL**
$topicname = SELECT topic_title FROM php_topics WHERE topic_id =
$currenttopic;
$newtopic->addChild('name', $topicname);
$newtopic->addChild('url',
'http://www.theportforum.com/viewtopic.php?t='.$currentopic );
$portid=portid($topicname);
$newtopic->addChild('year', $portid[0]);
$newtopic->addChild('producer', $portid[1]);
$newtopic->addChild('type', $portid[2]);
**SQL**
$topictime = SELECT topic_time FROM php_topics WHERE topic_id =
$currenttopic;
$newtopic->addChild('time', $topictime);
**SQL**
$topic_poster = SELECT topic_poster FROM php_topics WHERE topic_id = $currenttopic;
$newtopic->addChild('author', $topic_poster);
}
file_put_contents('topics.xml',$xml->asXML());
}
***here continues the index.php file from previous post to display the database***
- JacobH
- Quinta do Vesuvio 1994
- Posts: 3300
- Joined: 16:37 Sat 03 May 2008
- Location: London, UK
- Contact:
Ben, yes, the idea is that it will automatically index the posts as they are posted. There are a few difficulties in doing it automatically but thankfully as the number of Port shippers is quite low (120 or so), its not too hard to put in individual exceptions, even if we do have more varieties of wine than other regions.
Alex, that’s a shame, though completely understandable as getting php and SQL to co-operate nicely is complete pain! I can do a bit of php and a bit of SQL at the terminal, but hate doing them together.
What might be useful to know is what database you are running as the php commands are completely different for PostgreSQL and MySQL. It would also be helpful to know if those SQL calls will work on the set-up here (e.g. with table names etc.) or if I’ve made any stupid mistakes with them (it’s a while since I’ve SQLed in anger).
I’ll try to finish off the new version of PortID and sort out the index page so it’s a bit more efficient. It’ll then just be a case of stringing the lot together, uploading it and seeing if it works
Alex, that’s a shame, though completely understandable as getting php and SQL to co-operate nicely is complete pain! I can do a bit of php and a bit of SQL at the terminal, but hate doing them together.
What might be useful to know is what database you are running as the php commands are completely different for PostgreSQL and MySQL. It would also be helpful to know if those SQL calls will work on the set-up here (e.g. with table names etc.) or if I’ve made any stupid mistakes with them (it’s a while since I’ve SQLed in anger).
I’ll try to finish off the new version of PortID and sort out the index page so it’s a bit more efficient. It’ll then just be a case of stringing the lot together, uploading it and seeing if it works
This thread has taken on a new meaning and I would suggest that "Jacob's TN searchy thing" deserves it's own thread so that this one can return to being a prompt to KillerB and Jdaw to get moving on updating the TN Index.
Any objections to splitting from the point where Jacob first mentioned his searchy thing?
Derek
Any objections to splitting from the point where Jacob first mentioned his searchy thing?
Derek
"The first duty of Port is to be red"
Ernest H. Cockburn
Ernest H. Cockburn
Thank you Jacob! No harm, no foul, as it was more of an "ethics" issue for me, not one with TPF. But that is firmly behind us now.
As to the other 1%, Alan alludes to ... he may actually someday fill that void, once we meet in person and I am assured his service revolver is not loaded. I am still unsure of his ability to handle copious amounts of VP in one sitting. But that is what offlines are for, to get to know folks in person where on line personas may not be as endearing. I am sure that of course, works both ways.
As to the other 1%, Alan alludes to ... he may actually someday fill that void, once we meet in person and I am assured his service revolver is not loaded. I am still unsure of his ability to handle copious amounts of VP in one sitting. But that is what offlines are for, to get to know folks in person where on line personas may not be as endearing. I am sure that of course, works both ways.
Roy Hersh
http://www.fortheloveofport.com
http://www.fortheloveofport.com
- Alex Bridgeman
- Graham’s 1948
- Posts: 14999
- Joined: 13:41 Mon 25 Jun 2007
- Location: Berkshire, UK
Roy
One of the weaknesses of FTLOP at present is that there is a great wealth of tasting notes from the forum members, but no index or easy way to find a note for a particular port (this is the only reason that I do not post tasting notes on FTLOP very often - once I post them it is almost impossible to refer back to them after a few days have gone by). Jacob's tasting note search string could help you to fill this gap relatively quickly...
Alex
One of the weaknesses of FTLOP at present is that there is a great wealth of tasting notes from the forum members, but no index or easy way to find a note for a particular port (this is the only reason that I do not post tasting notes on FTLOP very often - once I post them it is almost impossible to refer back to them after a few days have gone by). Jacob's tasting note search string could help you to fill this gap relatively quickly...
Alex
Top Ports in 2023: Taylor 1896 Colheita, b. 2021. A perfect Port.
2024: Niepoort 1900 Colheita, b.1971. A near perfect Port.
2024: Niepoort 1900 Colheita, b.1971. A near perfect Port.