Re: [Neo4j] Default Analyzer in Index Framework
2011/10/26 Rick Bullotta > Hi, Mattias. > > That's exactly what we did. One interesting note: the query and get methods > seemed to work without lower casing the search term (maybe the analyzer is > used to parse the query?), but for native lucene queries we needed to > lowercase them. All good now! Thanks for the tips. > > You're right there, the analyzer is used both for altering added values as well as parsing queries. > Rick > > On Oct 25, 2011, at 7:08 PM, "Mattias Persson" > wrote: > > > Hi Rick, > > > > yes you can do that, but not in a super easy way. What you'd have to do > > right now to get it working is to make sure you create an index with a > > special analyzer which converts everything to lower case (both additions > and > > queries), effectively making it case insensitive. So create a class like > > this: > > > >public class LowerCaseAnalyzer extends Analyzer > >{ > >@Override > >public TokenStream tokenStream( String fieldName, Reader reader ) > >{ > >return new LowerCaseFilter( Version.LUCENE_31, new > > KeywordTokenizer( reader ) ); > >} > >} > > > > and make sure you create your index with a configuration map like: > > > >Index index = graphDb.index().forNodes( > >"myCaseInsensitiveIndex", MapUtil.stringMap( "analyzer", > > LowerCaseAnalyzer.class.getName() ) ); > > > > then this will work: > > > >index.add( node, "name", "Rick Bullotta" ); > >index.query( "name:\"rick bullotta\"" ); // ==> returns that node. > > > > 2011/10/25 Rick Bullotta > > > >> Anyone able to provide some insights on this? > >> > >> Thanks. > >> > >> From: user-boun...@lists.neo4j.org [user-boun...@lists.neo4j.org] On > >> Behalf Of Rick Bullotta [rick.bullo...@thingworx.com] > >> Sent: Monday, October 24, 2011 6:16 PM > >> To: Neo4j user discussions > >> Subject: [Neo4j] Default Analyzer in Index Framework > >> > >> When not using fulltext indexing, what Lucene Analyzer class does Neo4J > >> use? It seems that non-fulltext index searches are case sensitive - > we'd > >> like to change that behavior. > >> > >> Thanks for any help/guidance/examples! > >> > >> Rick > >> > >> ___ > >> 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 > -- 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] Default Analyzer in Index Framework
Hi, Mattias. That's exactly what we did. One interesting note: the query and get methods seemed to work without lower casing the search term (maybe the analyzer is used to parse the query?), but for native lucene queries we needed to lowercase them. All good now! Thanks for the tips. Rick On Oct 25, 2011, at 7:08 PM, "Mattias Persson" wrote: > Hi Rick, > > yes you can do that, but not in a super easy way. What you'd have to do > right now to get it working is to make sure you create an index with a > special analyzer which converts everything to lower case (both additions and > queries), effectively making it case insensitive. So create a class like > this: > >public class LowerCaseAnalyzer extends Analyzer >{ >@Override >public TokenStream tokenStream( String fieldName, Reader reader ) >{ >return new LowerCaseFilter( Version.LUCENE_31, new > KeywordTokenizer( reader ) ); >} >} > > and make sure you create your index with a configuration map like: > >Index index = graphDb.index().forNodes( >"myCaseInsensitiveIndex", MapUtil.stringMap( "analyzer", > LowerCaseAnalyzer.class.getName() ) ); > > then this will work: > >index.add( node, "name", "Rick Bullotta" ); >index.query( "name:\"rick bullotta\"" ); // ==> returns that node. > > 2011/10/25 Rick Bullotta > >> Anyone able to provide some insights on this? >> >> Thanks. >> >> From: user-boun...@lists.neo4j.org [user-boun...@lists.neo4j.org] On >> Behalf Of Rick Bullotta [rick.bullo...@thingworx.com] >> Sent: Monday, October 24, 2011 6:16 PM >> To: Neo4j user discussions >> Subject: [Neo4j] Default Analyzer in Index Framework >> >> When not using fulltext indexing, what Lucene Analyzer class does Neo4J >> use? It seems that non-fulltext index searches are case sensitive - we'd >> like to change that behavior. >> >> Thanks for any help/guidance/examples! >> >> Rick >> >> ___ >> 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] Default Analyzer in Index Framework
Hi Rick, yes you can do that, but not in a super easy way. What you'd have to do right now to get it working is to make sure you create an index with a special analyzer which converts everything to lower case (both additions and queries), effectively making it case insensitive. So create a class like this: public class LowerCaseAnalyzer extends Analyzer { @Override public TokenStream tokenStream( String fieldName, Reader reader ) { return new LowerCaseFilter( Version.LUCENE_31, new KeywordTokenizer( reader ) ); } } and make sure you create your index with a configuration map like: Index index = graphDb.index().forNodes( "myCaseInsensitiveIndex", MapUtil.stringMap( "analyzer", LowerCaseAnalyzer.class.getName() ) ); then this will work: index.add( node, "name", "Rick Bullotta" ); index.query( "name:\"rick bullotta\"" ); // ==> returns that node. 2011/10/25 Rick Bullotta > Anyone able to provide some insights on this? > > Thanks. > > From: user-boun...@lists.neo4j.org [user-boun...@lists.neo4j.org] On > Behalf Of Rick Bullotta [rick.bullo...@thingworx.com] > Sent: Monday, October 24, 2011 6:16 PM > To: Neo4j user discussions > Subject: [Neo4j] Default Analyzer in Index Framework > > When not using fulltext indexing, what Lucene Analyzer class does Neo4J > use? It seems that non-fulltext index searches are case sensitive - we'd > like to change that behavior. > > Thanks for any help/guidance/examples! > > Rick > > ___ > 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] Default Analyzer in Index Framework
Anyone able to provide some insights on this? Thanks. From: user-boun...@lists.neo4j.org [user-boun...@lists.neo4j.org] On Behalf Of Rick Bullotta [rick.bullo...@thingworx.com] Sent: Monday, October 24, 2011 6:16 PM To: Neo4j user discussions Subject: [Neo4j] Default Analyzer in Index Framework When not using fulltext indexing, what Lucene Analyzer class does Neo4J use? It seems that non-fulltext index searches are case sensitive - we'd like to change that behavior. Thanks for any help/guidance/examples! Rick ___ 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] Default Analyzer in Index Framework
When not using fulltext indexing, what Lucene Analyzer class does Neo4J use? It seems that non-fulltext index searches are case sensitive - we'd like to change that behavior. Thanks for any help/guidance/examples! Rick ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user