Depends I would think on how you are putting/posting the data.  If via XML or 
URL parameters, I can't see how Neo would know whether it was a string or a 
number, but if via JSON you should be able to get it in there properly.

Perhaps the REST API should support passing content via either the URL or via a 
POST'ed payload.  That's what we do with our internally created REST API today 
(support URL parameters, XML, or JSON for all calls, with the URI defining the 
"intent" or the "method" and query parameters XML/JSON defining the 
"parameters").

I know the REST API has some "soak time" already, but I would seriously 
consider redesigning parts of it to treat some of the parameters differently 
when the Content-Type is JSON (e.g. pass them in the payload, not the URI, as 
with the REST API that lets you create a node w/properties).  Let's take 
indexing for example.  The approach I'm proposing would allow an atomic call to 
index multiple fields, rather than one at a time, as with the current approach, 
and it would allow more flexible data types.  Indexing all the fields at once 
is, to me, an essential capability to ensure the semantic integrity of the 
graph.

An example is:

POST http://localhost:7474/db/data/index/node/favorites

POST Content :

{
  "fields" : [
        {
          "key" : "key1"
          "value" : 12345
        },
        {
          "key" : "key2"
          "value" : "ABC"
        },
        {
          "key" : "key3"
          "value" : [ "Dogs", "Cats", "Sheep" ]
        }
  ]
}

*Accept: application/json
*Content-Type: application/json


-----Original Message-----
From: Peter Neubauer [mailto:neubauer.pe...@gmail.com]
Sent: Wednesday, June 15, 2011 10:30 AM
To: Matt Luongo
Cc: Neo4j user discussions; Rick Bullotta
Subject: Re: [Neo4j] REST API & LuceneTimeline

Matt,
inserting by other than String in
http://docs.neo4j.org/chunked/snapshot/rest-api-indexes.html#rest-api-add-node-to-index
is not supported. A shortcoming. This is probably what your plugin
should be doing in that case. Will add that as a ticket to be tracked.

http://neo4jdb.lighthouseapp.com/projects/77609-neo4j-community/tickets/9-support-inserting-index-values-other-than-string-via-rest

-peter

On Wed, Jun 15, 2011 at 4:27 PM, Matt Luongo <m...@scholr.ly> wrote:
> It does- awesome, I didn't realize the query syntax would work for
> numeric fields, as well. Now I just need to figure out how to insert
> into a numeric field via rest.
>
> --
> Matt Luongo
> Co-Founder, Scholr.ly
>
>
>
> On Wed, Jun 15, 2011 at 10:24 AM, Rick Bullotta
> <rick.bullo...@thingworx.com> wrote:
>> Hi, Matt.
>>
>> We don't use the REST API (we use Neo4J in an embedded mode), so I can't be 
>> of much help there.  If the REST API supports Lucene query syntax, you can 
>> use something like:
>>
>> timestamp : [1111111111111 to 2222222222222]
>>
>> You'd need to do the Date <-> UTC milliseconds conversion on the front end, 
>> I'd think.
>>
>> Rick
>>
>> -----Original Message-----
>> From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On 
>> Behalf Of Matt Luongo
>> Sent: Wednesday, June 15, 2011 10:03 AM
>> To: Peter Neubauer
>> Cc: user@lists.neo4j.org
>> Subject: Re: [Neo4j] REST API & LuceneTimeline
>>
>> Peter,
>>
>> Kind of. I see how I could do that server-side, but not how to insert
>> elements into the index numerically (with
>> ValueContext(val).indexNumeric()) or query by range (
>> .query(QueryContext.numericRange(....) ) via REST. Is this something
>> that will require our writing a plugin to support, or is there
>> currently some way to index and query numerically via the REST API?
>>
>> --
>> Matt Luongo
>> Co-Founder, Scholr.ly
>>
>>
>>
>> On Wed, Jun 15, 2011 at 9:25 AM, Peter Neubauer
>> <neubauer.pe...@gmail.com> wrote:
>>> Yeah,
>>> just checked with Mattias. There is no such index configuration, so
>>> this does not work. I think you should use the numeric field in a
>>> normal index for this, just like Rick points out.
>>>
>>> Does that make sense?
>>>
>>> /peter
>>>
>>> On Wed, Jun 15, 2011 at 3:03 PM, Matt Luongo <m...@scholr.ly> wrote:
>>>> Peter,
>>>>
>>>> I believe it was something like
>>>>
>>>> curl -X POST -H Accept:application/json -HContent-Type:application/json -d 
>>>> \
>>>>  '{"name":"time", "config":{"type":"timeline","provider":"lucene"}}' \
>>>>  http://localhost:7474/db/data/index/node
>>>>
>>>> curl -HContent-Type:application/json -X POST -d \
>>>>  '"http://localhost:7474/db/data/node/0";' \
>>>>  http://localhost:7474/db/data/index/node/time/timestamp/25
>>>>
>>>> which gives a 500.
>>>> --
>>>> Matt Luongo
>>>> Co-Founder, Scholr.ly
>>>>
>>>>
>>>> On Wed, Jun 15, 2011 at 8:55 AM, Rick Bullotta
>>>> <rick.bullo...@thingworx.com> wrote:
>>>>>
>>>>> You really don't need a timeline index to do a timeline index, if that 
>>>>> makes sense.  As mattias points out, it is just a convenient wrapper 
>>>>> around a plain lucene (neo) index.  Just index the timestamp as a numeric 
>>>>> field.
>>>>>
>>>>>
>>>>>
>>>>> ----- Reply message -----
>>>>> From: "Matt Luongo" <m...@scholr.ly>
>>>>> Date: Wed, Jun 15, 2011 8:48 am
>>>>> Subject: [Neo4j] REST API & LuceneTimeline
>>>>> To: "Neo4j user discussions" <user@lists.neo4j.org>
>>>>>
>>>>> Peter,
>>>>>
>>>>> I've done a bit more research, and you're right- it isn't. However, the 
>>>>> REST
>>>>> api let's me create an index of type 'timeline'. The first time I try to
>>>>> index a node, there's a 500 error (nullpointer) that stems from the index
>>>>> not being created. I'd be happy to file a bug report.
>>>>>
>>>>> Anyway, we're trying to put together a plugin to expose timeline indexing
>>>>> via REST.
>>>>>
>>>>> - Matt
>>>>> On Jun 15, 2011 5:49 AM, "Peter Neubauer" 
>>>>> <peter.neuba...@neotechnology.com>
>>>>> wrote:
>>>>> > Matt,
>>>>> > what URL are you using to create the timeline? I don't recall that
>>>>> > being exposed via REST ...
>>>>> >
>>>>> > Cheers,
>>>>> >
>>>>> > /peter neubauer
>>>>> >
>>>>> > GTalk:      neubauer.peter
>>>>> > Skype       peter.neubauer
>>>>> > Phone       +46 704 106975
>>>>> > LinkedIn   http://www.linkedin.com/in/neubauer
>>>>> > Twitter      http://twitter.com/peterneubauer
>>>>> >
>>>>> > http://www.neo4j.org               - Your high performance graph 
>>>>> > database.
>>>>> > http://startupbootcamp.org/    - Ă–resund - Innovation happens HERE.
>>>>> > http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>>>>> >
>>>>> >
>>>>> >
>>>>> > On Mon, May 30, 2011 at 11:16 PM, Matt Luongo <m...@scholr.ly> wrote:
>>>>> >> Forgive me if this is a foolish question. I'm really excited about 
>>>>> >> using
>>>>> the
>>>>> >> LuceneTimeline in our product. I see that I can create it via
>>>>> >> "type":"timeline" in the REST interface. I'm not sure, though, how to 
>>>>> >> add
>>>>> >> nodes to the timeline- it seems like you add things to a timeline by
>>>>> >> specifying just a timestamp, not key/value, but I can only find REST
>>>>> >> examples for indexing nodes by key/value. Anyone care to share a code
>>>>> >> snippet?
>>>>> >>
>>>>> >> --
>>>>> >> Matt Luongo
>>>>> >> Co-Founder, Scholr.ly
>>>>> >> _______________________________________________
>>>>> >> Neo4j mailing list
>>>>> >> User@lists.neo4j.org
>>>>> >> https://lists.neo4j.org/mailman/listinfo/user
>>>>> >>
>>>>> > _______________________________________________
>>>>> > Neo4j mailing list
>>>>> > User@lists.neo4j.org
>>>>> > https://lists.neo4j.org/mailman/listinfo/user
>>>>> _______________________________________________
>>>>> Neo4j mailing list
>>>>> User@lists.neo4j.org
>>>>> https://lists.neo4j.org/mailman/listinfo/user
>>>>
>>>
>> _______________________________________________
>> Neo4j mailing list
>> User@lists.neo4j.org
>> https://lists.neo4j.org/mailman/listinfo/user
>> _______________________________________________
>> Neo4j mailing list
>> User@lists.neo4j.org
>> https://lists.neo4j.org/mailman/listinfo/user
>>
>

_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to