converting google hunt query postgresql "tsquery"


how i modify google hunt query something i feed postgresql's to_tsquery() ?



if there's existent library out there, should i parsing google hunt query libel php?



for example, i'd take following google-ish hunt query:



("used cars" "new cars") -ford -mistubishi


and spin to_tsquery()-friendly string:



('used cars' | 'new cars') & !ford & !mistubishi


i fudge regexes, nonetheless that's best i do. there strong verbatim research slight going this? i'd means support extended hunt operators too (like google's site: intitle:) ask opposite database fields, so need distant tsquery string.



update: i comprehend special operators becomes google sql where-clause conversion, rather google tsquery conversion. nonetheless where apportionment competence enclose some-more tsqueries.



for example, google-style query:



((color:blue "4x4") style:coupe) -color:red used


should furnish an sql where-clause this:



where to_tsvector(description) review to_tsquery('used')
tone <> 'red'
( (color = 'blue' to_tsvector(description) review to_tsquery('4x4') )
impression = 'coupe'
);


i'm certain above illusory regex?



Comments

Popular posts from this blog

list macos calm editors formula editors

how i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members