Re: [Neo4j] Fwd: Lucene Custom Sort in Neo4j

2011-11-22 Thread Mattias Persson
As a parameter to the index GET perhaps?

GET .../index/node/myindex?query=name:*sort=GivenNameorder=desc

2011/11/22 Peter Neubauer peter.neuba...@neotechnology.com

 I agree.
 Sending arbitrary Groovy is not what you want a database to execute. Do you
 see any good index - neutral way to expose this? It's even very relevant to
 Cypher...

 /peter

 Sent from my phone, please excuse typos and autocorrection.
 On Nov 22, 2011 4:46 AM, Tatham Oddie tat...@oddie.com.au wrote:

 
 
  --
  Tatham Oddie
  Tiny keyboard = tiny message
 
  Begin forwarded message:
 
  From: Tatham Oddie tatham.od...@readify.onmicrosoft.commailto:
  tatham.od...@readify.onmicrosoft.com
  Date: 22 November 2011 14:43:00 AEDT
  To: tat...@oddie.com.aumailto:tat...@oddie.com.au 
 tat...@oddie.com.au
  mailto:tat...@oddie.com.au
  Subject: FW: Lucene Custom Sort in Neo4j
 
 
 
  From: Tatham Oddie [mailto:tatham.od...@readify.onmicrosoft.com]
  Sent: Tuesday, 22 November 2011 2:42 PM
  To: Romiko Derbynew; user@lists.neo4j.orgmailto:user@lists.neo4j.org
  Cc: mystory-develop...@barnardos.org.aumailto:
  mystory-develop...@barnardos.org.au; Tatham Oddie
  Subject: RE: Lucene Custom Sort in Neo4j
 
 
 
 http://docs.neo4j.org/chunked/snapshot/gremlin-plugin.html#rest-api-send-an-arbitrary-groovy-script---lucene-sorting
 
  Send something like this via /ext/GremlinPlugin/graphdb/execute_script:
 
  import org.neo4j.graphdb.index.*
  import org.neo4j.index.lucene.*
  import org.apache.lucene.search.*
  neo4j = g.getRawGraph()
  idxManager = neo4j.index()
  clientIndex = idxManager.forNodes('agency123-clients')
  query = new QueryContext( 'FamilyName:Smith' ).sort( new Sort(new
  SortField( 'GivenName',SortField.STRING, true ) ) )
  results = clientIndex.query( query )
 
  Pros:
 
 
  · It’ll work
 
  Cons:
 
 
  · You’d might as well stop calling it the “REST” API
 
  · It’s fragile to changes in either the “REST” API or the Java
 API
  – twice the chance of getting bitten
 
  · It requires us to string concatenate snippets of Java code
  together within our C#
 
  If you go down this route, please bury it very very deep in Neo4jClient
  and expose a nicer API signature on top. :)
 
 
  -- Tatham
 
 
  From: Romiko Derbynew [mailto:romiko.derby...@readify.onmicrosoft.com
  ]mailto:[mailto:romiko.derby...@readify.onmicrosoft.com]
  Sent: Tuesday, 22 November 2011 2:36 PM
  To: user@lists.neo4j.orgmailto:user@lists.neo4j.org
  Cc: mystory-develop...@barnardos.org.aumailto:
  mystory-develop...@barnardos.org.au; Tatham Oddie
  Subject: Lucene Custom Sort in Neo4j
 
  Hi Guys,
 
  What is the easiest way for me to build a custom full text sort for
 lucene
  in Neo4j, the thing is, we use the REST API to query the index, and I
 would
  like to apply a custom sort
 
  e.g.
 
  I want to change sorting to:
  Sort by Relevance (Booster) then by IndexKey1 then by indexKey2.
 
  Currently, we have the default sort via the query parser api, but it is
  not powerful enough(
  http://lucene.apache.org/java/3_1_0/queryparsersyntax.html).
 
  Any ideas, how we could do this, and still leverage the REST API for
 index
  queries?
 
  Cheers
  ___
  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




-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Fwd: Lucene Custom Sort in Neo4j

2011-11-22 Thread Peter Neubauer
Maybe,
but that means that every index needs to have the notion of sorting
and ordering?

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              - NOSQL for the Enterprise.
http://startupbootcamp.org/    - Öresund - Innovation happens HERE.



On Tue, Nov 22, 2011 at 9:13 AM, Mattias Persson
matt...@neotechnology.com wrote:
 As a parameter to the index GET perhaps?

 GET .../index/node/myindex?query=name:*sort=GivenNameorder=desc

 2011/11/22 Peter Neubauer peter.neuba...@neotechnology.com

 I agree.
 Sending arbitrary Groovy is not what you want a database to execute. Do you
 see any good index - neutral way to expose this? It's even very relevant to
 Cypher...

 /peter

 Sent from my phone, please excuse typos and autocorrection.
 On Nov 22, 2011 4:46 AM, Tatham Oddie tat...@oddie.com.au wrote:

 
 
  --
  Tatham Oddie
  Tiny keyboard = tiny message
 
  Begin forwarded message:
 
  From: Tatham Oddie tatham.od...@readify.onmicrosoft.commailto:
  tatham.od...@readify.onmicrosoft.com
  Date: 22 November 2011 14:43:00 AEDT
  To: tat...@oddie.com.aumailto:tat...@oddie.com.au 
 tat...@oddie.com.au
  mailto:tat...@oddie.com.au
  Subject: FW: Lucene Custom Sort in Neo4j
 
 
 
  From: Tatham Oddie [mailto:tatham.od...@readify.onmicrosoft.com]
  Sent: Tuesday, 22 November 2011 2:42 PM
  To: Romiko Derbynew; user@lists.neo4j.orgmailto:user@lists.neo4j.org
  Cc: mystory-develop...@barnardos.org.aumailto:
  mystory-develop...@barnardos.org.au; Tatham Oddie
  Subject: RE: Lucene Custom Sort in Neo4j
 
 
 
 http://docs.neo4j.org/chunked/snapshot/gremlin-plugin.html#rest-api-send-an-arbitrary-groovy-script---lucene-sorting
 
  Send something like this via /ext/GremlinPlugin/graphdb/execute_script:
 
  import org.neo4j.graphdb.index.*
  import org.neo4j.index.lucene.*
  import org.apache.lucene.search.*
  neo4j = g.getRawGraph()
  idxManager = neo4j.index()
  clientIndex = idxManager.forNodes('agency123-clients')
  query = new QueryContext( 'FamilyName:Smith' ).sort( new Sort(new
  SortField( 'GivenName',SortField.STRING, true ) ) )
  results = clientIndex.query( query )
 
  Pros:
 
 
  ·         It’ll work
 
  Cons:
 
 
  ·         You’d might as well stop calling it the “REST” API
 
  ·         It’s fragile to changes in either the “REST” API or the Java
 API
  – twice the chance of getting bitten
 
  ·         It requires us to string concatenate snippets of Java code
  together within our C#
 
  If you go down this route, please bury it very very deep in Neo4jClient
  and expose a nicer API signature on top. :)
 
 
  -- Tatham
 
 
  From: Romiko Derbynew [mailto:romiko.derby...@readify.onmicrosoft.com
  ]mailto:[mailto:romiko.derby...@readify.onmicrosoft.com]
  Sent: Tuesday, 22 November 2011 2:36 PM
  To: user@lists.neo4j.orgmailto:user@lists.neo4j.org
  Cc: mystory-develop...@barnardos.org.aumailto:
  mystory-develop...@barnardos.org.au; Tatham Oddie
  Subject: Lucene Custom Sort in Neo4j
 
  Hi Guys,
 
  What is the easiest way for me to build a custom full text sort for
 lucene
  in Neo4j, the thing is, we use the REST API to query the index, and I
 would
  like to apply a custom sort
 
  e.g.
 
  I want to change sorting to:
  Sort by Relevance (Booster) then by IndexKey1 then by indexKey2.
 
  Currently, we have the default sort via the query parser api, but it is
  not powerful enough(
  http://lucene.apache.org/java/3_1_0/queryparsersyntax.html).
 
  Any ideas, how we could do this, and still leverage the REST API for
 index
  queries?
 
  Cheers
  ___
  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




 --
 Mattias Persson, [matt...@neotechnology.com]
 Hacker, Neo Technology
 www.neotechnology.com
 ___
 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


Re: [Neo4j] Fwd: Lucene Custom Sort in Neo4j

2011-11-22 Thread Andres Taylor
On Tue, Nov 22, 2011 at 10:20 AM, Peter Neubauer 
peter.neuba...@neotechnology.com wrote:

 Maybe,
 but that means that every index needs to have the notion of sorting
 and ordering?


I would be nice if we can introspect and see if the indexes available
support ordering.

Andrés
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Fwd: Lucene Custom Sort in Neo4j

2011-11-21 Thread Tatham Oddie


--
Tatham Oddie
Tiny keyboard = tiny message

Begin forwarded message:

From: Tatham Oddie 
tatham.od...@readify.onmicrosoft.commailto:tatham.od...@readify.onmicrosoft.com
Date: 22 November 2011 14:43:00 AEDT
To: tat...@oddie.com.aumailto:tat...@oddie.com.au 
tat...@oddie.com.aumailto:tat...@oddie.com.au
Subject: FW: Lucene Custom Sort in Neo4j



From: Tatham Oddie [mailto:tatham.od...@readify.onmicrosoft.com]
Sent: Tuesday, 22 November 2011 2:42 PM
To: Romiko Derbynew; user@lists.neo4j.orgmailto:user@lists.neo4j.org
Cc: 
mystory-develop...@barnardos.org.aumailto:mystory-develop...@barnardos.org.au;
 Tatham Oddie
Subject: RE: Lucene Custom Sort in Neo4j

http://docs.neo4j.org/chunked/snapshot/gremlin-plugin.html#rest-api-send-an-arbitrary-groovy-script---lucene-sorting

Send something like this via /ext/GremlinPlugin/graphdb/execute_script:

import org.neo4j.graphdb.index.*
import org.neo4j.index.lucene.*
import org.apache.lucene.search.*
neo4j = g.getRawGraph()
idxManager = neo4j.index()
clientIndex = idxManager.forNodes('agency123-clients')
query = new QueryContext( 'FamilyName:Smith' ).sort( new Sort(new SortField( 
'GivenName',SortField.STRING, true ) ) )
results = clientIndex.query( query )

Pros:


· It’ll work

Cons:


· You’d might as well stop calling it the “REST” API

· It’s fragile to changes in either the “REST” API or the Java API – 
twice the chance of getting bitten

· It requires us to string concatenate snippets of Java code together 
within our C#

If you go down this route, please bury it very very deep in Neo4jClient and 
expose a nicer API signature on top. :)


-- Tatham


From: Romiko Derbynew 
[mailto:romiko.derby...@readify.onmicrosoft.com]mailto:[mailto:romiko.derby...@readify.onmicrosoft.com]
Sent: Tuesday, 22 November 2011 2:36 PM
To: user@lists.neo4j.orgmailto:user@lists.neo4j.org
Cc: 
mystory-develop...@barnardos.org.aumailto:mystory-develop...@barnardos.org.au;
 Tatham Oddie
Subject: Lucene Custom Sort in Neo4j

Hi Guys,

What is the easiest way for me to build a custom full text sort for lucene in 
Neo4j, the thing is, we use the REST API to query the index, and I would like 
to apply a custom sort

e.g.

I want to change sorting to:
Sort by Relevance (Booster) then by IndexKey1 then by indexKey2.

Currently, we have the default sort via the query parser api, but it is not 
powerful enough(http://lucene.apache.org/java/3_1_0/queryparsersyntax.html).

Any ideas, how we could do this, and still leverage the REST API for index 
queries?

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


Re: [Neo4j] Fwd: Lucene Custom Sort in Neo4j

2011-11-21 Thread Peter Neubauer
I agree.
Sending arbitrary Groovy is not what you want a database to execute. Do you
see any good index - neutral way to expose this? It's even very relevant to
Cypher...

/peter

Sent from my phone, please excuse typos and autocorrection.
On Nov 22, 2011 4:46 AM, Tatham Oddie tat...@oddie.com.au wrote:



 --
 Tatham Oddie
 Tiny keyboard = tiny message

 Begin forwarded message:

 From: Tatham Oddie tatham.od...@readify.onmicrosoft.commailto:
 tatham.od...@readify.onmicrosoft.com
 Date: 22 November 2011 14:43:00 AEDT
 To: tat...@oddie.com.aumailto:tat...@oddie.com.au tat...@oddie.com.au
 mailto:tat...@oddie.com.au
 Subject: FW: Lucene Custom Sort in Neo4j



 From: Tatham Oddie [mailto:tatham.od...@readify.onmicrosoft.com]
 Sent: Tuesday, 22 November 2011 2:42 PM
 To: Romiko Derbynew; user@lists.neo4j.orgmailto:user@lists.neo4j.org
 Cc: mystory-develop...@barnardos.org.aumailto:
 mystory-develop...@barnardos.org.au; Tatham Oddie
 Subject: RE: Lucene Custom Sort in Neo4j


 http://docs.neo4j.org/chunked/snapshot/gremlin-plugin.html#rest-api-send-an-arbitrary-groovy-script---lucene-sorting

 Send something like this via /ext/GremlinPlugin/graphdb/execute_script:

 import org.neo4j.graphdb.index.*
 import org.neo4j.index.lucene.*
 import org.apache.lucene.search.*
 neo4j = g.getRawGraph()
 idxManager = neo4j.index()
 clientIndex = idxManager.forNodes('agency123-clients')
 query = new QueryContext( 'FamilyName:Smith' ).sort( new Sort(new
 SortField( 'GivenName',SortField.STRING, true ) ) )
 results = clientIndex.query( query )

 Pros:


 · It’ll work

 Cons:


 · You’d might as well stop calling it the “REST” API

 · It’s fragile to changes in either the “REST” API or the Java API
 – twice the chance of getting bitten

 · It requires us to string concatenate snippets of Java code
 together within our C#

 If you go down this route, please bury it very very deep in Neo4jClient
 and expose a nicer API signature on top. :)


 -- Tatham


 From: Romiko Derbynew [mailto:romiko.derby...@readify.onmicrosoft.com
 ]mailto:[mailto:romiko.derby...@readify.onmicrosoft.com]
 Sent: Tuesday, 22 November 2011 2:36 PM
 To: user@lists.neo4j.orgmailto:user@lists.neo4j.org
 Cc: mystory-develop...@barnardos.org.aumailto:
 mystory-develop...@barnardos.org.au; Tatham Oddie
 Subject: Lucene Custom Sort in Neo4j

 Hi Guys,

 What is the easiest way for me to build a custom full text sort for lucene
 in Neo4j, the thing is, we use the REST API to query the index, and I would
 like to apply a custom sort

 e.g.

 I want to change sorting to:
 Sort by Relevance (Booster) then by IndexKey1 then by indexKey2.

 Currently, we have the default sort via the query parser api, but it is
 not powerful enough(
 http://lucene.apache.org/java/3_1_0/queryparsersyntax.html).

 Any ideas, how we could do this, and still leverage the REST API for index
 queries?

 Cheers
 ___
 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