[Xapian-discuss] Xapian with Json
Peter Karman
peter at peknet.com
Mon Jun 22 16:04:14 BST 2015
Carlos Pacheco wrote on 6/20/15, 3:19 PM:
>
> Another problem that I have is that: In the same name/value pair sometimes I have different data types (date, text, number), so I don’t know how to search in it.
>
> Maybe that's a ridiculous question, but I’m a newbie.
>
> For example:
>
> {
> “id”: 10,
> “dinamic_fields”:
> [
> {
> “field_name”:”Name"
> “field_value”:”Carlos Antonio"
> },
> {
> “field_name”:”Birthday"
> “field_value”:”1975-04-23T18:25:43.511Z"
> },
> {
> “field_name”:”Age"
> “field_value”:40
> },
>
> ]
> }
>
> Sometimes I need to search in “field_value" by text, sometimes by date interval, sometimes by specific date, sometimes by number, sometimes by number range, etc.
>
> How can I search by “field_value” once we have Text, Dates and Number values in the same Key but in different array item (theres in no order) ?
>
I would run your JSON through a filter that turns each 'field_name' into an
actual field:
id: 10,
name: "Carlos Antonio",
birthday: ”1975-04-23T18:25:43.511Z"
etc. You can write such a filter in any language you're comfortable with.
--
Peter Karman . http://peknet.com/ . peter at peknet.com
More information about the Xapian-discuss
mailing list