PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 25 → WX - COMO CRIAR UM MOTOR DE BUSCA NA SUA APLICAÇÃO FULLTEXT
WX - COMO CRIAR UM MOTOR DE BUSCA NA SUA APLICAÇÃO FULLTEXT
Started by BOLLER, May, 18 2017 3:11 AM - 3 replies
Registered member
3,651 messages
Popularité : +175 (223 votes)
Posted on May, 18 2017 - 3:11 AM
COMO CRIAR UM MOTOR DE BUSCA NA SUA APLICAÇÃO [OS BÁSICOS]
HOW TO CREATE A SEARCH ENGINE IN YOUR APPLICATION [THE BASICS]



Criando uma pesquisa de mecanismo usando o índice de texto completo na análise,
Este vídeos é apenas uma introdução, nós meu criar um aplicativo completo baseado neste

Creating an engine search using the full-text index in the analysis,
this videos is just an introduction, we my create a full application based on this.

Video feito por WINDEVER TV
Get WinDev on : https://www.pcsoft.fr/
Follow WINDEVER TV :
https://twitter.com/WinDever_TV
https://www.facebook.com/Windevertv-388985994796678/

--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Message modified, May, 18 2017 - 3:18 AM
Registered member
203 messages
Popularité : +25 (25 votes)
Registered member
3,651 messages
Popularité : +175 (223 votes)
Posted on August, 30 2017 - 5:12 AM
//server
arr_Resultados is array of string

//Declara webservice//

gsValorMemorizado is string = 1 //Necessario um valor

DeclareWebserviceContext(gsValorMemorizado) //Principal funcao que declara webservice//

DeclareWebserviceContext(arr_Resultados) //Principal funcao que declara webservice//




Procedure Ws_BuscaEndereco(Token, Endereco)

//Variaveis
arrResultado is array of string
ok is boolean = False
X is int = 0
nTokenOk is int = 0
sTabela is string = "Enderecos"
Resultado is string = ""
sErro is string = ""
GloToken is string = ""

OkConn is boolean = False

OkConn = HConnectionOpen(MyHfsql)

ok = HExecuteQuery(QRY_Select_Cliente,hQueryWithoutHFCorrection,Token)

IF ok = True THEN

FOR EACH QRY_Select_Cliente

IF HFound(QRY_Select_Cliente) = True AND Token = QRY_Select_Cliente.Token THEN

GloToken = QRY_Select_Cliente.Token

ELSE

GloToken = ""

END

END

END

//Code
IF Token <> "" AND Token = GloToken

IF OkConn = True THEN

ok = HExecuteQuery(QRY_Select_Cliente,MyHfsql,hQueryWithoutHFCorrection,Token)

IF ok = True THEN

FOR EACH QRY_Select_Cliente

IF HFound(QRY_Select_Cliente) = True THEN

ok = HExecuteQuery(QRY_Select_CEP,MyHfsql,hQueryWithoutCorrection,Endereco)

IF ok =True THEN

Resultado = "<Xml><Retorno>"

FOR EACH QRY_Select_CEP

IF HFound(QRY_Select_CEP) = True AND X = 0

X += 1

Resultado += ws_xml_registro_comeco(X)

Resultado += ws_xml_registro_corpo(QRY_Select_CEP.Sequencial,"Sequencial")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.LogradouroUpper,"LogradouroUpper")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.LogradouroAbrev,"LogradouroAbrev")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.Logradouro,"Logradouro")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.LogradouroCompl,"LogradouroCompl")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.Fonetica,"Fonetica")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.LogradouroTipo,"LogradouroTipo")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.CEP,"CEP")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.Bairro,"Bairro")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.BairroAbrev,"BairroAbrev")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.IDCidade,"IDCidade")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.Cidade,"Cidade")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.SubCidadeAbrev,"SubCidadeAbrev")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.SubCidade,"SubCidade")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.CodIBGECid,"CodIBGECid")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.CodIBGEUF,"CodIBGEUF")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.UF,"UF")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.Pais,"Pais")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.LogradouroIniciais,"LogradouroIniciais")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.NumeroInicial,"NumeroInicial")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.NumeroFinal,"NumeroFinal")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.DMSLatitude,"DMSLatitude")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.DMSLongitude,"DMSLongitude")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.GDLatitude,"GDLatitude")
Resultado += ws_xml_registro_corpo(QRY_Select_CEP.GDLongitude,"GDLongitude")

Resultado += ws_xml_registro_final()

END

END

IF X = 0 THEN
Resultado = ws_zero_registros(sTabela)
END

Resultado += "<TOTAL>"+X+"</TOTAL>" //Total de Registros para usar em barras de progresso
Resultado += "</Retorno></Xml>"

ELSE

Resultado += "<Error>Erro 002 tabela<Error>"

END

ELSE

Resultado += "<Error>Erro 003 tabela<Error>"

END


END


ELSE

Resultado += "<Error>Erro 004 tabela<Error>"

END


ELSE

Resultado += "<Error>Erro 005 Conexao<Error>"

END

ip is string = WebserviceClientIPAddress(False)
//Verdadeiro para recuperar o endereço inicial especificado no cabeçalho HTTP,
//Falso (valor padrão) para recuperar o Endereco ip na variável de ambiente "REMOTE_ADDR" definida pelo servidor da Web.

ok = HExecuteQuery(QRY_Insert_Log,hQueryWithoutHFCorrection,DateSys()+TimeSys(),ip,Token,Endereco)

HReset(QRY_Select_CEP) // <----- Limpar atenção

HReset(QRY_Select_Cliente) // <----- Limpar atenção

HConnectionClose(ConnNativa)

ELSE

Resultado += "<Error>Token invalido<Error>"

END

nTamanho is int = Length(Resultado)

Add(arrResultado,Resultado)

RESULT (arrResultado)



SELECT
enderecoscorreios.Sequencial AS Sequencial,
enderecoscorreios.LogradouroUpper AS LogradouroUpper,
enderecoscorreios.LogradouroAbrev AS LogradouroAbrev,
enderecoscorreios.Logradouro AS Logradouro,
enderecoscorreios.LogradouroCompl AS LogradouroCompl,
enderecoscorreios.Fonetica AS Fonetica,
enderecoscorreios.LogradouroTipo AS LogradouroTipo,
enderecoscorreios.CEP AS CEP,
enderecoscorreios.Bairro AS Bairro,
enderecoscorreios.BairroAbrev AS BairroAbrev,
enderecoscorreios.IDCidade AS IDCidade,
enderecoscorreios.Cidade AS Cidade,
enderecoscorreios.SubCidadeAbrev AS SubCidadeAbrev,
enderecoscorreios.SubCidade AS SubCidade,
enderecoscorreios.CodIBGECid AS CodIBGECid,
enderecoscorreios.CodIBGEUF AS CodIBGEUF,
enderecoscorreios.UF AS UF,
enderecoscorreios.Pais AS Pais,
enderecoscorreios.LogradouroIniciais AS LogradouroIniciais,
enderecoscorreios.NumeroInicial AS NumeroInicial,
enderecoscorreios.NumeroFinal AS NumeroFinal,
enderecoscorreios.DMSLatitude AS DMSLatitude,
enderecoscorreios.DMSLongitude AS DMSLongitude,
enderecoscorreios.GDLatitude AS GDLatitude,
enderecoscorreios.GDLongitude AS GDLongitude,
MATCH(enderecoscorreios.LogradouroUpper, enderecoscorreios.LogradouroAbrev, enderecoscorreios.Logradouro, enderecoscorreios.LogradouroCompl, enderecoscorreios.Fonetica, enderecoscorreios.LogradouroTipo, enderecoscorreios.CEP, enderecoscorreios.Bairro, enderecoscorreios.BairroAbrev, enderecoscorreios.Cidade, enderecoscorreios.SubCidadeAbrev, enderecoscorreios.SubCidade, enderecoscorreios.UF, enderecoscorreios.Pais, enderecoscorreios.LogradouroIniciais) AGAINST({ParamKFulltext}) AS FullTextPertinence
FROM
enderecoscorreios
WHERE
FullTextPertinence > {ParamFullTextPertinence}
ORDER BY
FullTextPertinence DESC




SELECT
clientes.id AS id,
clientes.Nome AS Nome,
clientes.Email AS Email,
clientes.Celular AS Celular,
clientes.Token AS Token
FROM
clientes
WHERE
clientes.Token = {ParamToken}




INSERT INTO wslog
(
datahora,
ip,
Token,
acao
)
VALUES
(
{Paramdatahora},
{Paramip},
{ParamToken},
{Paramacao}
)


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Registered member
3,651 messages
Popularité : +175 (223 votes)
Posted on August, 30 2017 - 5:49 AM
Webservice para consulta de CEP

http://wxmagazine.pcscloud.net/WSCEP_WEB/awws/index.htm

http://wxmagazine.pcscloud.net/WSCEP_WEB/awws/WsCep.awws?wsdl


















Para usar importe o link WSDL para sua aplicação Windev, Webdev ou Windev Mobile informando esse endereço:

http://wxmagazine.pcscloud.net/WSCEP_WEB/awws/WsCep.awws?wsdl


Para usar em sua aplicação:

//Webservice
//############################################################################
XML_Retorno is string = ""

RetornoXml is a Ws_BuscaEnderecoResponse

RetornoXml = Ws_BuscaEndereco(0120120120120120120120120120120120120,"Clavio Molinari")

XML_Retorno = RetornoXml.Ws_BuscaEnderecoResult
//############################################################################


Para usar basta solicitar o cadastro pelo e-mail adrianoboller@gmail.com ou pelo skype adrianoboller

:merci:

--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/