We are looking into upgrading our Sphinx to version 3.3.1 (currently on 2.2.11).
Now, we are running into an issue with some MVA attributes which are used for facets.
Snippet of our sphinx config:
sql_attr_multi = uint applicantids from field applicantids
The applicantids column in the db is a string containing a comma separated list, some records are an empty string (not null).
This is the error we receive when making a query with applicantids as a facet request:
column 'applicantids' (alias 'applicantids') has incompatible types
across shards
We were wondering if this could be caused by the empty records being handled differently in the new Sphinx version?
This does sound like you've defined the 'applicantids' attribute differently in different indexes. (shards are a another name for a part of a index)
Should use sql_attr_multi in all parts of the index. Even if it indexing an empty string - it should index that as a empty list.
Related
I have a collection with shipments in them.
I want to filter on postalcode which is a part of the 'address_from' map.
Is this possible and are there extra steps required, indexes for example, to make this work?
query.where('address_from.postalcode', '==', shipment_code);
That query should just work. Any single field query should work without creating an index, as all fields are indexed by default. Queries that require an index will yield and error message telling you that one needs to be created, and provide a link to the console to automatically do that.
We have a database structured as follows:
Collection foo
Documents
Collection bar
Documents with many fields (approaching the 1 MB limit)
Trying to write a document to the bar collection containing 34571 fields, I get (from the Go API):
rpc error: code = InvalidArgument desc = too many builtin index entries for entity
OK, fine, it seems I need to add an exemption:
Large array or map fields
Large array or map fields can approach the limit of 20,000 index entries per document. If you are not querying based on a large array or map field, you should exempt it from indexing.
But how? The console only lets me set a single collection name and a single field path, and slashes aren't accepted:
I tried other combinations, but / isn't accepted in either the Collection ID or the Field path, and using ., while not clearly forbidden, results in a generic error when trying to save the exemption. I'm also not sure if * is allowed.
Index exemptions are based on collection ID and not collection path. In this case, you can enter bar as the collection ID. This also means the exemption applies to all collections with ID bar, regardless of hierarchy.
As for the fields, you can specify only a single field path per exemption. The "*" all-selector is not supported. There is a limit of 200 index exemptions so you wouldn't be able to exempt all 34571 fields. If possible, I suggest moving your fields into a map. Then you could disable indexing on the map field.
I have a collection that contains documents with string fields that sometimes contain only numerical data. I would like to write a query that utilizes the aggregation framework to filter, project and group data, but this is failing to work as expected due to the fact that the field I would like to $avg is a string. Is there any way to project a field into a different type (in this case, from string to double) ?
I am trying to run a query on Lucene .NET 2.9.2 index without any luck:
My index holds documents, some of them contain numeric field called "MyNum" and some of them are not.
The field is indexed.
I am trying to count the total documents that contain the field, no matter the fields value.
Could some one please help me out?
A query like fieldX:* should return all of the documents that contain field "fieldX".
You may need to allow for a prefixed * in your search (I don't have a copy of Lucene up at the moment.)
You may use the wildcard query to retrieve all documents with specific field. Just provide the * as value (this is just regular wildcard). Here is the sample code:
IndexSearcher searcher = new IndexSearcher(reader);
TopDocs docs = searcher.Search(new WildcardQuery(new Term("MyNum", "*")), int.MaxValue);
Console.WriteLine(docs.TotalHits);
I have a number of different documents in a mongo collection.
The attrs are all numeric values. I don't know apriori what the fieldnames are (I do but they can vary from doc to doc).
I want to write a program that
a) gets all the unique fieldnames in a collection
b) finds the max and min value of each field in the collection
and then reports it in a tabular form with rows "fieldname, maxvalue, minvalue" or in JSON that is equivalent. I am using pymongo but I don't have to, ruby or js or even java driver is fine.
How do I get programmatic access to the list of unique fieldnames in a collection? That's
the major question. I can manage the rest.
Either you main the list of used key inside your application as part of your application logic in some document inside the same collection or a meta-collection yourself or you have to iterate over all documents to figure out the list of keys...there is nothing in MongoDB helping you here since MongoDB is schemaless.