Sphinx search with xml pipe - sphinx

I have one json array of Objects.I am creating sphinx compatible xml document from this JSON Array.For each object i create one document and specify id value for it.For example if json array contains 20 objects then i have to create 20 documents starting from 1 to 20.Now my json array update with time and new Objects come in place so i need to assign them id starting from 21 and so on.So is there any way to maintain this id values from Sphinx side internally?

Just store the latest used id somewhere. A text file or something.
Or just get the highest id from the sphinx index. So the script building the xml file, could just first run a sphinxql query
select id from gi_stemmed order by id desc limit 1;

Related

Google Datastore Multiple filter query

Prob- I want to query saved data from datastore as
id - [1,2,3]
2ndid - something,
Solution- It must get all the records for id-[1,2,3] where 2ndid - something gets match,
basically I want to filter based on 2ndId-something and want to get all records for the item which gets matched from id array.
ex- Table
id 2ndid
1 something
2 something
after query i must get records of id[1,2] as id[3] is not present
I tried for single id and single 2nd id, it worked but not working for array.

Are Parse IDs deterministic?

I know that in Mongo, when you create IDs, the IDs are created in part by a time element which can be nice for sorting without using any other keys like createdAt or updatedAt. Is the same true for IDs created in Parse?
Parse-server doesn't use deterministic IDs for the object but 10 characters random strings (which can be configured on your side also if you wish to have longer objectIds)
https://github.com/parse-community/parse-server/blob/master/src/cryptoUtils.js#L39

Get a document from couchbase lite database swift

I want to retrieve a document from database to update it, so I need the document ID, how to get this ID if I didn't create the document with a custom ID (I've used database.createDocument() instead of database.documentWithID("docId"))
Thanks
If you haven't created the document with a custom Id then you can use
some other uniquely identifying property (or properties) of the document to query for the specific document.
Instead of querying and iterating over entire list of documents to find the match, you can create a view with the specified property/properties as index. You can then query for that view with startKey / endKey set to the desired property value. That will return the document of interest.
Alternatively,if it's an option, create the document with a custom ID.

Can mongo document ID format be customised?

I would like to encode some meaning behinds first N characters of every document ID i.e. make first three characters determine a document type sensible to the system being used in.
You can have a custom _id when you insert the document. If the document to be inserted doesn't contain _id, then MongoDB will insert a ObejctId for you.
The _id can be of any type but keeping it uniform for all the documents makes sense if you are accessing from application layer.
You can refer one of the old questions at SO - How to generate unique object id in mongodb

create unique id in mongodb from last inserted id using pymongo

Is there a way I can find the last inserted document and the field, i.e. _id or id such that I can increment and use when inserting a new document?
The issue is that I create my own id count, but I do not store this, now I've deleted records, I cannot seem to add new records because I am attempting to use the same id.
There is no way to check insertion order in MongoDB, because the database does not keep any metadata in the collections regading the documents.
If your _id field is generated server-side then you need to have a very good algorithm for this value in order to provide collision avoidance and uniqueness while at the same time following any sequential constraints that you might have.