Search Script not finding database

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

Search Script not finding database

Post by erick.thompson »

I have the following search script (very simple).

<script language=vortex>
<a name=main>
<?xml version="1.0" encoding="utf-8"?>
<result>
<DB = "">
<sql ROW SKIP=$skip MAX=10 "select Title, Description, Url from AccessAsia.html
where Title\Keywords\Body likep $q">
<result>
<title>$Title</title>
<link href="$Url" />
<summary>$Description</summary>
</result>
</sql>
<results>
</a>
</script>

The problem is, the search always defaults to the testdb, and complains about linear searches.

When setting up Webinator, I set up a profile/database, and now I'm trying to get the profile/database to apply to the search script above. It doesn't seem to work, regardless of what value I set to DB.

How do I correctly set the profile/database for a query?

Thanks,
Erick
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Search Script not finding database

Post by mark »

As mentioned in your other thread
<sql "select String SS_db from options where Name='SS_db' and Profile='yourprofile'"><sql>
<db=$SS_db>
erick.thompson
Posts: 16
Joined: Mon Mar 29, 2010 8:24 pm

Search Script not finding database

Post by erick.thompson »

I tried this, and got the following error:

15 /webinator/XML:3: Syntax error: <SQL [options] stmt [stmtfrag ...]> in the function: ()

The complete script is below:

<script language=vortex>
<a name=main>
<sql "select String SS_db from options where Name='SS_db' and Profile='AccessAsia'"><sql>
<db=$SS_db>
<?xml version="1.0" encoding="utf-8"?>
<result>
<$resultcount>
<sql ROW SKIP=$skip MAX=10 "select Title, Description, Url from AccessAsia.html
where Title\Keywords\Body likep $q">
<result>
<title>$Title</title>
<link href="$Url" />
<summary>$Description</summary>
</result>
</sql>
<results>
</a>
</script>

Thanks for your help!
Erick
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Search Script not finding database

Post by mark »

Typo, my 2nd <sql> should be </sql>

<sql "select String SS_db from options where Name='SS_db' and Profile='yourprofile'"></sql>
<db=$SS_db>
erick.thompson
Posts: 16
Joined: Mon Mar 29, 2010 8:24 pm

Search Script not finding database

Post by erick.thompson »

I should have caught that, thanks!

Now I am getting this error with a test search (literally)

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

The odd thing is that I have Linear search allowed set to Yes, which makes me think that the profile isn't working correctly. Is there any other reason that this error would come up?

Thanks!
Erick
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Search Script not finding database

Post by mark »

You shouldn't allow linear search. It will be slow on any significant data set. Create the proper index for the fields you're trying to search or search the fields that are already indexed.

You're not taking in or processing any profile options except now the database location. If you want all profile settings respected you'll need to take the approach John described in your other thread:
http://thunderstone.master.com/texis/ma ... 4bbd0ba71f
erick.thompson
Posts: 16
Joined: Mon Mar 29, 2010 8:24 pm

Search Script not finding database

Post by erick.thompson »

Understood, I am just trying to make sure that things are working correctly. I would rather not add to the search script, as that has far more functionality (that I haven't tested or secured) than I want.

I am combing through the init function now, trying to see what I need.

Thanks,
Erick
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Search Script not finding database

Post by mark »

Post Reply