Re: Searching multiple fields with the Excalibur search engine??
Posted in 1998
In article <6u6ltb$iij$2@reader1.reader.news.ozemail.net>, "Diggy Tim"
<tim@diggy.com> wrote:
> I am trying to setup a search using excalibur on our database, but I would
> like it to search multiple fields... There is no reference to doing this in
> the documentation and I would like to know if it is possible and if so how??
>
> How do I setup the index's and select statments??
You setup indexes as you normally would. Just make one index per each field
you desire to search.
Then when you use the etx_contains, you just can't use more than one in a
select statment, so do unions or something else to get the data back you want.
> Any help would be greatly appreciated,
An example maybe:
BEGIN WORK;
create table etx_test(
id serial,
col1 varchar(30),
col2 varchar(30)
);
CREATE index etx_col1 on etx_test
(col1 etx_varc_ops) using etx in etx_ispace ;
CREATE index etx_col2 on etx_test
(col2 etx_varc_ops) using etx in etx_ispace ;
INSERT INTO etx_test VALUES(0,"go to the Moon", "return from Mars");
INSERT INTO etx_test VALUES(0,"go to Mars", "return from the moon");
INSERT INTO etx_test VALUES(0,"go to the Sun", "return from Neptune");
INSERT INTO etx_test VALUES(0,"go to Neptune", "return from the Sun");COMMIT WORK;
then:
select * from etx_test
where etx_contains(col1,'moon')
UNION
select * from etx_test
where etx_contains(col2,'moon');
Tony
--
asalerno@monmouth.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum