help consturcting SQL query

User avatar
Thunderstone
Site Admin
Posts: 2504
Joined: Wed Jun 07, 2000 6:20 pm

help consturcting SQL query

Post by Thunderstone »




A bad URL on my site cause webinator to enter into a
loop where it routinely request bad URLs. I have since
fixed the bad anchor reference but have some questions
about where I can get more information on construction and
syntax of SQL queries.

The query I tried to send is

gw -d- -st "select Url,Ref from refs where
Ref='www.lib.duke.edu/shoe/goo/foo.html'"

but I really wanted to search for any and all occurrences of
"foo.html" using truncation.

I tried the asterisks without any success.

gw -d- -st "select Url,Ref from refs where
Ref=*foo.html*"

And while I'm on the topic. When I finish entering
meta data into a new collection of files, I'll need to get
some information about how to construct the proper
web page (syntax) to search those meta data fields from the
cgi form. I'm guessing this is not possible but just in
case I'm missing something let me ask here. Specifically I
would like to have meta data entries for author, title, and
abstract. Will I be able to retrieve data from those
fields and only those fields? E.g. send a cgi form query
that request only the name "smith" from the author meta
data?

And even better will I be able to use any boolean
operations in a cgi search form context? E.g.
author=smith AND title=keyword_in_article_title

--John Little
jrl@duke.edu




User avatar
Thunderstone
Site Admin
Posts: 2504
Joined: Wed Jun 07, 2000 6:20 pm

help consturcting SQL query

Post by Thunderstone »




General Texis SQL is documented in the online Texis manual at
http://www.thunderstone.com/texisman/texis.html
Look at the sections dealing with queries.


To do simple wildcards, you can use the "matches" operator as in:
... where Ref matches '%foo.html%'

To do more sophisticated queries, use the "like" operator as in:
... where Ref like '/foo\.html'
There's lots more you can do, but this example fits your question.


All of the collected meta data is placed into a single meta field.
Each item of meta data is on a separate line within the Meta field.
This data is searched along with the title and body in normal
webinator searches. You could search the Meta, Title, and Body separately
as you say above. You can't search the individual items in the Meta field
separately though. You search against all or none of the meta data.
Most of your searches will probably use the "likep" or "like" operator
instead of "=".

To perform searches other than the standard webinator ones, you will
need to create appropriate indices on the queried fields. See the Texis
manual section dealing with indexing.

See the webinator walker documentation to find out what fields are in
the database and their names.