SphinxQL MATCH - how to use? - sphinx

Explain to me please, what's the MATCH() operator in SphinxQL - how to use it?
Sorry if my question is stupid for somebody, but I really couldn't find any normal explanation in the Web of this.
For example, I have this request:
SELECT tid FROM message WHERE MATCH('test');
What does it mean?
Thanks.

Its quite literally the 'workhorse' of sphinx. The query you want to 'search' the index with. Pretty much the point of Sphinx is to run 'full-text queryies'
http://sphinxsearch.com/docs/current.html#extended-syntax
http://sphinxsearch.com/docs/current.html#sphinxql-select

Related

TYPO3 queryBuilder: How to work with BINARY in where() clause?

I just have a short question.
There's no description in the following API overview of TYPO3 how to use a "BINARY" in where() clause: https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Database/QueryBuilder/Index.html#expr
What I want to achieve? this one:
WEHRE BINARY `buyer_code` = "f#F67d";
Actually I can only do the following:
->where(
$queryBuilder->expr()->eq('buyer_code', 'f#F67d')
);
But in this case I don't get a satisfying result for myself because I need case-sensitive here :-)
An another buyer_code exists "f#F67D" (the last char is uppercase) but I do need to look for the other one.
Thanks for helping.
Since TYPO3 is using Doctrine API here, you could try to do
->where('BINARY `buyer_code` = ' . $queryBuilder->createNamedParameter('f#F67d'))
Please keep in mind, that this query now only works for database backends, supporting the BINARY keyword!
Please have a look at Doctrine2 case-sensitive query The thread is a bit older, but seems to cover background and solution for your problem.

How to sscanf this string?: "+CPMS: \"ME\",18,255,\"ME\",18,255,\"ME\",18,255"

So, I'm developing an application in C and I need to sscanf a string.
+CPMS: \"ME\",18,255,\"ME\",18,255,\"ME\",18,255
I need to get the number between the first and second commas, 18 in this example, but it can be from 0 to 255.
I'm trying to create the placeholder to get this but I can't seem to make it work.
I've tried lots of thing, but I can't understand why:
sscanf(pointer, "+CPMS: \"%*s\",%d", &intPointer);
doesn't work.
Can anyone help me?
Thank you.
Well, I'm going to answer my own question.
sscanf(pointer, "+CPMS: \"%*2s\",%d", &intPointer);
It looks like I needed to put the number of characters to ignore.
Hope it help someone else.

ElasticSearch - filter terms for autocomplete

I would like for an autocomplete to get the terms starting with some specific characters.However, the terms returned do not begin with the specified text ("wer" in this case), and more than that, no matter what the prefix content is, they are always the same. The query I am using now is:
{"facets":
{"count":
{"terms":
{"field":"content"},
"facet_filter":
{"prefix":{"content":"wer"}}
}
},
"size":0
}
I am wondering what am I missing or doing wrong. Any help much appreciated. Thanks!
Perhaps you miss a "query" entry after the facet_filter.
If this does not help try regex pattern for facets, but be aware that facets will be removed in future updates of elasticsearch.
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-terms-facet.html#_regex_patterns

Reverse search at mongodb

I have tried to search around for clues but didn't find any.
Please let me ask a question about reverse search for mongodb.
I have a collection that contain a phone prefix, let say bellow.
{"prefix":"1234"}
and i am trying to make it hit with value like 12341111 or 12342222 ...
in MySQL i can do it with below SQL.
SELECT * from phoneprefix where ‘12341111’ like concat(prefix,’%’)
Is there anyway to make it possible at mongodb ?
Thanks for reading my post and please have a nice day !
The only way I can see to do this is to use the performance-challenged $where operator:
db.phoneprefix.find({$where: function() {
return (new RegExp('^' + this.prefix)).test('12341111');
}});
You could use $regex in MongoDB.

Sphinx Search term boost

Is there a way I can add a weight to each word in my query?
I need to do something like this (Lucene query):
"word1^50|word2^45|word3^25|word4^20"
All answers I found online are old and I was hoping this changed.
UPDATE:
Sphinx introduced term boosting in version 2.2.3: http://sphinxsearch.com/docs/current/extended-syntax.html
Usage:
select id,weight() from ljplain where match('open source^2') limit 2 option ranker=expr('sum(max_idf)*1000');
No nothing really changed. The same old workarounds should still work tho.