Hi Balazs, I think the issue could be in lucene, with the mix of the white-space-tokenizing-analyzer and numeric values. I don't know. What I see in neo4j is that it treats the values the exact same way, the queries to the index is exactly the same, but it just doesn't return any values. I think there needs to be some more googling around this to get more answers.
2011/6/28 Balazs E. Pataki <pat...@dsd.sztaki.hu> > Hi, > > I'm playing around with indexing and numeric range queries according to > this documentation: > > http://docs.neo4j.org/chunked/snapshot/indexing-lucene-extras.html > > According to my tests numeric range queries > (QueryContext.numericRange()) only have effect when "exact" type index > is used. > > > I tried this: > > Transaction tx = graphDb.beginTx(); > try { > > Index<Node> exactIndex = graphDb.index().forNodes("exactIndex", > MapUtil.stringMap( IndexManager.PROVIDER, "lucene", "type", "exact" )); > Index<Node> fulltextIndex = graphDb.index().forNodes("fulltextIndex", > MapUtil.stringMap( IndexManager.PROVIDER, "lucene", "type", "fulltext" )); > > Node n1 = graphDb.createNode(); > n1.setProperty("foo", 5); > exactIndex.add(n1, "foo", ValueContext.numeric(5)); > fulltextIndex.add(n1, "foo", ValueContext.numeric(5)); > > Node n2 = graphDb.createNode(); > n2.setProperty("foo", 25); > exactIndex.add(n2, "foo", ValueContext.numeric(25)); > fulltextIndex.add(n2, "foo", ValueContext.numeric(25)); > > // Force commit > tx.success(); > tx.finish(); > tx = graphDb.beginTx(); > > //Search exact > QueryContext qctx = QueryContext.numericRange("foo", 3, 25); > IndexHits<Node> hits = exactIndex.query(qctx); > Iterator<Node> it = hits.iterator(); > while (it.hasNext()) { > Node n = it.next(); > System.out.println("Found foo in exact: "+n+": > "+n.getProperty("foo")); > } > assertEquals(2, hits.size()); > > //Search fulltext > qctx = QueryContext.numericRange("foo", 3, 25); > hits = fulltextIndex.query(qctx); > it = hits.iterator(); > while (it.hasNext()) { > Node n = it.next(); > System.out.println("Found foo in fulltext: "+n+": > "+n.getProperty("foo")); > } > assertEquals(2, hits.size()); > > tx.success(); > } finally { > tx.finish(); > } > > For the "exact" configured index the range query returns two nodes, > while in "fulltext" configured index I get no result. > > Is there a way to use numeric range queries with fulltext indexes? > > Thanks for any hints, > --- > balazs > _______________________________________________ > 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