Simple script to display results as ATOM feed

erick.thompson
Posts: 16
Joined: Mon Mar 29, 2010 8:24 pm

Simple script to display results as ATOM feed

Post by erick.thompson »

I am trying to write a script that will accept parameters via HTTP Headers, and returns the results as an ATOM feed. The problem is, all the sample scripts are either far too complex or too simple. Does anyone have an example of accepting input via querystring or headers, and only have the script display the results of the search?

Thanks,
Erick
User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Simple script to display results as ATOM feed

Post by John »

Query string variables are accessible as is in the script, so for example if the URL was:

.../texis/search/feed.xml?q=word

then you can use $q in the script. For example assuming a table structure similar to the Webinator tables the script might be as follows. It is pretty simple, so depending on what else you are looking to do we can point you in the right direction.

<script language=vortex>
<a name=main>
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Example Feed</title>
<subtitle>A subtitle.</subtitle>
<sql "select Title, Description, Url from html
where Title\Keywords\Body likep $q">
<entry>
<title>$Title</title>
<link href="$Url" />
<summary>$Description</summary>
</entry>
</sql>
</a>
</script>
John Turnbull
Thunderstone Software
erick.thompson
Posts: 16
Joined: Mon Mar 29, 2010 8:24 pm

Simple script to display results as ATOM feed

Post by erick.thompson »

That makes perfect sense, thanks.

However, I must be missing something basic, as I am not seeing how I can create a new script. I am running on Windows 03 server - where do I place the script source?

Thanks,
Erick
User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Simple script to display results as ATOM feed

Post by John »

That depends on exactly how you have configured Texis to look for the scripts, but you would generally put it in the INSTALLDIR\texis\scripts directory. You should find a webinator folder in there with the default scripts.
John Turnbull
Thunderstone Software
erick.thompson
Posts: 16
Joined: Mon Mar 29, 2010 8:24 pm

Simple script to display results as ATOM feed

Post by erick.thompson »

I found them, and added the new script there. I added the script there (named XML, no extension), and called

/texis/webinator/search?pr=XML&q=test

Is this the correct format?

Thanks,
Erick
erick.thompson
Posts: 16
Joined: Mon Mar 29, 2010 8:24 pm

Simple script to display results as ATOM feed

Post by erick.thompson »

Sorry, it was my mistake. Once I put back in the <a name=main> line, it works. However, it is using the test database, and the result contains:

<!-- 115 /webinator/XML:5: Query 'test' would require linear search -->

My questions are

1. How do I specify the database and
2. What does this error mean, in a texis database?

Thanks!
erick.thompson
Posts: 16
Joined: Mon Mar 29, 2010 8:24 pm

Simple script to display results as ATOM feed

Post by erick.thompson »

User avatar
jason112
Site Admin
Posts: 347
Joined: Tue Oct 26, 2004 5:35 pm

Simple script to display results as ATOM feed

Post by jason112 »

Within a script, you can use <db=/path/to/my/database>.

Rather than hard-code your profile's database in the script, you'll want to select String from options where Name='SS_db' and Profile=$pr
User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Simple script to display results as ATOM feed

Post by John »

If you are using it as part of a webinator script you may want to add the function called atom to the search script, and call <init> at the top to set up the database, e.g.

<a name=atom public>
<init>
...
</a>

which would then be accessed as /texis/webinator/search/atom.xml?pr=...
John Turnbull
Thunderstone Software
erick.thompson
Posts: 16
Joined: Mon Mar 29, 2010 8:24 pm

Simple script to display results as ATOM feed

Post by erick.thompson »

John,

I would rather not add to the search script, as it is far too large, and I don't need most of it.

I am looking over the init function, trying to find the mimimum that I need for my search. There is a lot there....

Thanks,
Erick
Post Reply