search in Title, Meta or Body

m.natz
Posts: 10
Joined: Thu Jun 07, 2001 10:04 am

search in Title, Meta or Body

Post by m.natz »

hi

I would like to offer to the webusers, that they can choose, where the keywords have to be found. (Title, Meta or Body). Now I tried to build the sql statment dynamicly. But there are never any results returning.

<if $wheretosearch eq "Title">
<sum "%s" "Title likep " $keyword>
<elseif $wheretosearch eq "Meta">
<sum "%s" "Meta likep " $keyword>

...

</if>

<$where = $ret>

<sql "select * from html where $where">...</sql>

there is no error but also no result.

thanks for any help

Marce
User avatar
John
Site Admin
Posts: 2623
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH

search in Title, Meta or Body

Post by John »

You can write that as:

<switch $wheretosearch>
<case Title><$where=" Title likep $$keyword">
<case Meta><$where=" Meta likep $$keyword">
...
</switch>
<sql "select fields from html where " $where>
</sql>

There are probably errors if you look at the HTML source.
John Turnbull
Thunderstone Software
User avatar
Kai
Site Admin
Posts: 1272
Joined: Tue Apr 25, 2000 1:27 pm

search in Title, Meta or Body

Post by Kai »

Keep in mind that gw -index only produces a search index for Title\Meta\Body; unless you create Metamorph inverted indexes on Title and Meta and Body separately, after your walk is finished, the searches will be linear (very slow) if they are on one of those fields individually, as the first part of the WHERE clause. Eg. in Vortex:

<SQL "create metamorph inverted index xhtmltitle on html(Title)">
</SQL>

etc.