Adding WHERE to HTTP request


#1

Hi all,

We have very little experience with Sphinx/Manticore, so apologies if this is a bit of a noob question.

We can perform a request successfully with:

http://it-sphinx-server:9380/search?index=idx_masdatavendornames&match=@vendor_name “clemson and sons etc”/2&select=id,weight()&limit=5

But we want to limit the results by only those having a specific value in our ‘company_id’ sql_attr_uint.

We have tried the following but it doesn’t work:
http://it-sphinx-server:9380/search?index=idx_masdatavendornames&match=@vendor_name%20"clemson%20and%20sons%20etc"/2&select=id,weight()&limit=5&where=(company_id=2)
http://it-sphinx-server:9380/search?index=idx_masdatavendornames&match=@vendor_name%20"clemson%20and%20sons%20etc"/2&select=id,weight()&limit=5&where=company_id=2

How should we implement a WHERE clause?

Thank you.


#2

Dont think can use /search endpoint, from the docs

Allows a simple full-text search, parameters can be :

  • index (index or list of indexes)
  • match (equivalent of MATCH())
  • select (as SELECT clause)
  • group (grouping attribute)
  • order (SQL-like sorting)
  • limit (equivalent of LIMIT 0,N)

… there is no ‘where’ param.

You’ll have to use the /sql endpoint, and specify it as a full SELECT SphinxQL query,


#3

Okay, thanks Barry :slight_smile: