Separate search in different tables with sphinx [duplicate] - sphinx

This question already has answers here:
Searching a particular index using Sphinx, from multiple indexes, through PHP script
(2 answers)
Closed 8 years ago.
In my case content are saving in table
content_en
Search with sphinx works good.
I would to add another table content_es and make search in this table.
And if user will be search on en version site - i would use content_en table, if on spain version - content_es table.
I can search in 2 tables and on PHP side make filter, but I think it's not correct.
How it's make correct ? (like $sphinx->SetOption() or $sphinx->SetIndex()) ?

$res = $cl->Query($query,"content_es");

Related

Delete multiple rows from a table with a single query when the row ids are not consecutive [duplicate]

This question already has answers here:
How to delete from a table where ID is in a list of IDs?
(3 answers)
Closed 2 years ago.
I've created a mass delete feature on my website where the user gets to select which rows they want to delete before pressing a delete button. It currently works by creating an array containing each selected row's id, before looping through that array and calling a delete query for each one. I was wondering if there is a way to do with with a single query, while keeping in mind that the user may want to keep a row that in between the rows they would like to delete.
You can use IN clause for this.
Sample query may look like below
DELETE FROM table WHERE id IN (1, 4, 6, 7)

How to access unmapped data in embedded forms? [duplicate]

This question already has answers here:
Symfony - retreive unmapped fields in nested forms
(2 answers)
Closed 2 years ago.
I've embedded a collection of forms like here: Embedding a collection of forms. Empty results
In my controller, I would like to access (get and set) unmapped fields, like view, new, edit, delete.
How do I do that?
I've tried dumping the form, but I couldn't find the submitted data anywhere.
You can just use
$request = Request::createFromGlobals();
$request->get('formname')['formfield']
to get your form values.

Is there a way to insert a camelcase table name in pgadmin?

I have a DB with table names written in underscore format. I want to edit their names and also to be able to name every new table in a camelcase format
Still, whenever I use a query to call a camelcase table name I have to do it using double quotes. I do not want double or single quotes. Only the table name. Is it possible?
I have found a similar post describing 3 possible options about naming a table column in pgAdmin not including what I am looking for.
Also, that was 6 years ago and I am wondering if some things have changed since then, while I have not found any solution yet.

Postgres. Have to user public.user to query users [duplicate]

This question already has answers here:
Cannot access table without public.table name. Is there a way to get rid of public?
(2 answers)
Closed 7 years ago.
I'm using postgres on heroku with a node app.
I'm connecting to my database no problem and I can query all my other tables no problem
select * from org; works perfectly.
My problem is querying users which are obviously called user
select * from user seems to be returning the postgres database user name.
If I use select * from public.user I get the list of users I've created.
Is there a way of just using user?
I'm sure I've missed something simple.
USER is a reserved word in SQL Standard, thus it also is in PostgreSQL.
You should NOT use that as your table name.
Type select user to see that it will also give you the name of user that holds current conection to the database.
As to your question, there is no way of using just user as a reference to your table.
From documentation, bold emphasis mine:
SQL distinguishes between reserved and non-reserved key words. According to the standard, reserved key words are the only real key words; they are never allowed as identifiers. Non-reserved key words only have a special meaning in particular contexts and can be used as identifiers in other contexts.

Odata - nested $select and $expand [duplicate]

This question already has answers here:
odata - combining $expand and $select
(2 answers)
Closed 7 years ago.
http://services.odata.org/V4/Northwind/Northwind.svc/
I'm trying to get all Customers, their Orders and corresponding Order_Details at once and using nested $expand for that. To query the data I'm using following link: http://services.odata.org/V4/Northwind/Northwind.svc/Customers?$expand=Orders($expand=Order_Details)
Now I'm trying to limit the data using $select. The problem is that I can not find the proper syntax to use $select for the middle table - Orders. I can apply it just to the top table - Customers and to the bottom one - Order_Details like this:
http://services.odata.org/V4/Northwind/Northwind.svc/Customers?$select=CustomerID&$expand=Orders($expand=Order_Details($select=UnitPrice))
Is it possible to use $select also for tables in between, in my case for Orders?
Thanks #nlips for his comment.
It is possible to use $select for the middle table by just separating select and expand with semicolon:
http://services.odata.org/V4/Northwind/Northwind.svc/Customers?$select=CustomerID&$expand=Orders($select=OrderID;$expand=Order_Details($select=UnitPrice))