Hello! Is that okay?
I need to query the fulltextsearch
because it needs to be indexed.
However, I am not able to set up a query that returns all possibilities, as if it were a like
.
The query I was able to mount is as follows
DECLARE @nmPessoa varchar(250)
/*Exemplos de consultas*/
-- 1
--SET @nmPessoa = '1ª VARA DE EXECUÇÃO FISCAL ESTADUAL - CURITIBA'
--2
--SET @nmPessoa = 'Curitiba'
--3
--SET @nmPessoa = 'Curi'
--4
--SET @nmPessoa = 'FUMPISUL'
--5
--SET @nmPessoa = 'FUM'
--6
--SET @nmPessoa = 'CAMARA GRANDE'
--7
--SET @nmPessoa = 'FUMPISUL - FUNDO MUNICIPAL DE PREVIDÊNCIA DE PIRAÍ DO SUL'
set @nmPessoa = '"*'+ @nmPessoa +'* "'
select p.nmPessoa
from pessoa p
where CONTAINS(p.nmPessoa ,@nmPessoa)
In the case of the 1st example, you should return the exact record (it is correct)
In the 2nd example all records that have 'Curitiba' in the sentence (is correct)
In the 3rd example, you should bring the sentences that have 'Curi', that is, the records of 'Curitiba' should also appear (Not working)
And in example 6, you should bring the sentences that have "Camara" and "Great", but it does not work, it returns the sentences that have 'Big Chamber', as if it were only 1 word.
The query using like
is this, but I can not use it because it takes minutes to return. The number of records is large.
DECLARE @nmPessoa varchar(250)
DECLARE @parametro varchar(250)
set @parametro = REPLACE( LTRIM(RTRIM(@nmPessoa)), ' ', '%')
select p.nmPessoa
from pessoa p
where p.nmPessoa LIKE '%'+@parametro+'%'
Thanks in advance for your help.