mapping

Mapping for array of geo_point fields in elastic

大兔子大兔子 提交于 2020-01-14 10:42:28
问题 I'd like to persist some JSON to elastic(search) that looks a little like this: { "name": "value", "points": [ { "lat": 0.0, "lon": 0.0 }, { "lat": 1.0, "lon": 1.0 } ] } Points being a list of the type geo_point in elastic. Because they're geo_point values I need to define the index mapping, but the closest I can see is to do this: "place": { "properties": { "name": { "type": "string" }, "points": { "properties": { "location": { "type": "geo_point" } } } } } Which would mean having each point

WeakValueDictionary retaining reference to object with no more strong references

倖福魔咒の 提交于 2020-01-14 10:09:53
问题 >>> from weakref import WeakValueDictionary >>> class Foo(object): ... pass >>> foo = Foo() >>> db = WeakValueDictionary() >>> db['foo-id'] = foo >>> del foo >>> dict(db) {'foo-id': <__main__.Foo object at 0x4dd946c>} Why does it show this instead of an empty dictionary? Note that this code produces the result I'd expect: >>> db2 = WeakValueDictionary() >>> db2['disposable-id'] = Foo() >>> dict(db2) {} It also behaves as expected when executing a script (instead of the interactive interpreter

How to Map Object / Class Property to Dictionary When Object Property And Dictionary Key Names Are Different?

…衆ロ難τιáo~ 提交于 2020-01-14 06:29:09
问题 I am calling Bloomberg Server API (for Stock Market Data) and getting Data back in a Dictionary<string, object> Where the Key to the dictionary is the Field Name on Bloomberg's side, and the object contains the data value from Bloomberg and can be string , decimal , DateTime , boolean etc. After I get the Bloomberg Data, I need to populate my strong type entities / classes with the values returned. Depending on what Field Names I send in my request to bloomberg, the returned Dictionary could

How to map User Data Type (Composite Type) with Hibernate

女生的网名这么多〃 提交于 2020-01-14 02:03:30
问题 I am quite new to Hibernate world. I have modeled by means of ER CASE TOOL (TOAD) my database and I have defined several User Data Type (Composite Type). For example assume I have a type Contact declared as follow in PostgreSQL CREATE TYPE Contact AS ( "email" Varchar, "phone" Varchar, "mobile" Varchar, "other" Varchar ); Now assume i use it on Users Entity like in the following SQL code CREATE TABLE Users( idUser Serial NOT NULL, login Character varying(20) NOT NULL, password Character

Mapping a list of Enums

元气小坏坏 提交于 2020-01-13 14:09:16
问题 I have a table called UserPermissions with a FK to the users table by userId and then a string column for the string value of an enum. The error I am seeing is NHibernate.MappingException: An association from the table UserPermissions refers to an unmapped class: GotRoleplay.Core.Domain.Model.Permission My Permission Enum: public enum Permission { [StringValue("Add User")] AddUser, [StringValue("Edit User")] EditUser, [StringValue("Delete User")] DeleteUser, [StringValue("Add Content")]

Mapping a list of Enums

。_饼干妹妹 提交于 2020-01-13 14:06:23
问题 I have a table called UserPermissions with a FK to the users table by userId and then a string column for the string value of an enum. The error I am seeing is NHibernate.MappingException: An association from the table UserPermissions refers to an unmapped class: GotRoleplay.Core.Domain.Model.Permission My Permission Enum: public enum Permission { [StringValue("Add User")] AddUser, [StringValue("Edit User")] EditUser, [StringValue("Delete User")] DeleteUser, [StringValue("Add Content")]

Table Mapping problem

时光总嘲笑我的痴心妄想 提交于 2020-01-13 06:59:07
问题 I am using entity framework 4 in my current project, to read data from several table. Compare using ADO.net, it EF is very easy, with simple code that can do lots of work or me. But there is one problem... e,g there is and exiting table call Table "MTable" i only want to query two column from this table, however this table is share with other two ppl who are also working on it. they might add column or modify constrains on this table. Only one thing i am sure is that, the two column i want to

Unprojecting 2D Screen Coordinates to 3D Coordinates

☆樱花仙子☆ 提交于 2020-01-12 08:52:30
问题 I was wondering how I would go about mapping 2D screen coordinates to a 3D world (specifically the xz plane) knowing: -position of the camera -equation of the screen plane -equation of the xz plane All I want to do is have the land on the xz plane light up when I hover the mouse over it. Any help is greatly appreciated! Thanks! 回答1: If your world is rotated and shifted such that the camera is at x=y=z=0 (world coordinates), the world z coordinate increases away from the viewer (into the

Unprojecting 2D Screen Coordinates to 3D Coordinates

风流意气都作罢 提交于 2020-01-12 08:52:22
问题 I was wondering how I would go about mapping 2D screen coordinates to a 3D world (specifically the xz plane) knowing: -position of the camera -equation of the screen plane -equation of the xz plane All I want to do is have the land on the xz plane light up when I hover the mouse over it. Any help is greatly appreciated! Thanks! 回答1: If your world is rotated and shifted such that the camera is at x=y=z=0 (world coordinates), the world z coordinate increases away from the viewer (into the

How to perform nested queries with Elastica Search and Symfony2

点点圈 提交于 2020-01-12 06:16:30
问题 I have a recipe entity which have some tags (many to many mapping) and I want to search recipes by tags. Here's my Recipe entity: /** * @ORM\Entity * @ORM\Table(name="recipes") * @ORM\HasLifecycleCallbacks * @ExclusionPolicy("all") */ class Recipe { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") * @Expose */ protected $id; /** * @ORM\Column(type="string", length=150) * @Expose */ protected $name; ... /** * @ORM\ManyToMany(targetEntity="RecipesTag",