Allowing single not operator


I’m facing the problem to have a single not match condition into query it would be great to be able to have this option as:

select * from rt where match(’( (@ft_subject -“some text” ))’) and ( ts_sent >= 1533074400 and ts_sent <= 1535752799 )order by ts_sent desc limit 0,50


A quick and dirty solution is just to arrange for a word to be in every document

 sql_query = SELECT id, '_ALL' AS all, ft_subject, ... 

Then can just use that

where match(’@all _ALL @ft_subject -“some text”’) 

also as ranking in this case is meaningless (there are no actual positive keywords) and ordering by an attribute anyway, may as well disable ranking

option ranker=none

It doesn’t works it return me this error:

ERROR 1064 (42000): sphinxql: syntax error, unexpected AS, expecting ‘=’ near ‘as all from rt where match(’@all _ALL @ft_subject -“some text”’)’

Ah, the '_ALL' AS all was to go in your sql_query - in the definition of a disk index, to create a new ‘fake’ field, called all.

Not to go in the SphinxQL query itself.

Only now notice your index is called rt so perahaps its Real Time Index?

Createing such a field will need a new rt_field in the index definition, but also possibly the index recreateing from scratch, because each ‘INSERT INTO’ the index, will need to send data for the field.

INSERT INTO rt (id,all,ft_subject,ts_sent) VALUES ($id, '_all', $content, $ts_sent) 

where the all field is literally a hardcoded string.

I’ll give it a try