Re: [Neo4j] Questions on custom query using the index framework

2010-11-14 Thread Mattias Persson
2010/11/13 Samuel Feng okos...@gmail.com

 Hi,

 I am new to neo4j.

 I am using a custom analyzer in index in order to support Chinese.

chnIndex = this.graphDb.index().forNodes(product_chinese,
MapUtil.stringMap(analyzer,
 org.wltea.analyzer.lucene.IKAnalyzer));

 Below is the usage of the IKAnalyzer in lucence.

  IndexSearcher isearcher = new IndexSearcher(directory);
  isearcher.setSimilarity(new IKSimilarity());   // A custom Similarity
  String word = OLYMPUS 奥林巴斯 E-PL1 时尚白 微型4/3系统相机 套机 含14-42mm镜头;
  Query query = IKQueryParser.parse(fieldName, word );  // A custom
 QueryParser
  TopDocs topDocs = isearcher.search(query, 5); // Got the top 5
  System.out.println(Found  + topDocs.totalHits);
  ScoreDoc[] scoreDocs = topDocs.scoreDocs;
  for (int i = 0; i  topDocs.totalHits; i++) {
System.out.println(scoreDocs[i].score); // Got the score of each
 matched doc
Document targetDoc = isearcher.doc(scoreDocs[i].doc);
System.out.println(Document content is  + targetDoc.toString());
  }

 How can I use the query method of neo4j's indexing to implement
 1) Add my custom Similartiy implemtation


That would require new functionality, probably exposed as a configuration
parameter similarity:org.wltea.analyzer.lucene.IKAnalyzer or something.


 2) The TopDocs interface can replaced by the iterator of IndexHits, right?


In a way, yes. Actually IndexHits wraps a Hits instance (from lucene 2.x),
since it gives all the hits back. To make use of TopDocs instead a method
could be exposed via the QueryContext class. That's definately possible.


 3) Possible to get the score for each node in the IndexHits?


Would it be ok with an IndexHits#currentScore() method which could return
the score of the most recently returned node from the IndexHits object?



 Thank you for the help and time spent on this.


These are great ideas and I'd be happy to try and implement them.



 Samuel
 ___
 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] Simplicity from Complexity

2010-11-14 Thread Andreas Kollegger
Fun TED talk using graphs to represent complex systems...

http://www.youtube.com/watch?v=UB2iYzKeej8

Cheers,
Andreas

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


Re: [Neo4j] Questions on custom query using the index framework

2010-11-14 Thread Samuel Feng
Mattias,

Thanks a lot. Please find my update in red.

Thanks and Regards,

Samuel

2010/11/14 Mattias Persson matt...@neotechnology.com

 2010/11/13 Samuel Feng okos...@gmail.com

  Hi,
 
  I am new to neo4j.
 
  I am using a custom analyzer in index in order to support Chinese.
 
 chnIndex = this.graphDb.index().forNodes(product_chinese,
 MapUtil.stringMap(analyzer,
  org.wltea.analyzer.lucene.IKAnalyzer));
 
  Below is the usage of the IKAnalyzer in lucence.
 
   IndexSearcher isearcher = new IndexSearcher(directory);
   isearcher.setSimilarity(new IKSimilarity());   // A custom
 Similarity
   String word = OLYMPUS 奥林巴斯 E-PL1 时尚白 微型4/3系统相机 套机 含14-42mm镜头;
   Query query = IKQueryParser.parse(fieldName, word );  // A custom
  QueryParser
   TopDocs topDocs = isearcher.search(query, 5); // Got the top 5
   System.out.println(Found  + topDocs.totalHits);
   ScoreDoc[] scoreDocs = topDocs.scoreDocs;
   for (int i = 0; i  topDocs.totalHits; i++) {
 System.out.println(scoreDocs[i].score); // Got the score of each
  matched doc
 Document targetDoc = isearcher.doc(scoreDocs[i].doc);
 System.out.println(Document content is  + targetDoc.toString());
   }
 
  How can I use the query method of neo4j's indexing to implement
  1) Add my custom Similartiy implemtation
 

 That would require new functionality, probably exposed as a configuration
 parameter similarity:org.wltea.analyzer.lucene.IKAnalyzer or something.

 Maybe QueryContext can also be used here?


  2) The TopDocs interface can replaced by the iterator of IndexHits,
 right?
 

 In a way, yes. Actually IndexHits wraps a Hits instance (from lucene 2.x),
 since it gives all the hits back. To make use of TopDocs instead a method
 could be exposed via the QueryContext class. That's definately possible.


  3) Possible to get the score for each node in the IndexHits?
 

 Would it be ok with an IndexHits#currentScore() method which could return
 the score of the most recently returned node from the IndexHits object?

  That is a good idea. Please let me know the schedule of implement this, as
my team is looking forward to this feature. :)


 
  Thank you for the help and time spent on this.
 

 These are great ideas and I'd be happy to try and implement them.


 
  Samuel
  ___
  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] Spatial search using Lucene-spatial?

2010-11-14 Thread Peter Neubauer
Christopher,
thanks for the pointers! Yes, I am mainly thinking that the only stuff
required to include simple spatial work into the Lucene index
implementation is to pull in the SpatialHepler equivalent, which adds
the lon, lat and the CartesianPlotterField to the document (node,
relationship, etc) being indexed. This should not break anything, and
add a very simple way to get spatial functionality. I am thinking of
the popularity of the MongoDB spatial extension. Not much
functionality, but very easy accessible as part of a normal index
operation. Question is what the API should look like in order not to
add too much.

I think this is so small that the help could be added to the existing
index components (when someone has a bit of time :)

WDYT?

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://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



On Sun, Nov 14, 2010 at 12:42 AM, Christopher Schmidt
fakod...@googlemail.com wrote:
 Hi,

 I think Lucene provides a simple way to do distance queries.
 The limit is, that you can use only points (and a circle to define a
 distance). No interception with lines, polylines or stuff like that is
 possible. If you do not need it - fine...

 BTW:
 There is currently a discussion about changing lucenes spatial
 implementation. See
 http://www.mail-archive.com/d...@lucene.apache.org/msg03593.html and
 http://www.mail-archive.com/d...@lucene.apache.org/msg09654.html. Mainly due
 to the sinusoidal projection.

 (and if you are interested, I did Mikes spatial example with Lucene 3.0.2
 and in Scala
 http://blog.fakod.eu/2010/11/02/spatial-lucene-example-in-scala/)

 --
 Christopher
 twitter: @fakod
 blog: http://blog.fakod.eu

 On Sat, Nov 13, 2010 at 11:05 PM, Peter Neubauer 
 peter.neuba...@neotechnology.com wrote:

 Hi there,
 I just tried the examples for searching spatial with Lucene at
 http://develop.nydi.ch/2010/10/lucene-spatial-example/

 I am wondering if this still fits into the current Lucene framework
 integration, so we could add spatial indexing for simple Nodes with
 lat/lon properties into the existing index component, or simply have
 another (spatial) index backed by neo4j-lucene-index and exposed
 through the index framework? This is not on the level of Neo4j
 Spatial, but it would give a simple geo-lookup boundary for nodes or
 relationships. Is the support for adding the required Lucene spatial
 document fields already exposed so this could be added without bigger
 modifications to existing code?

 WDYT?

 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://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
 ___
 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] what is the neo model

2010-11-14 Thread Jose Angel Inda Herrera
Hello,
What is the neo model? and neo model a node can handle me like a graph, ie, I 
can be stored in a node type, a graph.
Thank you
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user